Changeset 4


Ignore:
Timestamp:
Sep 30, 2006, 5:24:00 PM (16 years ago)
Author:
jbarnold
Message:
fixed execle argument handling
File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/common/oursrc/sqladm/signup-sql.c

    r3 r4  
    4545        env[i] = NULL;
    4646
    47         char uid[21]; // 64-bit uid requires 21
    48         char gid[21]; // 64-bit gid requires 21
    49         int retval = snprintf(uid, 21, "%d", getuid());
     47        char uid_str[21]; // 64-bit uid requires 21
     48        char gid_str[21]; // 64-bit gid requires 21
     49        int uid_num = getuid();
     50        int retval = snprintf(uid_str, 21, "%d", uid_num);
    5051        if(retval < 0 || retval >= 21) {
    5152                exit(1);
    5253        }
    53         retval = snprintf(gid, 21, "%d", getgid());
     54        retval = snprintf(gid_str, 21, "%d", getgid());
    5455        if(retval < 0 || retval >= 21) {
    5556                exit(1);
    5657        }
    57 
    58         char *v[5];
    59 #define SIGNUP_PATH "/afs/athena.mit.edu/contrib/sql/web_scripts/main/batch/signup.php"
    60         v[0] = SIGNUP_PATH;
    61         v[1] = getpwuid(getuid())->pw_name;
    62         v[2] = uid;
    63         v[3] = gid;
    64         v[4] = NULL;
    6558
    6659        if(setregid(SQL_GID, SQL_GID) != 0) {
     
    7164        }
    7265
    73         execle(SIGNUP_PATH, v, env);
     66#define SIGNUP_PATH "/afs/athena.mit.edu/contrib/sql/web_scripts/main/batch/signup.php"
     67        execle(SIGNUP_PATH, SIGNUP_PATH, getpwuid(uid_num)->pw_name, uid_str, gid_str, NULL, env);
    7468        return 1;
    7569}
Note: See TracChangeset for help on using the changeset viewer.