| |
---|
| | |
---|
| | # Program Information |
---|
| | |
---|
| | PROGNAME = "mkapachepw" |
---|
| | RCSID = "$Id: mkapachepw.py,v 1.109 2005/04/05 20:26:32 root Exp $" |
---|
| | RCSID = "$Id: mkapachepw.py,v 1.110 2005/04/05 20:43:44 root Exp $" |
---|
| | VERSION = RCSID.split()[2] |
---|
| | |
---|
| | # Copyright Information |
---|
| | |
---|
| |
---|
| | uTable = [PROGNAME + " " + VERSION + " - %s\n" % COPYRIGHT, |
---|
| | "usage: " + PROGNAME + " [-GUfghuv] where,\n", |
---|
| | " -G list of groups to include (+group) or exclude (-group) (default: none)", |
---|
| | " -U list of users to include (+user) or exclude (-user) (default: none)", |
---|
| | " -f file configuration file to use (default: none)", |
---|
| | " -g # smallest GID to include in output (default: 100)", |
---|
| | " -h print this help information", |
---|
| | " -u # smallest UID to include in output (default: 100)", |
---|
| | " -v print detailed version information", |
---|
| |
---|
| | |
---|
| | #----------------------------------------------------------# |
---|
| | # Global Variables & Data Structures # |
---|
| | #----------------------------------------------------------# |
---|
| | |
---|
| | CFGFILE = "" # Default is no config file |
---|
| | |
---|
| | groups = {} # Place to store group information |
---|
| | users = {} # Place to store user information |
---|
| | |
---|
| |
---|
| | if envopt: |
---|
| | OPTIONS = envopt.split() + OPTIONS |
---|
| | |
---|
| | try: |
---|
| | opts, args = getopt.getopt(OPTIONS, '-G:U:f:g:hu:v') |
---|
| | opts, args = getopt.getopt(OPTIONS, '-G:U:g:hu:v') |
---|
| | except getopt.GetoptError: |
---|
| | Usage() |
---|
| | sys.exit(1) |
---|
| | |
---|
| |
---|
| | if opt == "-G": |
---|
| | ProcessEnumeratedList(val, groups, grp.getgrgid, "Group") |
---|
| | if opt == "-U": |
---|
| | ProcessEnumeratedList(val, users, pwd.getpwuid, "User") |
---|
| | if opt == "-f": |
---|
| | CFGFILE=val |
---|
| | if opt == "-g": |
---|
| | STARTGID=int(val) |
---|
| | try: |
---|
| | STARTGID=int(val) |
---|
| | except: |
---|
| | ErrorMsg("Invalid Starting GID, '%s' - Must Be An Integer Value." % val) |
---|
| | sys.exit(1) |
---|
| | if opt == "-h": |
---|
| | Usage() |
---|
| | sys.exit(0) |
---|
| | if opt == "-u": |
---|
| | STARTUID=int(val) |
---|
| | try: |
---|
| | STARTUID=int(val) |
---|
| | except: |
---|
| | ErrorMsg("Invalid Starting UID '%s' - Must Be An Integer Value." % val) |
---|
| | sys.exit(1) |
---|
| | if opt == "-v": |
---|
| | print RCSID |
---|
| | sys.exit(0) |
---|
| | |
---|
| |
---|
| | |