diff --git a/mkapachepw.py b/mkapachepw.py index 2c750cd..13d4c9c 100755 --- a/mkapachepw.py +++ b/mkapachepw.py @@ -9,7 +9,7 @@ # Program Information PROGNAME = "mkapachepw" -RCSID = "$Id: mkapachepw.py,v 1.113 2005/04/05 23:08:30 root Exp $" +RCSID = "$Id: mkapachepw.py,v 1.114 2005/04/06 05:59:54 root Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -71,8 +71,11 @@ # Literals ##### -TIMESTAMP = "# Created By %s %s On %s At %s\n" % (PROGNAME, VERSION, getfqdn(), time.asctime()) CMDLINE = "# Command Line: %s\n" % " ".join(sys.argv) +TIMESTAMP = "# Created By %s %s On %s At %s\n" % (PROGNAME, VERSION, getfqdn(), time.asctime()) + +GROUP = 'Group' +USER = 'User' #----------------------------------------------------------# @@ -113,6 +116,7 @@ # Global Variables & Data Structures # #----------------------------------------------------------# +enumerated = [] # Place to store command line in/exclude enumerations groups = {} # Place to store group information users = {} # Place to store user information @@ -160,8 +164,13 @@ # respectively. ##### -def ProcessEnumeratedList(items, master, lookup, name): +def ProcessEnumeratedList(items, lookup, name): + if name == GROUP: + master = groups + else: + master = users + for item in items.split(): orig = item @@ -211,7 +220,7 @@ else: del master[item] -# End of 'ProcessEnumeratedList(()' +# End of 'ProcessEnumeratedList()' ##### @@ -300,9 +309,9 @@ for opt, val in opts: if opt == "-G": - ProcessEnumeratedList(val, groups, grp.getgrgid, "Group") + enumerated.append([val, grp.getgrgid, GROUP]) if opt == "-U": - ProcessEnumeratedList(val, users, pwd.getpwuid, "User") + enumerated.append([val, pwd.getpwuid, USER]) if opt == "-g": try: STARTGID=int(val) @@ -337,6 +346,14 @@ sys.exit(1) ##### +# Process Any Enumerated Inclusions/Exclusions +##### + +for enum in enumerated: + ProcessEnumeratedList(*enum) + + +##### # Write Out The Files #####