Last change
on this file since 512 was
119,
checked in by presbrey, 18 years ago
|
packaged sql-signup utility
|
-
Property svn:executable set to
*
|
File size:
601 bytes
|
Line | |
---|
1 | #!/usr/bin/python |
---|
2 | |
---|
3 | from pwd import getpwuid |
---|
4 | from os import getenv, setuid, setgid, execv |
---|
5 | from sys import exit |
---|
6 | |
---|
7 | SQLUID = 537704221 |
---|
8 | SQLGID = 537704221 |
---|
9 | SQLBIN = '/afs/athena.mit.edu/contrib/sql/web_scripts/main/batch/signup.php' |
---|
10 | |
---|
11 | caller = int(getenv('USERHELPER_UID')) |
---|
12 | if caller is None or caller == 0: |
---|
13 | exit('No user specified.') |
---|
14 | else: |
---|
15 | pw = getpwuid(caller) |
---|
16 | (user_name, user_uid, user_gid) = (pw[0], pw[2], pw[3]) |
---|
17 | |
---|
18 | if len(user_name) and user_uid > 1000: |
---|
19 | setgid(SQLGID) |
---|
20 | setuid(SQLUID) |
---|
21 | execv(SQLBIN, [SQLBIN, str(user_name), str(user_uid), str(user_gid)]) |
---|
22 | else: |
---|
23 | print 'Invalid UID:', user_uid |
---|
Note: See
TracBrowser
for help on using the repository browser.