Ticket #274: email2trac-2.4.2.patch
File email2trac-2.4.2.patch, 1.3 KB (added by Dennis McRitchie <dmcr@…>, 13 years ago) |
---|
-
run_email2trac.c
old new 26 26 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 27 27 # 28 28 */ 29 #include <sys/types.h> 29 30 #include <stdlib.h> 30 31 #include <unistd.h> 31 32 #include <pwd.h> … … 33 34 #include <string.h> 34 35 #include <stdio.h> 35 36 #include <limits.h> 37 #include <grp.h> 36 38 37 39 #include "run_email2trac.h" 38 40 … … 106 108 return -2; /* 254 : Invalid caller */ 107 109 } 108 110 109 /* set UID/GID toTrac (or apache) user */111 /* set UID/GID and supplementary groups to be Trac (or apache) user */ 110 112 check_username(TRAC_USER); 111 113 if ( TRAC = getpwnam(TRAC_USER) ) { 114 if (initgroups(TRAC_USER, TRAC->pw_gid)) { 115 if ( DEBUG ) printf("initgroups failed\n"); 116 return -7; /* 249 : Can't set supplementary groups */ 117 } 112 118 if (setgid(TRAC->pw_gid) || setuid(TRAC->pw_uid)) { 113 119 if ( DEBUG ) printf("setgid or setuid failed\n"); 114 return -5; 120 return -5; /* 251: Can't set gid or uid */ 115 121 } 116 122 } else { 117 123 if ( DEBUG ) printf("Invalid Trac user (%s)\n",TRAC_USER); 118 return - 3; /* 253: Trac user not found */124 return -6; /* 250 : Trac user not found */ 119 125 } 120 126 121 127 /* Check that script exists */