X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=ud-generate;h=6ac9bde5951b82292d6935d19985b05e8c7ff6cc;hb=6b038cc113dde577b9cc19c62656bf6d2b41362d;hp=412e210b4c11090baf203a5f582994bdcc72a3be;hpb=9aea6b7bd33ea6a48a10283bc8593980c026bcba;p=mirror%2Fuserdir-ldap.git diff --git a/ud-generate b/ud-generate index 412e210..6ac9bde 100755 --- a/ud-generate +++ b/ud-generate @@ -274,12 +274,12 @@ def GenShadowSudo(File, untrusted): global PasswdAttrs for x in PasswdAttrs: + a = UDLdap.Account(x[0], x[1]) Pass = '*' - if x[1].has_key("uidNumber") == 0 or not IsInGroup(x): - continue + if not IsInGroup(x): continue - if x[1].has_key('sudoPassword'): - for entry in x[1]['sudoPassword']: + if 'sudoPassword' in a: + for entry in a['sudoPassword']: Match = re.compile('^('+UUID_FORMAT+') (confirmed:[0-9a-f]{40}|unconfirmed) ([a-z0-9.,*]+) ([^ ]+)$').match(entry) if Match == None: continue @@ -288,7 +288,7 @@ def GenShadowSudo(File, untrusted): hosts = Match.group(3) cryptedpass = Match.group(4) - if status != 'confirmed:'+make_passwd_hmac('password-is-confirmed', 'sudo', x[1]['uid'][0], uuid, hosts, cryptedpass): + if status != 'confirmed:'+make_passwd_hmac('password-is-confirmed', 'sudo', a['uid'], uuid, hosts, cryptedpass): continue for_all = hosts == "*" for_this_host = CurrentHost in hosts.split(',') @@ -303,7 +303,7 @@ def GenShadowSudo(File, untrusted): if len(Pass) > 50: Pass = '*' - Line = "%s:%s" % (GetAttr(x, "uid"), Pass) + Line = "%s:%s" % (a['uid'], Pass) Line = Sanitize(Line) + "\n" F.write("%s" % (Line))