Changeset 3 for server/common


Ignore:
Timestamp:
Sep 30, 2006, 5:15:09 PM (16 years ago)
Author:
jbarnold
Message:
Added missing bashrc file; added env cleaning
Location:
server/common/oursrc
Files:
1 added
1 edited

Legend:

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

    r1 r3  
    3030        }
    3131
     32#define NUMBUF 5
     33#define BUFLEN 128
     34        char buf[NUMBUF][BUFLEN];
     35        char *env[NUMBUF+1];
     36        int i = 0;
     37        snprintf(buf[i++], BUFLEN-1, "%s=%s", "HOME", "/home/sql");
     38        snprintf(buf[i++], BUFLEN-1, "%s=%s", "TERM", "xterm");
     39        snprintf(buf[i++], BUFLEN-1, "%s=%s", "USER", "sql");
     40        snprintf(buf[i++], BUFLEN-1, "%s=%s", "SHELL", "/usr/local/bin/bash");
     41        snprintf(buf[i++], BUFLEN-1, "%s=%s", "PATH", "/usr/kerberos/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin");
     42        for(i = 0; i < NUMBUF; i++) {
     43                env[i] = buf[i];
     44        }
     45        env[i] = NULL;
     46
    3247        char uid[21]; // 64-bit uid requires 21
    3348        char gid[21]; // 64-bit gid requires 21
     
    5671        }
    5772
    58         execv(SIGNUP_PATH, v);
     73        execle(SIGNUP_PATH, v, env);
    5974        return 1;
    6075}
Note: See TracChangeset for help on using the changeset viewer.