You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "William A. Rowe, Jr." <wr...@rowe-clan.net> on 2001/01/28 05:20:46 UTC
A silly query
Could someone else comment on this patch before I commit (Tony?)
It seems rather odd that we would stat the r->filename, since if we
have an r->filename I can't imagine how it hasn't been stat'ed.
If someone could point out the blindingly obvious to me, I'd really
appreciate it.
Bill
Index: mod_rewrite.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_rewrite.c,v
retrieving revision 1.62
diff -u -r1.62 mod_rewrite.c
--- mod_rewrite.c 2001/01/20 21:42:19 1.62
+++ mod_rewrite.c 2001/01/28 04:16:12
@@ -113,12 +113,6 @@
#include <sys/uio.h>
#endif
#endif
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif
-#ifdef HAVE_GRP_H
-#include <grp.h>
-#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -3395,11 +3389,6 @@
char resultbuf[LONG_STRING_LEN];
apr_exploded_time_t tm;
request_rec *rsub;
-#ifndef WIN32
- struct passwd *pw;
- struct group *gr;
- apr_finfo_t finfo;
-#endif
result = NULL;
@@ -3588,44 +3577,19 @@
LOOKAHEAD(ap_sub_req_lookup_file)
}
-#if !defined(WIN32) && !defined(NETWARE)
- /* Win32 has a rather different view of file ownerships.
- For now, just forget it */
-
/* file stuff */
else if (strcasecmp(var, "SCRIPT_USER") == 0) {
result = "<unknown>";
- if (r->finfo.protection != 0) {
- if ((pw = getpwuid(r->finfo.user)) != NULL) {
- result = pw->pw_name;
- }
+ if (r->finfo.valid & APR_FINFO_USER) {
+ apr_get_username(&(char*)result, r->finfo.user, r->pool);
}
- else {
- if (apr_stat(&finfo, r->filename,
- APR_FINFO_NORM, r->pool) == APR_SUCCESS) {
- if ((pw = getpwuid(finfo.user)) != NULL) {
- result = pw->pw_name;
- }
- }
- }
}
else if (strcasecmp(var, "SCRIPT_GROUP") == 0) {
result = "<unknown>";
- if (r->finfo.protection != 0) {
- if ((gr = getgrgid(r->finfo.group)) != NULL) {
- result = gr->gr_name;
- }
- }
- else {
- if (apr_stat(&finfo, r->filename,
- APR_FINFO_NORM, r->pool) == 0) {
- if ((gr = getgrgid(finfo.group)) != NULL) {
- result = gr->gr_name;
- }
- }
+ if (r->finfo.valid & APR_FINFO_GROUP) {
+ apr_get_groupname(&(char*)result, r->finfo.group, r->pool);
}
}
-#endif /* ndef WIN32 && NETWARE*/
if (result == NULL) {
return apr_pstrdup(r->pool, "");
Re: A silly query
Posted by Tony Finch <do...@dotat.at>.
"William A. Rowe, Jr." <wr...@rowe-clan.net> wrote:
>Could someone else comment on this patch before I commit (Tony?)
>
>It seems rather odd that we would stat the r->filename, since if we
>have an r->filename I can't imagine how it hasn't been stat'ed.
>
>If someone could point out the blindingly obvious to me, I'd really
>appreciate it.
I haven't looked in any detail, but has mod_rewrite fiddled with
r->filename without marking r->finfo invalid?
Tony.
--
f.a.n.finch fanf@covalent.net dot@dotat.at
"Because all you of Earth are idiots!"