]> granicus.if.org Git - apache/commitdiff
*) Adopt apr features to simplify mod_includes. This changes the
authorWilliam A. Rowe Jr <wrowe@apache.org>
Sun, 28 Jan 2001 23:57:25 +0000 (23:57 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Sun, 28 Jan 2001 23:57:25 +0000 (23:57 +0000)
     behavior of the USER_NAME variable, unknown uid's are now reported
     as USER_NAME="<unknown>" rather than the old user#000 result.
     WinNT now resolves USER_NAME on NTFS volumes.  [William Rowe]

  ** Also fixes yet another stat result, allowing APR_INCOMPLETE

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87903 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/filters/mod_include.c

diff --git a/CHANGES b/CHANGES
index fc93bbcedcc5871b9fe0665a15ce16fa4739ea11..3fdd0658c7a25a9a08516370ec93fa23b76b1b94 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,10 @@
 Changes with Apache 2.0b1
 
+  *) Adopt apr features to simplify mod_includes.  This changes the
+     behavior of the USER_NAME variable, unknown uid's are now reported
+     as USER_NAME="<unknown>" rather than the old user#000 result.
+     WinNT now resolves USER_NAME on NTFS volumes.  [William Rowe]
+
   *) Adopt apr features for simplifing mod_userdir, and accept the new
      Win32/OS2 exceptions without hiccuping.  [William Rowe]
 
index eae9f798b6aa7c6e5a1990a8bbf88c39ef53cb06..60927c4afeeee6565ec397aa649d8442230570b3 100644 (file)
@@ -68,6 +68,7 @@
 #include "apr_strings.h"
 #include "apr_thread_proc.h"
 #include "apr_hash.h"
+#include "apr_user.h"
 
 #define CORE_PRIVATE
 
@@ -89,9 +90,6 @@
 #ifdef HAVE_STRINGS_H
 #include <strings.h>
 #endif
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif
 #include "util_ebcdic.h"
 
 
@@ -102,9 +100,7 @@ static apr_hash_t *include_hash;
 /* XXX: could use ap_table_overlap here */
 static void add_include_vars(request_rec *r, char *timefmt)
 {
-#ifndef WIN32
-    struct passwd *pw;
-#endif /* ndef WIN32 */
+    char *pwname;
     apr_table_t *e = r->subprocess_env;
     char *t;
     apr_time_t date = r->request_time;
@@ -115,17 +111,12 @@ static void add_include_vars(request_rec *r, char *timefmt)
               ap_ht_time(r->pool, r->finfo.mtime, timefmt, 0));
     apr_table_setn(e, "DOCUMENT_URI", r->uri);
     apr_table_setn(e, "DOCUMENT_PATH_INFO", r->path_info);
-#ifndef WIN32
-    pw = getpwuid(r->finfo.user);
-    if (pw) {
-        apr_table_setn(e, "USER_NAME", apr_pstrdup(r->pool, pw->pw_name));
+    if (apr_get_username(&pwname, r->finfo.user, r->pool) == APR_SUCCESS) {
+        apr_table_setn(e, "USER_NAME", pwname);
     }
     else {
-        apr_table_setn(e, "USER_NAME", apr_psprintf(r->pool, "user#%lu",
-                    (unsigned long) r->finfo.user));
+        apr_table_setn(e, "USER_NAME", "<unknown>");
     }
-#endif /* ndef WIN32 */
-
     if ((t = strrchr(r->filename, '/'))) {
         apr_table_setn(e, "DOCUMENT_NAME", ++t);
     }
@@ -1285,8 +1276,9 @@ static int find_file(request_rec *r, const char *directive, const char *tag,
 
             if (rr->status == HTTP_OK && rr->finfo.protection != 0) {
                 to_send = rr->filename;
-                if (apr_stat(finfo, to_send, 
-                             APR_FINFO_NORM, rr->pool) != APR_SUCCESS) {
+                if (rv = apr_stat(finfo, to_send, APR_FINFO_GPROT 
+                                | APR_FINFO_MIN, rr->pool) != APR_SUCCESS
+                                                     && rv != APR_INCOMPLETE) {
                     error_fmt = "unable to get information about \"%s\" "
                         "in parsed file %s";
                 }