write machine specifications for ssh keys to ldap
authorHelmut Grohne <helmut@subdivi.de>
Fri, 22 Jan 2010 22:51:24 +0000 (23:51 +0100)
committerStephen Gran <steve@lobefin.net>
Sun, 24 Jan 2010 19:13:52 +0000 (19:13 +0000)
ud-mailgate

index 87e2a04..283ee22 100755 (executable)
@@ -281,6 +281,7 @@ def DoSSH(Str, Attrs, badkeys, uid):
       return None;
 
    # lines can now be prepended with "allowed_hosts=machine1,machine2 "
+   machines = []
    if Str.startswith("allowed_hosts="):
       Str = Str.split("=", 1)[1]
       if ' ' not in Str:
@@ -303,6 +304,10 @@ def DoSSH(Str, Attrs, badkeys, uid):
    if (result != 0):
       raise UDExecuteError, "ssh-keygen -l invocation failed!\n%s\n" % (output)
 
+   # format the string again for ldap:
+   if machines:
+      Str = "allowed_hosts=%s %s" % (",".join(machines), Str)
+
 
    # Head
    Date = time.strftime("%a, %d %b %Y %H:%M:%S +0000",time.gmtime(time.time()))