You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Cliff Woolley <cl...@yahoo.com> on 2001/02/21 19:54:06 UTC

[PATCH] RE: mod_userdir segfault (segfault type #3)

The following patch should fix the mod_userdir/suexec segfault.  And it should
be threadsafe, if that's at all possible for the platform.

This addresses PR7271.

Index: mod_userdir.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/mappers/mod_userdir.c,v
retrieving revision 1.37
diff -u -d -r1.37 mod_userdir.c
--- mod_userdir.c	2001/02/18 02:58:52	1.37
+++ mod_userdir.c	2001/02/21 19:50:14
@@ -357,8 +357,8 @@
 #ifdef HAVE_UNIX_SUEXEC
 static ap_unix_identity_t *get_suexec_id_doer(const request_rec *r)
 {
+#if APR_HAS_USER
     const char *username = apr_table_get(r->notes, "mod_userdir_user");
-    struct passwd *pw = NULL;
     ap_unix_identity_t *ugid = NULL;

     if (username == NULL) {
@@ -369,10 +369,14 @@
         return NULL;
     }

-    ugid->uid = pw->pw_uid;
-    ugid->gid = pw->pw_gid;
-
+    if (apr_get_userid(&ugid->uid, &ugid->gid, username) != APR_SUCCESS) {
+        return NULL;
+    }
+
     return ugid;
+#else
+    return NULL;
+#endif
 }
 #endif /* HAVE_UNIX_SUEXEC */


---------------------------------------------------
    Cliff Woolley
    cliffwoolley@yahoo.com
    804-244-8615
    Charlottesville, VA