Let --with-group properly deal with secondary groups
authorFabian Keil <fk@fabiankeil.de>
Thu, 7 Nov 2013 15:11:32 +0000 (15:11 +0000)
committerFabian Keil <fk@fabiankeil.de>
Thu, 7 Nov 2013 15:11:32 +0000 (15:11 +0000)
Patch submitted by Anatoly Arzhnikov in #3615187.

configure.in

index df879e9..0b4de0a 100644 (file)
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script.
 dnl
-dnl $Id: configure.in,v 1.179 2013/03/01 17:40:18 fabiankeil Exp $
+dnl $Id: configure.in,v 1.180 2013/03/20 11:25:52 fabiankeil Exp $
 dnl
 dnl Written by and Copyright (C) 2001-2010 the
 dnl Privoxy team. http://www.privoxy.org/
@@ -32,7 +32,7 @@ dnl =================================================================
 dnl AutoConf Initialization
 dnl =================================================================
 
-AC_REVISION($Revision: 1.179 $)
+AC_REVISION($Revision: 1.180 $)
 AC_INIT(jcc.c)
 
 if test ! -f config.h.in; then
@@ -211,12 +211,14 @@ else
                     AC_MSG_RESULT($with_group)
                     $BGROUPS $USER >/dev/null
                     if test $? -eq 0 ; then
-                    # FIXME: this fails if valid group, but not first group
-                    # listed.
-                      if test "$with_group" != "`$BGROUPS $USER | sed 's/.*: //' 2>/dev/null |$AWK '{print $1}'`" ; then
+                      for i in `$BGROUPS $USER | sed 's/.*: //' 2>/dev/null`; do
+                        if test "x$i" = "x$with_group" ; then
+                          GROUP=$with_group
+                          break
+                        fi
+                      done
+                      if test "x$GROUP" != "x$with_group" ; then
                         AC_MSG_ERROR(The given value '$withval' does not match group entry)
-                      else
-                        GROUP=$with_group;
                       fi
                     else
                       AC_MSG_ERROR(There is no group entry for user '$USER')