# Copyright (c) 1999-2000 Jason Gunthorpe <jgg@debian.org>
# Copyright (c) 2001-2003 James Troup <troup@debian.org>
# Copyright (c) 2004-2005 Joey Schulze <joey@infodrom.org>
+# Copyright (c) 2007 Peter Palfrader <peter@palfrader.org>
#
# 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
# 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
# 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)
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
sys.stdout.flush()
Details = [("uid",account),
- ("objectClass",
- ("top","inetOrgPerson","debianAccount","shadowAccount","debianRoleAccount")),
+ ("objectClass", RoleObjectClasses),
("uidNumber",str(uidNumber)),
("gidNumber",str(gidNumber)),
("gecos",cn+",,,,"),