From: Fabian Keil <fk@fabiankeil.de>
Date: Thu, 24 Aug 2006 11:01:34 +0000 (+0000)
Subject: --user fix. Only use the user as group if no group is specified.
X-Git-Tag: v_3_0_5~146
X-Git-Url: http://www.privoxy.org/gitweb/%22https:/@default-cgi@/faq/man-page/static/gitweb.js?a=commitdiff_plain;h=d0b9d52ecf77e58eaa9e8e1d8a8724a938bbfd5a;p=privoxy.git

--user fix. Only use the user as group if no group is specified.
Solves BR 1492612. Thanks to Spinor S. and David Laight.
---

diff --git a/jcc.c b/jcc.c
index a977c238..da261fe8 100644
--- a/jcc.c
+++ b/jcc.c
@@ -1,4 +1,4 @@
-const char jcc_rcs[] = "$Id: jcc.c,v 1.96 2006/08/15 20:12:36 david__schmidt Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.97 2006/08/18 15:23:17 david__schmidt Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/jcc.c,v $
@@ -33,6 +33,27 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.96 2006/08/15 20:12:36 david__schmidt Exp
  *
  * Revisions   :
  *    $Log: jcc.c,v $
+ *    Revision 1.97  2006/08/18 15:23:17  david__schmidt
+ *    Windows service (re-)integration
+ *
+ *    The new args are:
+ *
+ *    --install[:service_name]
+ *    --uninstall[:service_name]
+ *    --service
+ *
+ *    They work as follows:
+ *    --install will create a service for you and then terminate.
+ *    By default the service name will be "privoxy" (without the quotes).
+ *    However you can run multiple services if you wish, just by adding
+ *    a colon and then a name (no spaces).
+ *
+ *    --uninstall follows the exact same rules a --install.
+ *
+ *    --service is used when the program is executed by the service
+ *    control manager, and in normal circumstances would never be
+ *    used as a command line argument.
+ *
  *    Revision 1.96  2006/08/15 20:12:36  david__schmidt
  *    Windows service integration
  *
@@ -2135,7 +2156,7 @@ int main(int argc, const char *argv[])
    
    if (NULL != pw)
    {
-      if (((NULL != grp) && setgid(grp->gr_gid)) || (setgid(pw->pw_gid)))
+      if (setgid((NULL != grp) ? grp->gr_gid : pw->pw_gid))
       {
          log_error(LOG_LEVEL_FATAL, "Cannot setgid(): Insufficient permissions.");
       }