Index: include/mpm_common.h
===================================================================
RCS file: /home/cvs/httpd-2.0/include/mpm_common.h,v
retrieving revision 1.30
diff -u -r1.30 mpm_common.h
--- include/mpm_common.h	2001/11/17 14:02:25	1.30
+++ include/mpm_common.h	2001/11/21 17:09:05
@@ -156,18 +156,28 @@
 /**
  * Convert a username to a numeric ID
  * @param name The name to convert
+ * @param pool The pool to allocate working space from
  * @return The user id corresponding to a name
+ * @remark This function requires APR_HAS_USER support, and supports the
+ * string #num in addition to group names.
  * @deffunc uid_t ap_uname2id(const char *name)
  */
-AP_DECLARE(uid_t) ap_uname2id(const char *name);
+#if APR_HAS_USER
+AP_DECLARE(uid_t) ap_uname2id(const char *name, apr_pool_t *pool);
+#endif
 
 /**
  * Convert a group name to a numeric ID
  * @param name The name to convert
+ * @param pool The pool to allocate working space from
  * @return The group id corresponding to a name
+ * @remark This function requires APR_HAS_USER support, and supports the
+ * string #num in addition to group names.
  * @deffunc gid_t ap_gname2id(const char *name)
  */
-AP_DECLARE(gid_t) ap_gname2id(const char *name);
+#if APR_HAS_USER
+AP_DECLARE(gid_t) ap_gname2id(const char *name, apr_pool_t *pool);
+#endif
 
 #define AP_MPM_HARD_LIMITS_FILE APACHE_MPM_DIR "/mpm_default.h"
 
Index: modules/generators/mod_suexec.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/generators/mod_suexec.c,v
retrieving revision 1.9
diff -u -r1.9 mod_suexec.c
--- modules/generators/mod_suexec.c	2001/02/16 04:26:38	1.9
+++ modules/generators/mod_suexec.c	2001/11/21 17:09:05
@@ -106,8 +106,8 @@
         return err;
     }
     if (unixd_config.suexec_enabled) {
-        cfg->ugid.uid = ap_uname2id(uid);
-        cfg->ugid.gid = ap_gname2id(gid);
+        cfg->ugid.uid = ap_uname2id(uid, cmd->pool);
+        cfg->ugid.gid = ap_gname2id(gid, cmd->pool);
         cfg->active = 1;
     }
     else {
Index: os/unix/unixd.c
===================================================================
RCS file: /home/cvs/httpd-2.0/os/unix/unixd.c,v
retrieving revision 1.42
diff -u -r1.42 unixd.c
--- os/unix/unixd.c	2001/11/13 22:42:38	1.42
+++ os/unix/unixd.c	2001/11/21 17:09:05
@@ -196,7 +196,7 @@
     }
 
     unixd_config.user_name = arg;
-    unixd_config.user_id = ap_uname2id(arg);
+    unixd_config.user_id = ap_uname2id(arg, cmd->pool);
 #if !defined (BIG_SECURITY_HOLE) && !defined (OS2)
     if (unixd_config.user_id == 0) {
 	return "Error:\tApache has not been designed to serve pages while\n"
@@ -222,7 +222,7 @@
         return err;
     }
 
-    unixd_config.group_id = ap_gname2id(arg);
+    unixd_config.group_id = ap_gname2id(arg, cmd->pool);
 
     return NULL;
 }
@@ -232,8 +232,8 @@
     apr_finfo_t wrapper;
 
     unixd_config.user_name = DEFAULT_USER;
-    unixd_config.user_id = ap_uname2id(DEFAULT_USER);
-    unixd_config.group_id = ap_gname2id(DEFAULT_GROUP);
+    unixd_config.user_id = ap_uname2id(DEFAULT_USER, cmd->pool);
+    unixd_config.group_id = ap_gname2id(DEFAULT_GROUP, cmd->pool);
 
     /* Check for suexec */
     unixd_config.suexec_enabled = 0;
Index: server/mpm_common.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/mpm_common.c,v
retrieving revision 1.72
diff -u -r1.72 mpm_common.c
--- server/mpm_common.c	2001/11/17 14:09:14	1.72
+++ server/mpm_common.c	2001/11/21 17:09:05
@@ -294,34 +294,37 @@
 }
 #endif
 
-#ifdef HAVE_GETPWNAM
-AP_DECLARE(uid_t) ap_uname2id(const char *name)
+#if APR_HAS_USER
+AP_DECLARE(uid_t) ap_uname2id(const char *name, apr_pool_t *pool)
 {
-    struct passwd *ent;
+    apr_uid_t uid;
+    apr_gid_t gid;
+    apr_status_t rv;
 
     if (name[0] == '#')
         return (atoi(&name[1]));
 
-    if (!(ent = getpwnam(name))) {
-        ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "%s: bad user name %s", ap_server_argv0, name);
+    if ((rv = apr_get_userid(&uid, &gid, name, pool)) !=  APR_SUCCESS) {
+        ap_log_error(APLOG_MARK, APLOG_STARTUP, rv, NULL, "%s: bad user name %s", ap_server_argv0, name);
         exit(1);
     }
-    return (ent->pw_uid);
+    return (uid);
 }
 #endif
 
-#ifdef HAVE_GETGRNAM
-AP_DECLARE(gid_t) ap_gname2id(const char *name)
+#if APR_HAS_USER
+AP_DECLARE(gid_t) ap_gname2id(const char *name, apr_pool_t *pool)
 {
-    struct group *ent;
+    apr_gid_t gid;
+    apr_status_t rv;
 
     if (name[0] == '#')
         return (atoi(&name[1]));
 
-    if (!(ent = getgrnam(name))) {
-        ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, "%s: bad group name %s", ap_server_argv0, name);                                               exit(1);
+    if ((rv = apr_get_groupid(&gid, name, pool)) !=  APR_SUCCESS) {
+        ap_log_error(APLOG_MARK, APLOG_STARTUP, rv, NULL, "%s: bad group name %s", ap_server_argv0, name);                                               exit(1);
     }
-    return (ent->gr_gid);
+    return (gid);
 }
 #endif
 
