From 2e4bd4b1dbc2ffb5798e249b2ed2146e371c0120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez=20Garc=C3=ADa?= Date: Mon, 17 Jul 2017 12:14:35 +0200 Subject: [PATCH] * Fix on recovering v1 WindDomainOsManager * Added support for "strange" groupnames (with parentheses, quotes, ...) --- .../uds/osmanagers/WindowsOsManager/WinDomainOsManager.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/src/uds/osmanagers/WindowsOsManager/WinDomainOsManager.py b/server/src/uds/osmanagers/WindowsOsManager/WinDomainOsManager.py index d55b3c8e7..e37bc3ab7 100644 --- a/server/src/uds/osmanagers/WindowsOsManager/WinDomainOsManager.py +++ b/server/src/uds/osmanagers/WindowsOsManager/WinDomainOsManager.py @@ -119,8 +119,9 @@ class WinDomainOsManager(WindowsOsManager): def __getGroup(self, l): base = ','.join(['DC=' + i for i in self._domain.split('.')]) + group = self._group.replace('\\', '\\\\').replace('(', '\\(').replace(')', '\\)') - res = l.search_ext_s(base=base, scope=ldap.SCOPE_SUBTREE, filterstr="(&(objectClass=group)(|(cn={0})(sAMAccountName={0})))".format(self._group), attrlist=[b'dn']) + res = l.search_ext_s(base=base, scope=ldap.SCOPE_SUBTREE, filterstr="(&(objectClass=group)(|(cn={0})(sAMAccountName={0})))".format(group), attrlist=[b'dn']) if res[0] is None: return None @@ -275,6 +276,8 @@ class WinDomainOsManager(WindowsOsManager): if data[0] == 'v2': self._group = data[6] + else: + self._group = '' super(WinDomainOsManager, self).unmarshal(data[5].decode('hex'))