httpd-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@locus.apache.org
Subject cvs commit: apache-2.0/src/lib/apr/include apr_user.h apr.h.in apr.hw
Date Mon, 13 Nov 2000 03:18:19 GMT
trawick     00/11/12 19:18:19

  Modified:    src      CHANGES
               src/modules/standard config.m4 mod_userdir.c
               src/lib/apr configure.in
               src/lib/apr/include apr.h.in apr.hw
  Added:       src/lib/apr/user/unix .cvsignore homedir.c Makefile.in
               src/lib/apr/include apr_user.h
  Log:
  add apr_get_home_directory(), teach mod_userdir to use that
  instead of calling getpwnam[_r] directly, back out mod_userdir's
  config check for getpwnam_r
  
  Revision  Changes    Path
  1.319     +2 -0      apache-2.0/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/CHANGES,v
  retrieving revision 1.318
  retrieving revision 1.319
  diff -u -r1.318 -r1.319
  --- CHANGES	2000/11/11 06:05:57	1.318
  +++ CHANGES	2000/11/13 03:18:18	1.319
  @@ -1,4 +1,6 @@
   Changes with Apache 2.0a8
  +  *) APR: add apr_get_home_directory()  [Jeff Trawick]
  +
     *) Not all platforms have INADDR_NONE defined by default.  Apache
        used to make this check and define INADDR_NONE if appropriate,
        but APR needs the check too, and I suspect other applications will
  
  
  
  1.32      +1 -3      apache-2.0/src/modules/standard/config.m4
  
  Index: config.m4
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/config.m4,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- config.m4	2000/11/10 23:52:18	1.31
  +++ config.m4	2000/11/13 03:18:18	1.32
  @@ -25,9 +25,7 @@
   APACHE_CHECK_STANDARD_MODULE(imap, internal imagemaps, , yes)
   APACHE_CHECK_STANDARD_MODULE(actions, Action triggering on requests, action, yes)
   APACHE_CHECK_STANDARD_MODULE(speling, correct common URL misspellings, , no)
  -APACHE_CHECK_STANDARD_MODULE(userdir, mapping of user requests, , yes, [
  -  AC_CHECK_FUNCS(getpwnam_r)
  -])
  +APACHE_CHECK_STANDARD_MODULE(userdir, mapping of user requests, , yes)
   APACHE_CHECK_STANDARD_MODULE(suexec, set uid and gid for spawned processes, , no)
   APACHE_CHECK_STANDARD_MODULE(alias, translation of requests, , yes)
   
  
  
  
  1.27      +13 -21    apache-2.0/src/modules/standard/mod_userdir.c
  
  Index: mod_userdir.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_userdir.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- mod_userdir.c	2000/11/10 23:52:18	1.26
  +++ mod_userdir.c	2000/11/13 03:18:18	1.27
  @@ -96,6 +96,7 @@
   #endif
   
   #include "apr_strings.h"
  +#include "apr_user.h"
   #include "ap_config.h"
   #include "httpd.h"
   #include "http_config.h"
  @@ -103,9 +104,6 @@
   #ifdef HAVE_UNIX_SUEXEC
   #include "unixd.h"        /* Contains the suexec_identity hook used on Unix */
   #endif
  -#ifdef HAVE_PWD_H
  -#include <pwd.h>
  -#endif
   #ifdef HAVE_UNISTD_H
   #include <unistd.h>
   #endif
  @@ -320,29 +318,23 @@
               return HTTP_MOVED_TEMPORARILY;
           }
           else {
  -#ifdef WIN32
  -            /* Need to figure out home dirs on NT */
  -            return DECLINED;
  -#else                           /* WIN32 */
  -            struct passwd *pw;
  -
  -#if APR_HAS_THREADS && defined(HAVE_GETPWNAM_R)
  -            struct passwd pwd;
  -            size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
  -            char *buf = apr_pcalloc(r->pool, buflen);
  +#if APR_HAS_USER
  +            char *homedir;
   
  -            if (!getpwnam_r(w, &pwd, buf, buflen, &pw)) {
  -#else
  -            if ((pw = getpwnam(w))) {
  -#endif
  -#ifdef OS2
  +            if (apr_get_home_directory(&homedir, w, r->pool) == APR_SUCCESS) {
  +#ifdef OS2      /* XXX should this OS/2 logic move to APR? */
                   /* Need to manually add user name for OS/2 */
  -                filename = apr_pstrcat(r->pool, pw->pw_dir, w, "/", userdir, NULL);
  +                filename = apr_pstrcat(r->pool, homedir, w, "/", userdir, NULL);
   #else
  -                filename = apr_pstrcat(r->pool, pw->pw_dir, "/", userdir, NULL);
  +                filename = apr_pstrcat(r->pool, homedir, "/", userdir, NULL);
   #endif
               }
  -#endif                          /* WIN32 */
  +            else {
  +                /* XXX old code ignored this error... */
  +            }
  +#else
  +            return DECLINED;
  +#endif
           }
   
           /*
  
  
  
  1.172     +2 -1      apache-2.0/src/lib/apr/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/configure.in,v
  retrieving revision 1.171
  retrieving revision 1.172
  diff -u -r1.171 -r1.172
  --- configure.in	2000/11/12 14:46:11	1.171
  +++ configure.in	2000/11/13 03:18:18	1.172
  @@ -35,7 +35,7 @@
   # These added to allow default directories to be used...
   DEFAULT_OSDIR="unix"
   echo "(Default will be ${DEFAULT_OSDIR})"
  -MODULES="file_io network_io threadproc misc locks time mmap shmem i18n"
  +MODULES="file_io network_io threadproc misc locks time mmap shmem i18n user"
   
   # Most platforms use a prefix of 'lib' on their library files.
   LIBPREFIX='lib'
  @@ -268,6 +268,7 @@
   AC_CHECK_HEADERS(netdb.h)
   AC_CHECK_HEADERS(osreldate.h)
   AC_CHECK_HEADERS(process.h)
  +AC_CHECK_HEADERS(pwd.h)
   AC_CHECK_HEADERS(sys/sem.h)
   AC_CHECK_HEADERS(signal.h, signalh="1", signalh="0")
   AC_CHECK_HEADERS(stdarg.h, stdargh="1", stdargh="0")
  
  
  
  1.1                  apache-2.0/src/lib/apr/user/unix/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  Makefile
  
  
  
  1.1                  apache-2.0/src/lib/apr/user/unix/homedir.c
  
  Index: homedir.c
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #include "apr_strings.h"
  #include "apr_portable.h"
  #include "apr_user.h"
  #include "apr_private.h"
  #ifdef HAVE_PWD_H
  #include <pwd.h>
  #endif
  #if APR_HAVE_SYS_TYPES_H
  #include <sys/types.h>
  #endif
  
  apr_status_t apr_get_home_directory(char **dirname, const char *userid, apr_pool_t *p)
  {
      struct passwd *pw;
  #if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
      struct passwd pwd;
      char pwbuf[512];
  #endif
  
  #if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
      if (!getpwnam_r(userid, &pwd, pwbuf, sizeof(pwbuf), &pw)) {
  #else
      if ((pw = getpwnam(userid)) != NULL) {
  #endif
          *dirname = apr_pstrdup(p, pw->pw_dir);
      }
      else {
          return errno;
      }
      return APR_SUCCESS;
  }
    
  
  
  
  1.1                  apache-2.0/src/lib/apr/user/unix/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  
  RM=@RM@
  CC=@CC@
  RANLIB=@RANLIB@
  CFLAGS=@CFLAGS@ @OPTIM@
  LIBS=@LIBS@
  LDFLAGS=@LDFLAGS@ $(LIBS)
  INCDIR=../../include
  INCLUDES=-I$(INCDIR) -I$(INCDIR)/arch
  
  OBJS=homedir.o
  
  .c.o:
  	$(CC) $(CFLAGS) -c $(INCLUDES) $<
  
  all: $(OBJS)
  
  clean:
  	$(RM) -f *.o *.a *.so
  
  distclean: clean
  	-$(RM) -f Makefile
  
  
  #
  # We really don't expect end users to use this rule.  It works only with
  # gcc, and rebuilds Makefile.in.  You have to re-run configure after
  # using it.
  #
  depend:
  	cp Makefile.in Makefile.in.bak \
  	    && sed -ne '1,/^# DO NOT REMOVE/p' Makefile.in > Makefile.new \
  	    && gcc -MM $(INCLUDES) $(CFLAGS) *.c >> Makefile.new \
  	    && sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' \
  	           -e '1,$$s: $(OSDIR)/: $$(OSDIR)/:g' Makefile.new \
  		> Makefile.in \
  	    && rm Makefile.new
  
  # DO NOT REMOVE
  homedir.o: homedir.c $(INCDIR)/apr_strings.h $(INCDIR)/apr.h \
   $(INCDIR)/apr_lib.h $(INCDIR)/apr_pools.h \
   $(INCDIR)/apr_thread_proc.h $(INCDIR)/apr_file_io.h \
   $(INCDIR)/apr_general.h $(INCDIR)/apr_errno.h \
   $(INCDIR)/apr_time.h $(INCDIR)/apr_tables.h \
   $(INCDIR)/apr_portable.h $(INCDIR)/apr_network_io.h \
   $(INCDIR)/apr_lock.h $(INCDIR)/apr_dso.h \
   $(INCDIR)/apr_user.h $(INCDIR)/apr_private.h
  
  
  
  1.51      +1 -0      apache-2.0/src/lib/apr/include/apr.h.in
  
  Index: apr.h.in
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr.h.in,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- apr.h.in	2000/11/11 06:05:59	1.50
  +++ apr.h.in	2000/11/13 03:18:19	1.51
  @@ -96,6 +96,7 @@
   #define APR_HAS_OTHER_CHILD       @oc@
   #define APR_HAS_DSO               @aprdso@
   #define APR_HAS_UNICODE_FS        0
  +#define APR_HAS_USER              1
   
   /* This macro tells APR that it is safe to make a file masquerade as a 
    * socket.  This is necessary, because some platforms support poll'ing
  
  
  
  1.36      +2 -0      apache-2.0/src/lib/apr/include/apr.hw
  
  Index: apr.hw
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr.hw,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- apr.hw	2000/11/13 02:57:25	1.35
  +++ apr.hw	2000/11/13 03:18:19	1.36
  @@ -160,6 +160,8 @@
    */
   #define APR_HAS_UNICODE_FS     1
   
  +#define APR_HAS_USER           0
  +
   /* Not all platforms have a real INADDR_NONE.  This macro replaces INADDR_NONE
    * on all platforms.
    */
  
  
  
  1.1                  apache-2.0/src/lib/apr/include/apr_user.h
  
  Index: apr_user.h
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #ifndef APR_USER_H
  #define APR_USER_H
  
  #include "apr.h"
  
  #if APR_HAS_USER
  
  #ifdef __cplusplus
  extern "C" {
  #endif /* __cplusplus */
  
  /**
   * @package APR user id services
   */
  
  /***
   * Get the home directory for a specified userid.
   * @param dirname Pointer to new string containing directory name (on output)
   * @param userid The userid
   * @param p The pool from which to allocate the string
   * @deffunc apr_status_t apr_get_home_directory(char **dirname, const char *userid, apr_pool_t
*p)
   * @tip This function is available only if APR_HAS_USER is defined.
   */
  apr_status_t apr_get_home_directory(char **dirname, const char *userid, apr_pool_t *p);
  
  #ifdef __cplusplus
  }
  #endif
  
  #endif  /* ! APR_HAS_USER */
  
  #endif  /* ! APR_USER_H */
  
  
  

Mime
View raw message