* Remove use of deprecated functions from the string module
[mirror/userdir-ldap.git] / ud-echelon
index a58c0ec..3632980 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 # -*- mode: python -*-
-import userdir_gpg, userdir_ldap, sys, traceback, time, ldap, posix, getopt;
-import string, pwd
+import userdir_gpg, userdir_ldap, sys, traceback, time, ldap, os, getopt;
+import pwd
 from userdir_gpg import *;
 from userdir_ldap import *;
 
@@ -22,9 +22,9 @@ def TryGPG(Email):
       ErrLog.write(S);
       return None;
 
-   if string.find(Msg[0],"-----BEGIN PGP SIGNED MESSAGE-----") == -1:
+   if Msg[0].find("-----BEGIN PGP SIGNED MESSAGE-----") == -1:
       return None;
-      
+
    Res = GPGCheckSig(Msg[0]);
 
    # Failed to find a matching sig
@@ -34,7 +34,7 @@ def TryGPG(Email):
       return None;
       
    # Search for the matching key fingerprint
-   Attrs = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,"keyfingerprint=" + Res[2][1]);
+   Attrs = l.search_s(BaseDn,ldap.SCOPE_ONELEVEL,"keyFingerPrint=" + Res[2][1]);
    if len(Attrs) == 0:
       return None;
    if len(Attrs) != 1:
@@ -96,8 +96,8 @@ try:
    global l;
    l = ldap.open(LDAPServer);
    if Debug == None:
-      F = open(PassDir+"/pass-"+pwd.getpwuid(posix.getuid())[0],"r");
-      AccessPass = string.split(string.strip(F.readline())," ");
+      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]);
       F.close();
    else: