X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=ud-mailgate;h=63411303f2ae2b168a84a437a91543cdf65f1db3;hb=192b08454e66c7c753f47c1b4be1d89c5feac6c8;hp=69707f8be2f2279a790bc44943fd0d5c50e4fa8f;hpb=b88b250206ceefa82a7018f4539e5e5fee83b8ec;p=mirror%2Fuserdir-ldap.git diff --git a/ud-mailgate b/ud-mailgate index 69707f8..6341130 100755 --- a/ud-mailgate +++ b/ud-mailgate @@ -467,7 +467,7 @@ def HandleChange(Reply,DnRecord,Key): Result = Result + Res + "\n"; # Connect to the ldap server - l = ldap.open(LDAPServer); + l = connectLDAP() F = open(PassDir+"/pass-"+pwd.getpwuid(os.getuid())[0],"r"); AccessPass = F.readline().strip().split(" ") F.close(); @@ -538,7 +538,7 @@ def HandleChPass(Reply,DnRecord,Key): Reply = Reply + TemplateSubst(Subst,open(TemplatesDir+"passwd-changed","r").read()); # Connect to the ldap server - l = ldap.open(LDAPServer); + l = connectLDAP() F = open(PassDir+"/pass-"+pwd.getpwuid(os.getuid())[0],"r"); AccessPass = F.readline().strip().split(" ") F.close(); @@ -551,7 +551,8 @@ def HandleChPass(Reply,DnRecord,Key): raise Error, "This account is locked"; # Modify the password - Rec = [(ldap.MOD_REPLACE,"userPassword","{crypt}"+Pass)]; + Rec = [(ldap.MOD_REPLACE,"userPassword","{crypt}"+Pass), + (ldap.MOD_REPLACE,"shadowLastChange",str(int(time.time()/24/60/60)))]; Dn = "uid=" + GetAttr(DnRecord,"uid") + "," + BaseDn; l.modify_s(Dn,Rec); @@ -615,7 +616,7 @@ try: ErrType = EX_TEMPFAIL; ErrMsg = "An error occured while performing the LDAP lookup"; global l; - l = ldap.open(LDAPServer); + l = connectLDAP() l.simple_bind_s("",""); # Search for the matching key fingerprint