X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=jcc.c;h=76a491be7ee26f65d23efe456d0caed2bae093c0;hp=c7be81bb97678d6f77bfe59beaca3235ea09c4c8;hb=d08efb68329798242aa848d30b50fc58254b1aaf;hpb=03a212cd9ff953a50904e7a970748b5661840426 diff --git a/jcc.c b/jcc.c index c7be81bb..76a491be 100644 --- a/jcc.c +++ b/jcc.c @@ -1,4 +1,4 @@ -const char jcc_rcs[] = "$Id: jcc.c,v 1.218 2009/01/31 12:25:54 fabiankeil Exp $"; +const char jcc_rcs[] = "$Id: jcc.c,v 1.220 2009/02/04 18:29:07 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jcc.c,v $ @@ -33,6 +33,13 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.218 2009/01/31 12:25:54 fabiankeil Exp $" * * Revisions : * $Log: jcc.c,v $ + * Revision 1.220 2009/02/04 18:29:07 fabiankeil + * Initialize the log module before parsing arguments. + * Thanks to Matthias Drochner for the report. + * + * Revision 1.219 2009/01/31 16:08:21 fabiankeil + * Remove redundant error check in receive_client_request(). + * * Revision 1.218 2009/01/31 12:25:54 fabiankeil * Flatten indentation in receive_client_request(). * @@ -3564,6 +3571,9 @@ int main(int argc, const char *argv[]) #endif ; + /* Enable logging until further notice. */ + init_log_module(Argv[0]); + /* * Parse the command line arguments * @@ -3720,9 +3730,6 @@ int main(int argc, const char *argv[]) /* Prepare mutexes if supported and necessary. */ initialize_mutexes(); - /* Enable logging until further notice. */ - init_log_module(Argv[0]); - random_seed = (unsigned int)time(NULL); #ifdef HAVE_RANDOM srandom(random_seed); @@ -3856,6 +3863,17 @@ int main(int argc, const char *argv[]) { log_error(LOG_LEVEL_FATAL, "Cannot setgid(): Insufficient permissions."); } + if (NULL != grp) + { + if (setgroups(1, &grp->gr_gid)) + { + log_error(LOG_LEVEL_FATAL, "setgroups() failed: %E"); + } + } + else if (initgroups(pw->pw_name, pw->pw_gid)) + { + log_error(LOG_LEVEL_FATAL, "initgroups() failed: %E"); + } if (do_chroot) { if (!pw->pw_dir)