Skip to content

Commit

Permalink
Fix double password prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
dmulder committed Oct 30, 2020
1 parent ca92d6b commit dc17dc8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/ads.in
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ def ldap_posix_pwent(creds, container):

def nss_getpwnam(args):
if args.direct:
pw = ldap_posix_user(get_creds(args), args.object, user_container())
creds = get_creds(args)
pw = ldap_posix_user(creds, args.object, user_container(creds))
else:
realm = get_default_realm()
pw = getpwnam(args.object)
Expand All @@ -213,7 +214,7 @@ def nss_getgrnam_getgrid(args):
def nss_getpwent(args):
creds = get_creds(args)
if 'direct' in args and args.direct:
ulist = ldap_posix_pwent(creds, user_container())
ulist = ldap_posix_pwent(creds, user_container(creds))
else:
ulist = getpwent(creds)
for pw in ulist:
Expand Down Expand Up @@ -340,10 +341,9 @@ def ldap_open(realm, creds):

wkguiduc = 'A9D1CA15768811D1ADED00C04FD8D5CD'
uc = None
def user_container():
def user_container(creds):
global uc, wkguiduc
if not uc:
creds = get_creds(args)
l = ldap_open(get_default_realm(), creds)
results = l.search('<WKGUID=%s,%s>' % (wkguiduc, realm_to_dn(get_default_realm())), ldb.SCOPE_SUBTREE, '(objectClass=container)', ['distinguishedName'])
uc = results[0]['distinguishedName'][-1]
Expand Down Expand Up @@ -371,7 +371,7 @@ def attrs(args):
l = ldap_open(get_default_realm(), creds)
container = args.c
if not container:
container = user_container()
container = user_container(creds)
results = l.search(container, ldb.SCOPE_SUBTREE, '(cn=%s)' % args.object, args.attributes)
for result in results:
print_ldap_object(result, args.b)
Expand All @@ -383,7 +383,7 @@ def getdn(cn, container=None):
creds = get_creds(args)
l = ldap_open(get_default_realm(), creds)
if not container:
container = user_container()
container = user_container(creds)
results = l.search(container, ldb.SCOPE_SUBTREE, '(cn=%s)' % cn, ['distinguishedName'])
return results[0]['distinguishedName'][-1]

Expand Down

0 comments on commit dc17dc8

Please sign in to comment.