commit 8d4f397b94f056347bcaffb64c22ba38539fc0fb
Author: Radek Novacek <rnovacek(a)redhat.com>
Date: Thu Oct 30 12:47:54 2014 +0100
vsdm: make extraction of CN from cert more robust
The subject might contain different entries than just CN.
virt/vdsm/vdsm.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/virt/vdsm/vdsm.py b/virt/vdsm/vdsm.py
index 84cdbc3..af0c797 100644
--- a/virt/vdsm/vdsm.py
+++ b/virt/vdsm/vdsm.py
@@ -21,6 +21,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
"""
+import re
import xmlrpclib
from ConfigParser import SafeConfigParser, NoSectionError, NoOptionError
import subprocess
@@ -68,7 +69,7 @@ class Vdsm(DirectVirt):
out, err = p.communicate()
if p.returncode != 0:
return '0'
- return out.split('=')[-1].strip()
+ return re.search('/CN=([^/]+)/', out).group(1)
def _secureConnect(self):
addr = self._getLocalVdsName(self.trust_store_path)
Show replies by date