source: trunk/server/common/oursrc/sql-signup/sql-signup-sbin @ 1463

Last change on this file since 1463 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
3from pwd import getpwuid
4from os import getenv, setuid, setgid, execv
5from sys import exit
6
7SQLUID = 537704221
8SQLGID = 537704221
9SQLBIN = '/afs/athena.mit.edu/contrib/sql/web_scripts/main/batch/signup.php'
10
11caller = int(getenv('USERHELPER_UID'))
12if caller is None or caller == 0:
13        exit('No user specified.')
14else:
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.