From: hal9 Date: Thu, 26 Sep 2002 18:47:46 +0000 (+0000) Subject: This is most of Al's patch for --with-user and --with-group which tests that X-Git-Tag: v_3_1_archive_branchpoint~110 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=e6e3ba12e69e3a022fc24b0d71a3df32e0a90b85 This is most of Al's patch for --with-user and --with-group which tests that these are valid values, if specified. If not specified, they are left empty. --- diff --git a/configure.in b/configure.in index 8da35efd..ba95b324 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. dnl -dnl $Id: configure.in,v 1.78 2002/09/06 23:18:08 hal9 Exp $ +dnl $Id: configure.in,v 1.79 2002/09/07 02:11:06 hal9 Exp $ dnl dnl Written by and Copyright (C) 2001, 2002 the SourceForge dnl Privoxy team. http://www.privoxy.org/ @@ -28,6 +28,9 @@ dnl or write to the Free Software Foundation, Inc., 59 dnl Temple Place - Suite 330, Boston, MA 02111-1307, USA. dnl dnl $Log: configure.in,v $ +dnl Revision 1.79 2002/09/07 02:11:06 hal9 +dnl Remove some testing stuff inadvertantly left in. +dnl dnl Revision 1.78 2002/09/06 23:18:08 hal9 dnl Migrate PCRE_H_IN_SUBDIR from 3.0 branch for pcre/pcre.h on RH, etc. dnl @@ -410,7 +413,7 @@ dnl ================================================================= dnl AutoConf Initialization dnl ================================================================= -AC_REVISION($Revision: 1.78 $) +AC_REVISION($Revision: 1.79 $) AC_INIT(src/jcc.c) if test ! -f src/config.h.in; then @@ -474,8 +477,13 @@ AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET +AC_PROG_AWK AC_CHECK_PROG(GDB,gdb,yes,no) +AC_PATH_PROG(BGROUPS,groups,no,/bin:/usr/bin:/usr/local/bin) +AC_PATH_PROG(ID,id,no,/bin:/usr/bin:/usr/local/bin) +AC_SUBST(ID) +AC_SUBST(BGROUPS) dnl ================================================================= dnl debug, gcc and gdb support @@ -511,16 +519,35 @@ AC_ARG_WITH(debug, ) AC_ARG_WITH(user, - [ --with-user=privoxy Set user under which privoxy run], + [ --with-user=privoxy Set user under which privoxy will run], [ if test "x$withval" != "xyes"; then - USER=$with_user; + if test $ID = no ; then + AC_MSG_ERROR(There is no 'id' program on this system) + else + $ID $with_user 2>/dev/null >/dev/null + if test $? -eq 0 ; then + USER=$with_user; + else + AC_MSG_ERROR(There is no user '$with_user' on this system) + fi + fi else AC_MSG_ERROR(We need a user if you give me this parameter) fi ], [ - USER=privoxy; + if test $ID = no ; then + AC_MSG_ERROR(There is no 'id' programm on this system) + else + $ID privoxy >/dev/null + if test $? -eq 0 ; then + USER=privoxy; + else + AC_MSG_WARN(There is no user 'privoxy' on this system) + USER=$with_user + fi + fi ] ) AC_SUBST(USER) @@ -529,13 +556,41 @@ AC_ARG_WITH(group, [ --with-group=privoxy Set group for privoxy], [ if test "x$withval" != "xyes"; then - GROUP=$with_group; + if test $BGROUPS = no ; then + AC_MSG_ERROR(There is no 'groups' program on this system) else + $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 2>/dev/null |$AWK '{print $3}'`" ; 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') + fi + fi + else AC_MSG_ERROR(We need a group if you give me this parameter) fi ], [ - GROUP=privoxy; + if test $BGROUPS = no ; then + AC_MSG_ERROR(There is no 'groups' programm on this system) + else + $BGROUPS $USER >/dev/null + if test $? -eq 0 ; then + if test "$with_group" != "`$BGROUPS $USER 2>/dev/null |$AWK '{print $3}'`" -a "$with_group" != "" ; then + AC_MSG_ERROR('$USER' isn't a member of '$with_group' group) + else + GROUP=$with_group; + fi + else + AC_MSG_ERROR(There is no group entry for user '$USER') + fi + fi ] ) AC_SUBST(GROUP)