Fix crash when building DN of host with name ending with period.
Fix #797
This commit is contained in:
1 parent
5c105a5ff4
commit
2bb944bea7
1 file changed
+5
-4
@@ -240,15 +240,16 @@ class host(LDAPObject):
|
||||
)
|
||||
|
||||
def get_dn(self, *keys, **options):
|
||||
if keys[-1].endswith('.'):
|
||||
keys[-1] = keys[-1][:-1]
|
||||
dn = super(host, self).get_dn(*keys, **options)
|
||||
hostname = keys[-1]
|
||||
if hostname.endswith('.'):
|
||||
hostname = hostname[:-1]
|
||||
dn = super(host, self).get_dn(hostname, **options)
|
||||
try:
|
||||
self.backend.get_entry(dn, [''])
|
||||
except errors.NotFound:
|
||||
try:
|
||||
(dn, entry_attrs) = self.backend.find_entry_by_attr(
|
||||
'serverhostname', keys[-1], self.object_class, [''],
|
||||
'serverhostname', hostname, self.object_class, [''],
|
||||
self.container_dn
|
||||
)
|
||||
except errors.NotFound:
|
||||
|
||||
Reference in new issue
Block a user