Changeset 202 for trunk/run_email2trac.c


Ignore:
Timestamp:
05/27/08 22:43:52 (15 years ago)
Author:
bas
Message:

email2trac.py.in:

  • added set_ticket_fields function, #55
  • added option -t,--ticket_prefix, #55
  • removed obsolete code

run_email2trac.c:

  • added some patches from redhat
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/run_email2trac.c

    r130 r202  
    5555  int status;
    5656
    57   char   *trac_script;
    5857  char   **trac_script_args;
    5958  struct passwd *TRAC;
    6059  struct passwd *MTA;
    6160  struct stat script_attrs;
     61  const char *trac_script = TRAC_SCRIPT_PATH "/" TRAC_SCRIPT_NAME;
    6262 
    63   trac_script = malloc((strlen(TRAC_SCRIPT_PATH)
    64         + strlen(TRAC_SCRIPT_NAME) + 10) * sizeof(char));
    65 
    66   strncat(trac_script,TRAC_SCRIPT_PATH, strlen(TRAC_SCRIPT_PATH));
    67   strcat(trac_script,"/");
    68   strncat(trac_script,TRAC_SCRIPT_NAME, strlen(TRAC_SCRIPT_NAME));
    69 
    7063  /*
    7164  printf("trac_script = %s\n", trac_script);
     
    7467  /* First copy arguments passed to the wrapper as scripts arguments
    7568     after filtering out some of the possible script options */
     69
    7670  trac_script_args = (char**) malloc((argc+1)*sizeof(char*));
     71  if (trac_script_args == NULL) {
     72    if ( DEBUG ) printf("malloc failed\n");
     73    return 1;
     74  }
    7775  trac_script_args[0] = TRAC_SCRIPT_NAME;
    7876  for (i=j=1; i<argc; i++) {
     
    109107  check_username(TRAC_USER);
    110108  if ( TRAC = getpwnam(TRAC_USER) ) {
    111     setgid(TRAC->pw_gid);
    112     setuid(TRAC->pw_uid);
     109    if (setgid(TRAC->pw_gid) || setuid(TRAC->pw_uid)) {
     110      if ( DEBUG ) printf("setgid or setuid failed\n");
     111      return -5;
     112    }
    113113  } else {
    114114    if ( DEBUG ) printf("Invalid Trac user (%s)\n",TRAC_USER);
Note: See TracChangeset for help on using the changeset viewer.