X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=ud-roleadd;h=3332b6dd3b6fd6c9dca00d299511933a6bd5afe6;hb=877570fc9e292e0c9df0bd5581f4bd9e14f2d6f9;hp=08f28ac4564215b8c6a9e7151e2313cc314c7d8f;hpb=87683e24b12b5171f9e0f4f814f63f76848a341d;p=mirror%2Fuserdir-ldap.git diff --git a/ud-roleadd b/ud-roleadd index 08f28ac..3332b6d 100755 --- a/ud-roleadd +++ b/ud-roleadd @@ -4,6 +4,7 @@ # Copyright (c) 1999-2000 Jason Gunthorpe # Copyright (c) 2001-2003 James Troup # Copyright (c) 2004-2005 Joey Schulze +# Copyright (c) 2007,2008 Peter Palfrader # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,7 +20,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 @@ -49,7 +50,7 @@ for (switch, val) in options: if (switch == '-u'): AdminUser = val -l = passwdAccessLDAP(LDAPServer, BaseDn, AdminUser) +l = passwdAccessLDAP(BaseDn, AdminUser) while 1: account = raw_input("Who are you going to add? ") @@ -69,7 +70,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 +87,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 +96,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+",,,,"),