ud-generate: don't blow up when a host does not have IP-addresses
[mirror/userdir-ldap.git] / ud-generate
index 386dce6..3b9a627 100755 (executable)
@@ -1015,6 +1015,9 @@ def GenHosts(File):
          if IsDebianHost.match(GetAttr(x, "hostname")) is None:
             continue
 
+         if not 'ipHostNumber' in x[1]:
+            continue
+
          addrs = x[1]["ipHostNumber"]
          for addr in addrs:
             if addr not in seen:
@@ -1046,7 +1049,7 @@ Attrs = l.search_s(BaseDn, ldap.SCOPE_ONELEVEL, "gid=*",\
 
 # Generate the SubGroupMap and GroupIDMap
 for x in Attrs:
-   if x[1].has_key("status") and x[1]['status'] == "disabled":
+   if x[1].has_key("accountStatus") and x[1]['accountStatus'] == "disabled":
       continue
    if x[1].has_key("gidNumber") == 0:
       continue