X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fuserdir-ldap.git;a=blobdiff_plain;f=ud-emailmatcher;h=bae8fd9d6feeb1dcc3bb830cb1257d454a769957;hp=daf76cd88143e5d06c9659a0bbccd0043a442a8c;hb=a6fb69805c3999a85c064a96c93417bb1c284c5c;hpb=3ec1386cd62200a1d86fc72168c2aa1fe305bdd8 diff --git a/ud-emailmatcher b/ud-emailmatcher index daf76cd..bae8fd9 100755 --- a/ud-emailmatcher +++ b/ud-emailmatcher @@ -3,7 +3,7 @@ # This script tries to match a list of email addresses to the ldap database # uids. It makes use of the PGP key ring to determine matches -import string, re, time, ldap, getopt, sys; +import re, time, ldap, getopt, sys; from userdir_ldap import *; from userdir_gpg import *; @@ -13,14 +13,14 @@ AddressSplit = re.compile("(.*).*<([^@]*)@([^>]*)>"); def ImportForward(File,EmailMap): F = open(File,"r"); while(1): - Line = string.strip(F.readline()); + Line = F.readline().strip() if Line == "": break; - Split = string.split(Line,":"); + Split = Line.split(":") if len(Split) != 2: continue; - Addr = string.strip(Split[1]); + Addr = Split[1].strip() if EmailMap.has_key(Addr) and EmailMap[Addr] != Split[0]: print "Dup Over Emap",Line,Split else: @@ -34,12 +34,12 @@ def ImportOverride(File,OverMap): Line = F.readline(); if Line == "": break; - Line = string.strip(Line); + Line = Line.strip() - Split = string.split(Line,":"); + Split = Line.split(":") if len(Split) != 2: continue; - OverMap[Split[0]] = string.strip(Split[1]); + OverMap[Split[0]] = Split[1].strip() F.close(); (options, arguments) = getopt.getopt(sys.argv[1:], "o:f:") @@ -50,7 +50,7 @@ for x in arguments: Args.append("--keyring"); Args.append(x); Args = Args + GPGSearchOptions + [" 2> /dev/null"] -Keys = os.popen(string.join(Args," "),"r"); +Keys = os.popen(" ".join(Args),"r") l = ldap.open(LDAPServer); l.simple_bind_s("",""); @@ -80,7 +80,7 @@ while(1): if Line == "": break; - Split = string.split(Line,":"); + Split = Line.split(":") if len(Split) >= 8 and Split[0] == "pub": if FingerPrint != None and UID != None: for x in Emails: @@ -124,9 +124,9 @@ while(1): Line = sys.stdin.readline(); if Line == "": break; - Line = string.strip(Line); + Line = Line.strip() - Split = string.split(Line,"@"); + Split = Line.split("@") if len(Split) != 2: continue; @@ -134,7 +134,7 @@ while(1): if Split[1] == EmailAppend: if FinalMap.has_key(Line): print "Dup",Line - Split2 = string.split(Split[0],"-"); + Split2 = Split[0].split("-") FinalMap[Line] = Split2[0]; continue; @@ -146,7 +146,7 @@ while(1): continue; # Try again splitting off common address appendage modes - Split2 = string.split(Split[0],"-"); + Split2 = Split[0].split("-") Addr = Split2[0]+'@'+Split[1]; if EmailMap.has_key(Addr): if FinalMap.has_key(Addr):