diff options
| author | bwarsaw | 2002-08-23 20:24:37 +0000 |
|---|---|---|
| committer | bwarsaw | 2002-08-23 20:24:37 +0000 |
| commit | 16c4654daf53fc30c73432c2a782b5d55c5eba8b (patch) | |
| tree | 262f4baa8dbcf1c65a07b2bd2acffc9dd60ca445 /configure.in | |
| parent | 85f33db879b5e050618c0edab747728a7ed3388b (diff) | |
| download | mailman-16c4654daf53fc30c73432c2a782b5d55c5eba8b.tar.gz mailman-16c4654daf53fc30c73432c2a782b5d55c5eba8b.tar.zst mailman-16c4654daf53fc30c73432c2a782b5d55c5eba8b.zip | |
Patch set for SF bug #596565. Use symbolic user/group names instead
of numeric ids. Initial idea and patch by Todd Vierling, fleshed out
by Barry.
Specific changes here:
Move the --with-permcheck checking to earlier in the file, because
this switch is now also going to control whether user/group name
verification will be skipped.
MM_FIND_GROUP_ID -> MM_FIND_GROUP_NAME. Also remove the AC_MSG_RESULT
from the macro, and make the code body return the group name instead
of the id.
MM_FIND_USER_ID -> MM_FIND_USER_NAME, and similar changes.
MAILMAN_UID -> MAILMAN_USER
MAILMAN_GID -> MAILMAN_GROUP
Also, rewrote a bunch of the error messages for clarity.
Removed the long commented out ALIAS_UID/ALIAS_GID crud.
Note that --with-mail-gid and --with-cgi-gid are retained, even though
they now control the group name being used.
Diffstat (limited to 'configure.in')
| -rw-r--r-- | configure.in | 261 |
1 files changed, 136 insertions, 125 deletions
diff --git a/configure.in b/configure.in index 608de59ce..18d8b887b 100644 --- a/configure.in +++ b/configure.in @@ -4,18 +4,18 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software +# along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. dnl Process this file with autoconf to produce a configure script. -AC_REVISION($Revision: 5514 $) +AC_REVISION($Revision: 5540 $) AC_PREREQ(2.0) AC_INIT(src/common.h) @@ -27,16 +27,16 @@ AC_PREFIX_DEFAULT(/usr/local/mailman) # Check for Python! Better be found on $PATH AC_MSG_CHECKING(for --with-python) AC_ARG_WITH(python, dnl -[ --with-python specify path to Python interpreter]) +[ --with-python specify path to Python interpreter]) case "$with_python" in - "") ans="no";; + "") ans="no";; *) ans="$with_python" esac AC_MSG_RESULT($ans) if test -z "$with_python" then - AC_PATH_PROG(with_python, python, /usr/local/bin/python) + AC_PATH_PROG(with_python, python, /usr/local/bin/python) fi AC_MSG_CHECKING(Python interpreter) @@ -90,15 +90,15 @@ AC_PATH_PROG(TRUE, true, true, $PATH:/bin:/usr/bin) # Find compiler, allow alternatives to gcc AC_MSG_CHECKING(for --without-gcc) -AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [ - case $withval in - no) CC=cc - without_gcc=yes;; - yes) CC=gcc - without_gcc=no;; - *) CC=$withval - without_gcc=$withval;; - esac], without_gcc=no;) +AC_ARG_WITH(gcc, [ --without-gcc never use gcc], [ + case $withval in + no) CC=cc + without_gcc=yes;; + yes) CC=gcc + without_gcc=no;; + *) CC=$withval + without_gcc=$withval;; + esac], without_gcc=no;) AC_MSG_RESULT($without_gcc) # If the user switches compilers, we can't believe the cache @@ -115,15 +115,15 @@ AC_PROG_CC AC_SUBST(OPT) if test -z "$OPT" then - case $GCC in - yes) - case $ac_cv_prog_cc_g in - yes) OPT="-g -O2";; - *) OPT="-O2";; - esac - ;; - *) OPT="-O";; - esac + case $GCC in + yes) + case $ac_cv_prog_cc_g in + yes) OPT="-g -O2";; + *) OPT="-O2";; + esac + ;; + *) OPT="-O";; + esac fi # We better be able to execute interpreters @@ -144,14 +144,33 @@ AC_MSG_CHECKING(for --with-var-prefix) AC_ARG_WITH(var-prefix, dnl [ --with-var-prefix directory for mutable data [/var/mailman]]) case "$with_var_prefix" in - yes) VAR_PREFIX="$default_var_prefix"; ans=$VAR_PREFIX;; - ""|no) VAR_PREFIX="$prefix"; ans="no";; - *) VAR_PREFIX="$with_var_prefix"; ans=$VAR_PREFIX; + yes) VAR_PREFIX="$default_var_prefix"; ans=$VAR_PREFIX;; + ""|no) VAR_PREFIX="$prefix"; ans="no";; + *) VAR_PREFIX="$with_var_prefix"; ans=$VAR_PREFIX; esac AC_MSG_RESULT($ans) -# new macro for finding GIDs -AC_DEFUN(MM_FIND_GROUP_ID, [ +AC_MSG_CHECKING(for --with-permcheck) +AC_ARG_WITH(permcheck, dnl +[ --without-permcheck skip the check for target directory permissions]) +if test -z "$with_permcheck" +then + with_permcheck="yes" +fi +AC_MSG_RESULT($with_permcheck) +# Now make sure that $prefix is set up correctly. It must be group +# owned by the target group, it must have the group sticky bit set, and +# it must be a+rx +if test "$VAR_PREFIX" = "NONE" +then + VAR_PREFIX=$ac_default_prefix + prefixcheck=$ac_default_prefix +else + prefixcheck=$VAR_PREFIX +fi + +# new macro for finding group names +AC_DEFUN(MM_FIND_GROUP_NAME, [ # $1 == variable name # $2 == user id to check for AC_SUBST($1) @@ -164,27 +183,26 @@ gid = '' for group in "$2".split(): try: try: - gid = grp.getgrgid(int(group))[2] + gname = grp.getgrgid(int(group))[0] break except ValueError: - gid = grp.getgrnam(group)[2] + gname = grp.getgrnam(group)[0] break except KeyError: - gid = '' + gname = '' fp = open("conftest.out", "w") -fp.write("%s\n" % gid) +fp.write("%s\n" % gname) fp.close() EOF $PYTHON conftest.py $1=`cat conftest.out` fi changequote([, ]) -AC_MSG_RESULT($$1) rm -f conftest.out conftest.py]) # new macro for finding UIDs -AC_DEFUN(MM_FIND_USER_ID, [ +AC_DEFUN(MM_FIND_USER_NAME, [ # $1 == variable name # $2 == user id to check for AC_SUBST($1) @@ -197,96 +215,84 @@ uid = '' for user in "$2".split(): try: try: - uid = pwd.getpwuid(int(user))[2] + uname = pwd.getpwuid(int(user))[0] break - except ValueError: - uid = pwd.getpwnam(user)[2] + except ValueError: + uname = pwd.getpwnam(user)[0] break except KeyError: - uid = '' + uname = '' fp = open("conftest.out", "w") -fp.write("%s\n" % uid) +fp.write("%s\n" % uname) fp.close() EOF $PYTHON conftest.py $1=`cat conftest.out` fi changequote([, ]) -AC_MSG_RESULT($$1) rm -f conftest.out conftest.py]) # Check for some other uid to use than `mailman' AC_MSG_CHECKING(for --with-username) AC_ARG_WITH(username, dnl -[ --with-username specify a user name other than \"mailman\"]) +[ --with-username specify a user name other than \"mailman\"]) if test -z "$with_username" then - with_username="mailman" + with_username="mailman" fi USERNAME=$with_username AC_MSG_RESULT($USERNAME) # User `mailman' must exist -AC_SUBST(MAILMAN_UID) -AC_MSG_CHECKING(for $USERNAME UID) -MM_FIND_USER_ID(MAILMAN_UID, $USERNAME) -if test -z "$MAILMAN_UID" +AC_SUBST(MAILMAN_USER) +AC_MSG_CHECKING(for user name \"$USERNAME\") +MM_FIND_USER_NAME(MAILMAN_USER, $USERNAME) +if test -z "$MAILMAN_USER" then + if test "$with_permcheck" = "yes" + then AC_MSG_ERROR([ ***** No \"$USERNAME\" user found! ***** Your system must have a \"$USERNAME\" user defined ***** (usually in your /etc/passwd file). Please see the INSTALL ***** file for details.]) + fi fi +AC_MSG_RESULT(okay) # Check for some other gid to use than `mailman' AC_MSG_CHECKING(for --with-groupname) AC_ARG_WITH(groupname, dnl -[ --with-groupname specify a group name other than \"mailman\"]) +[ --with-groupname specify a group name other than \"mailman\"]) if test -z "$with_groupname" then - with_groupname="mailman" + with_groupname="mailman" fi GROUPNAME=$with_groupname AC_MSG_RESULT($GROUPNAME) # Target group must exist -AC_SUBST(MAILMAN_GID) -AC_MSG_CHECKING(for $GROUPNAME GID) -MM_FIND_GROUP_ID(MAILMAN_GID, $GROUPNAME) -if test -z "$MAILMAN_GID" +AC_SUBST(MAILMAN_GROUP) +AC_MSG_CHECKING(for group name \"$GROUPNAME\") +MM_FIND_GROUP_NAME(MAILMAN_GROUP, $GROUPNAME) +if test -z "$MAILMAN_GROUP" then + if test "$with_permcheck" = "yes" + then AC_MSG_ERROR([ ***** No \"$GROUPNAME\" group found! ***** Your system must have a \"$GROUPNAME\" group defined ***** (usually in your /etc/group file). Please see the INSTALL ***** file for details.]) + fi fi +AC_MSG_RESULT(okay) -AC_MSG_CHECKING(for --with-permcheck) -AC_ARG_WITH(permcheck, dnl -[ --without-permcheck skip the check for target directory permissions]) -if test -z "$with_permcheck" -then - with_permcheck="yes" -fi -AC_MSG_RESULT($with_permcheck) -# Now make sure that $prefix is set up correctly. It must be group -# owned by the target group, it must have the group sticky bit set, and -# it must be a+rx -if test "$VAR_PREFIX" = "NONE" -then - VAR_PREFIX=$ac_default_prefix - prefixcheck=$ac_default_prefix -else - prefixcheck=$VAR_PREFIX -fi - AC_MSG_CHECKING(permissions on $prefixcheck) changequote(,) cat > conftest.py <<EOF @@ -294,12 +300,13 @@ import os, grp from stat import * prefix = "$prefixcheck" groupname = "$GROUPNAME" -mailmangid = $MAILMAN_GID +mailmangroup = "$MAILMAN_GROUP" +mailmangid = grp.getgrnam(mailmangroup)[2] problems = [] try: statdata = os.stat(prefix) except OSError: problems.append("Directory doesn't exist: " + prefix) -else: +else: mode = statdata[ST_MODE] gid = statdata[ST_GID] if mailmangid <> gid: @@ -338,66 +345,70 @@ AC_MSG_RESULT($status) # Now find the UIDs and GIDs # Support --with-mail-gid and --with-cgi-gid -AC_MSG_CHECKING(for mail wrapper GID; i.e. --with-mail-gid) +AC_MSG_CHECKING(for mail wrapper group; i.e. --with-mail-gid) AC_ARG_WITH(mail-gid, dnl -[ --with-mail-gid specify GID mail programs run as]) +[ --with-mail-gid group name mail programs run as]) if test -z "$with_mail_gid" then - AC_CACHE_VAL(ac_cv_group_mail, [dnl - ac_cv_group_mail="mailman other mail daemon"]) -else - ac_cv_group_mail=$with_mail_gid + with_mail_gid="mailman other mail daemon" fi -MM_FIND_GROUP_ID(MAIL_GID, $ac_cv_group_mail) -if test -z "$MAIL_GID" +MM_FIND_GROUP_NAME(MAIL_GROUP, $with_mail_gid) +if test -z "$MAIL_GROUP" then + if test "$with_permcheck" = "yes" + then AC_MSG_ERROR([ -***** No existing group found for the mail_wrapper program. -***** This is the group that your mail delivery agent runs under, and -***** uses to run filter programs. You might want to specify an -***** existing group with the --with-mail-gid configure option. -***** Please see your mail agent's documentation, and the INSTALL file -***** for details]) +***** No group name \"$with_mail_gid\" found for the mail wrapper program. +***** This is the group that your mail server will use to run Mailman's +***** programs. You should specify an existing group with the +***** --with-mail-gid configure option, or use --without-permcheck to +***** skip this verification step. See also your mail server's documentation, +***** and Mailman's INSTALL file for details]) + else + MAIL_GROUP=$with_mail_gid + fi fi +AC_MSG_RESULT($MAIL_GROUP) -AC_MSG_CHECKING(for CGI wrapper GID; i.e. --with-cgi-gid) +AC_MSG_CHECKING(for CGI wrapper group; i.e. --with-cgi-gid) AC_ARG_WITH(cgi-gid, dnl -[ --with-cgi-gid specify GID CGI programs run as]) +[ --with-cgi-gid group name CGI programs run as]) if test -z "$with_cgi_gid" then - AC_CACHE_VAL(ac_cv_group_cgi, [dnl - ac_cv_group_cgi="www www-data nobody"]) -else - ac_cv_group_cgi=$with_cgi_gid + with_cgi_gid="www www-data nobody" fi -MM_FIND_GROUP_ID(CGI_GID, $ac_cv_group_cgi) -if test -z "$CGI_GID" +MM_FIND_GROUP_NAME(CGI_GROUP, $with_cgi_gid) +if test -z "$CGI_GROUP" then + if test "$with_permcheck" = "yes" + then AC_MSG_ERROR([ -***** No existing group found for the cgi_wrapper program. -***** This is the group that your Web server runs CGI scripts under. -***** You might want to specify an existing group with the -***** --with-cgi-gid configure option. Please see your Web server's -***** documentation, and the INSTALL file for details]) +***** No group name \"$with_cgi_gid\" found for the CGI wrapper program. +***** This is the group that your web server will use to run Mailman's +***** programs. You should specify an existing group with the +***** --with-cgi-gid configure option, or use --without-permcheck to +***** skip this verification step. See also your web server's documentation, +***** and Mailman's INSTALL file for details]) + else + CGI_GROUP=$with_cgi_gid + fi fi +AC_MSG_RESULT($CGI_GROUP) -#MM_FIND_USER_ID(ALIAS_UID, mailman, alias_wrapper) -#MM_FIND_GROUP_ID(ALIAS_GID, mail, alias_wrapper) - # Check for CGI extensions, required by some Web servers AC_SUBST(CGIEXT) AC_MSG_CHECKING(for CGI extensions) AC_ARG_WITH(cgi-ext, dnl -[ --with-cgi-ext specify extension for CGI programs (include dot)]) +[ --with-cgi-ext specify extension for CGI programs (include dot)]) if test -z "$with_cgi_ext" then - CGIEXT='' - with_cgi_ext='no' + CGIEXT='' + with_cgi_ext='no' else - CGIEXT=$with_cgi_ext + CGIEXT=$with_cgi_ext fi AC_MSG_RESULT($with_cgi_ext) @@ -406,26 +417,26 @@ AC_MSG_RESULT($with_cgi_ext) AC_SUBST(MAILHOST) AC_MSG_CHECKING(for --with-mailhost) AC_ARG_WITH(mailhost, dnl -[ --with-mailhost specify the hostname part for outgoing email]) +[ --with-mailhost specify the hostname part for outgoing email]) if test -z "$with_mailhost" then - MAILHOST='' - with_mailhost='no' + MAILHOST='' + with_mailhost='no' else - MAILHOST=$with_mailhost + MAILHOST=$with_mailhost fi AC_MSG_RESULT($with_mailhost) AC_SUBST(URLHOST) AC_MSG_CHECKING(for --with-urlhost) AC_ARG_WITH(urlhost, dnl -[ --with-urlhost specify the hostname part of urls]) +[ --with-urlhost specify the hostname part of urls]) if test -z "$with_urlhost" then - URLHOST='' - with_urlhost='no' + URLHOST='' + with_urlhost='no' else - URLHOST=$with_urlhost + URLHOST=$with_urlhost fi AC_MSG_RESULT($with_urlhost) @@ -554,14 +565,14 @@ mkdir -p build/bin build/contrib build/cron dnl Output everything AC_OUTPUT([misc/paths.py Mailman/Defaults.py Mailman/mm_cfg.py.dist src/Makefile misc/Makefile bin/Makefile - Mailman/Makefile Mailman/Cgi/Makefile Mailman/Logging/Makefile - Mailman/Archiver/Makefile Mailman/Commands/Makefile - Mailman/Handlers/Makefile Mailman/Bouncers/Makefile - Mailman/Queue/Makefile Mailman/MTA/Makefile Mailman/Gui/Makefile - templates/Makefile cron/Makefile scripts/Makefile messages/Makefile - cron/crontab.in misc/mailman Makefile - tests/Makefile tests/bounces/Makefile tests/msgs/Makefile - $SCRIPTS]) + Mailman/Makefile Mailman/Cgi/Makefile Mailman/Logging/Makefile + Mailman/Archiver/Makefile Mailman/Commands/Makefile + Mailman/Handlers/Makefile Mailman/Bouncers/Makefile + Mailman/Queue/Makefile Mailman/MTA/Makefile Mailman/Gui/Makefile + templates/Makefile cron/Makefile scripts/Makefile messages/Makefile + cron/crontab.in misc/mailman Makefile + tests/Makefile tests/bounces/Makefile tests/msgs/Makefile + $SCRIPTS]) # Make sure all the build scripts are executable. chmod -R +x build |
