X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=ud-echelon;h=b2b4f0706c301a5a966393aca05689f908624cd3;hb=refs%2Fheads%2Fsalsa;hp=38e0718f3af2a795aed0410e666f618c600f1552;hpb=703033b7eeaffc61568300877d2d452651388acf;p=mirror%2Fuserdir-ldap.git diff --git a/ud-echelon b/ud-echelon index 38e0718..b2b4f07 100755 --- a/ud-echelon +++ b/ud-echelon @@ -46,14 +46,14 @@ def TryGPG(mail): # Try to guess the name from the email address def TryMatcher(mail): Sender = mail["From"]; - if Sender == None: + if Sender is None: return None; # Split up the address and invoke the matcher routine UID = GetUID(l,SplitEmail(Sender)); - if UID[0] == None: - if UID[1] == None or len(UID[1]) == 0: + if UID[0] is None: + if UID[1] is None or len(UID[1]) == 0: return None; # Print out an error message @@ -72,7 +72,7 @@ for (switch, val) in options: Debug = ""; # Open the log files -if Debug == None: +if Debug is None: MainLog = open(Ech_MainLog,"a+",0); ErrLog = open(Ech_ErrorLog,"a+",0); else: @@ -96,7 +96,7 @@ try: ErrMsg = "An error occured while performing the LDAP lookup"; global l; l = connectLDAP() - if Debug == None: + if Debug is None: F = open(PassDir+"/pass-"+pwd.getpwuid(os.getuid())[0],"r"); AccessPass = F.readline().strip().split(" ") l.simple_bind_s("uid="+AccessPass[0]+","+BaseDn,AccessPass[1]); @@ -108,7 +108,7 @@ try: ErrType = EX_TEMPFAIL; ErrMsg = "An error occured while trying GPG decoding"; User = TryGPG(mail); - if User == None: + if User is None: ErrMsg = "An error occured while trying Matcher decoding"; User = TryMatcher(mail); @@ -117,12 +117,12 @@ try: if not List: List = "-"; # Tada, write a log message - if User != None: + if User is not None: Msg = "[%s] \"%s\" \"%s\" \"%s\""%(Now,User[2],List,MsgID); MainLog.write("%s %s %s\n"%(User[0],User[1],Msg)); Dn = "uid=" + User[0] + "," + BaseDn; Rec = [(ldap.MOD_REPLACE,"activity-%s"%(User[1]),Msg)]; - if Debug == None: + if Debug is None: l.modify_s(Dn,Rec); else: print Rec;