* Remove use of deprecated functions from the string module
[mirror/userdir-ldap.git] / ud-roleadd
index 08f28ac..f6810f1 100755 (executable)
@@ -19,7 +19,7 @@
 #   along with this program; if not, write to the Free Software
 #   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-import string, time, ldap, getopt, sys, os, pwd
+import time, ldap, getopt, sys, os, pwd
 from userdir_ldap import *
 
 # This tries to search for a free UID. There are two possible ways to do
@@ -69,7 +69,10 @@ if Res != "":
 # GID
 Res = raw_input("Group ID Number? ")
 if Res != "":
-   gidNumber = Group2GID(Res)
+   gidNumber = Group2GID(l, Res)
+   if gidNumber == -1:
+      print "Can't figure out which gid %s is" % Res
+      sys.exit(1)
 
 # UID
 uidNumber = GetFreeID(l)
@@ -83,6 +86,7 @@ print "   GECOS Field: \"%s,,,,\"" % cn
 print "   Login Shell: /bin/false"
 Res = raw_input("Continue [No/yes]? ")
 if Res != "yes":
+   print "Not adding %s" % cn
    sys.exit(1)
 
 # Submit the modification request
@@ -91,8 +95,7 @@ print "Updating LDAP directory..",
 sys.stdout.flush()
 
 Details = [("uid",account),
-           ("objectClass",
-            ("top","inetOrgPerson","debianAccount","shadowAccount","debianRoleAccount")),
+           ("objectClass", RoleObjectClasses),
            ("uidNumber",str(uidNumber)),
            ("gidNumber",str(gidNumber)),
            ("gecos",cn+",,,,"),