Skip to content

Commit 23f4e63

Browse files
authored
Merge pull request #591 from Pennyw0rth/neff-patch-1
Catch ldap error if host is not reachable
2 parents 6135e12 + dafc28a commit 23f4e63

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

nxc/protocols/ldap.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import hashlib
44
import hmac
55
import os
6+
from errno import EHOSTUNREACH
67
from binascii import hexlify
78
from datetime import datetime
89
from re import sub, I
@@ -209,7 +210,11 @@ def create_conn_obj(self):
209210
self.logger.debug(f"{e} on host {self.host}")
210211
return False
211212
except OSError as e:
212-
self.logger.error(f"Error getting ldap info {e}")
213+
if e.errno == EHOSTUNREACH:
214+
self.logger.info(f"Error connecting to {self.host} - {e}")
215+
return False
216+
else:
217+
self.logger.error(f"Error getting ldap info {e}")
213218

214219
self.logger.debug(f"Target: {target}; target_domain: {target_domain}; base_dn: {base_dn}")
215220
self.target = target

0 commit comments

Comments
 (0)