update for python 2.1
authorrmurray <>
Thu, 13 Mar 2003 03:26:43 +0000 (03:26 +0000)
committerrmurray <>
Thu, 13 Mar 2003 03:26:43 +0000 (03:26 +0000)
ud-generate
userdir_ldap.py

index 7011dd0..a0c735d 100755 (executable)
@@ -5,6 +5,9 @@
 import string, re, time, ldap, getopt, sys, os, pwd, posix, socket;
 from userdir_ldap import *;
 
+global Allowed;
+global CurrentHost;
+
 PasswdAttrs = None;
 GroupIDMap = {};
 Allowed = None;
@@ -24,7 +27,6 @@ def DoLink(From,To,File):
 
 # See if this user is in the group list
 def IsInGroup(DnRecord):
-  global Allowed,CurrentHost;
   if Allowed == None:
      return 1;
 
@@ -561,7 +563,6 @@ while(1):
       if GroupIDMap.has_key(I):
          GroupList[str(GroupIDMap[I])] = None;
 
-   global Allowed,CurrentHost;
    Allowed = GroupList;
    CurrentHost = Split[0];
 
index aee0e6f..80edc28 100644 (file)
@@ -1,5 +1,5 @@
 # Some routines and configuration that are used by the ldap progams
-import termios, TERMIOS, re, string, imp, ldap, sys, whrandom, crypt, rfc822;
+import termios, re, string, imp, ldap, sys, whrandom, crypt, rfc822;
 import userdir_gpg
 
 try:
@@ -70,16 +70,16 @@ def PrettyShow(DnRecord):
 
 # Function to prompt for a password 
 def getpass(prompt = "Password: "):
-   import termios, TERMIOS, sys;
+   import termios, sys;
    fd = sys.stdin.fileno();
    old = termios.tcgetattr(fd);
    new = termios.tcgetattr(fd);
-   new[3] = new[3] & ~TERMIOS.ECHO;          # lflags
+   new[3] = new[3] & ~termios.ECHO;          # lflags
    try:
-      termios.tcsetattr(fd, TERMIOS.TCSADRAIN, new);
+      termios.tcsetattr(fd, termios.TCSADRAIN, new);
       passwd = raw_input(prompt);
    finally:
-      termios.tcsetattr(fd, TERMIOS.TCSADRAIN, old);
+      termios.tcsetattr(fd, termios.TCSADRAIN, old);
    print;
    return passwd;