From: jgg <> Date: Wed, 20 Oct 1999 03:59:35 +0000 (+0000) Subject: Cute dns entries X-Git-Tag: debian_userdir-ldap_0-3-7~199 X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fuserdir-ldap.git;a=commitdiff_plain;h=32e0c5640dc72acf4c362fd373f26be78a45a277 Cute dns entries --- diff --git a/doc/ud-info.1.yo b/doc/ud-info.1.yo index 09df24f..b72db4d 100644 --- a/doc/ud-info.1.yo +++ b/doc/ud-info.1.yo @@ -108,6 +108,7 @@ itemize( it() Australian Database http://www.environment.gov.au/database/MAN200R.html it() Canadian Database http://GeoNames.NRCan.gc.ca/ it() Atlas of the World, indexed by city http://www.astro.com/atlas/ + it() Xerox PARC Map Viewer http://mapweb.parc.xerox.com/map it() GNU Timezone database, organized partially by country /usr/share/zoneinfo/zone.tab ) diff --git a/ud-generate b/ud-generate index def3186..e70efb0 100755 --- a/ud-generate +++ b/ud-generate @@ -305,12 +305,23 @@ def GenDNS(l,File): F.write("; %s\n"%(EmailAddress(x))); for z in x[1]["dnszoneentry"]: Split = string.split(string.lower(z)); - for y in range(0,len(Split)): - if Split[y] == "$": - Split[y] = "\n\t"; - - Line = string.join(Split," ") + "\n"; - F.write(Line); + if string.lower(Split[1]) == 'in': + for y in range(0,len(Split)): + if Split[y] == "$": + Split[y] = "\n\t"; + Line = string.join(Split," ") + "\n"; + F.write(Line); + + # Write some identication information + if string.lower(Split[2]) != "cname": + Line = "%s IN TXT \"%s\"\n"%(Split[0],EmailAddress(x)); + for y in x[1]["keyfingerprint"]: + Line = Line + "%s IN TXT \"PGP %s\"\n"%(Split[0],FormatPGPKey(y)); + F.write(Line); + else: + Line = "; Err %s"%(str(Split)); + F.write(Line); + F.write("\n"); except: pass; @@ -345,7 +356,8 @@ PasswdAttrs = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,"uid=*",\ "gecos","loginshell","userpassword","shadowlastchange",\ "shadowmin","shadowmax","shadowwarning","shadowinactive", "shadowexpire","emailforward","latitude","longitude",\ - "allowedhosts","sshrsaauthkey","dnszoneentry","cn","sn"]); + "allowedhosts","sshrsaauthkey","dnszoneentry","cn","sn",\ + "keyfingerprint"]); # Open the control file if len(sys.argv) == 1: diff --git a/ud-info b/ud-info index 7159772..4b0c103 100755 --- a/ud-info +++ b/ud-info @@ -121,26 +121,7 @@ def PrintKeys(Attrs): First = 1; else: print "%-24s:" % (""), - - # PGP Print - if (len(x) == 32): - I = 0; - while (I < len(x)): - print x[I]+x[I+1], - I = I + 2; - if I == 32/2: - print "", - elif (len(x) == 40): - # GPG Print - I = 0; - while (I < len(x)): - print x[I]+x[I+1]+x[I+2]+x[I+3], - I = I + 4; - if I == 40/2: - print "", - else: - print x, - print; + print FormatPGPKey(x); # Print the SSH RSA Authentication keys for a user def PrintSshRSAKeys(Attrs): diff --git a/userdir_ldap.py b/userdir_ldap.py index 32b830e..15e3875 100644 --- a/userdir_ldap.py +++ b/userdir_ldap.py @@ -214,3 +214,29 @@ def FormatSSHAuth(Str): if G[0] == None: return "%s %s %s..%s %s"%(G[1],G[2],G[3][:8],G[3][-8:],G[4]); return "%s %s %s %s..%s %s"%(G[0],G[1],G[2],G[3][:8],G[3][-8:],G[4]); + +def FormatPGPKey(Str): + Res = ""; + + # PGP 2.x Print + if (len(Str) == 32): + I = 0; + while (I < len(Str)): + if I+2 == 32/2: + Res = "%s %s%s "%(Res,Str[I],Str[I+1]); + else: + Res = "%s%s%s "%(Res,Str[I],Str[I+1]); + I = I + 2; + elif (len(Str) == 40): + # OpenPGP Print + I = 0; + while (I < len(Str)): + if I+4 == 40/2: + Res = "%s %s%s%s%s "%(Res,Str[I],Str[I+1],Str[I+2],Str[I+3]); + else: + Res = "%s%s%s%s%s "%(Res,Str[I],Str[I+1],Str[I+2],Str[I+3]); + I = I + 4; + else: + Res = Str; + return Res; +