Skip to content

Commit

Permalink
b/f
Browse files Browse the repository at this point in the history
  • Loading branch information
apexo committed Jan 30, 2012
1 parent be532f7 commit a3183b0
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions authorized-keys-fs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ def load_config():
for k, value in os.environ.iteritems():
if k.startswith("LDAP"):
token = k[4:].upper()
value = v
if token in ("URI",):
value = value.split()
result[token] = value
return result

def _ldap_open_bind():
l = ldap.open(config["URI"][0])
l = ldap.initialize(config["URI"][0])
l.simple_bind_s(config.get("BINDDN"), config.get("BINDPW"))
return l

Expand Down Expand Up @@ -80,12 +79,12 @@ def _ldap_lookup(attribute, expression):
def lookup_keys(name):
return "\n".join(_ldap_lookup("sshPublicKey", "uid=%s"%(name,)))

def lookup_users(config):
return _ldap_lookup(config, "uid", "uid=*")
def lookup_users():
return _ldap_lookup("uid", "uid=*")

def lookup_gitorious_keys():
result = []
for id_, attributes in _ldap_search(config, "uid=*", ["uid", "sshPublicKey"]):
for id_, attributes in _ldap_search("uid=*", ["uid", "sshPublicKey"]):
if not "uid" in attributes:
continue
if not "sshPublicKey" in attributes:
Expand Down

0 comments on commit a3183b0

Please sign in to comment.