Changeset 110


Ignore:
Timestamp:
09/29/06 10:02:22 (16 years ago)
Author:
bas
Message:

EmailtoTracScript?:

run_email2trac.c:

  • We did not check if MTA user was a valid user. Fixed segmatation fault
  • Added check for the lengt of a username. If it is greater than 30, exit program
File:
1 edited

Legend:

Unmodified
Added
Removed
  • emailtotracscript/trunk/run_email2trac.c

    r35 r110  
    4141#endif
    4242
     43int check_username(char *name)
     44{
     45  if ( strlen(name) > 30 ) {
     46          if ( DEBUG ) printf("MTA_USERNAME is to large; %s\n", name);
     47          exit(-1);
     48  }
     49}
     50
    4351int main(int argc, char** argv) {
    4452
     
    8290 
    8391  /* Check caller */
    84  
     92
     93
     94  check_username(MTA_USER);
    8595  MTA = getpwnam(MTA_USER);
     96
     97  if ( MTA == NULL ) {
     98    if ( DEBUG ) printf("Invalid MTA user (%s)\n", MTA_USER);
     99    return -3;     /* 253 : MTA user not found */
     100  }
     101
    86102  if ( caller !=  MTA->pw_uid ) {
    87103    if ( DEBUG ) printf("Invalid caller UID (%d)\n",caller);
     
    91107 
    92108  /* set UID/GID to Trac (or apache) user */
     109  check_username(TRAC_USER);
    93110  if ( TRAC = getpwnam(TRAC_USER) ) {
    94111    setuid(TRAC->pw_uid);
Note: See TracChangeset for help on using the changeset viewer.