1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

The changes required for the APR_FINFO_wanted argument to

apr_stat/lstat/getfileinfo.  These are -NOT- optimal, they
  are simply the required changes to get the server working.
  The size of the patch is a warning about how we need to
  really look at what we are trying to accomplish with all
  of these stat/lstat calls.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@87760 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
William A. Rowe Jr
2001-01-20 21:42:23 +00:00
parent a9d7c604f2
commit cd1ef027c2
27 changed files with 98 additions and 112 deletions

View File

@@ -1238,7 +1238,8 @@ static const char *isapi_cmd_cachefile(cmd_parms *cmd, void *dummy,
char *fspec; char *fspec;
fspec = ap_os_case_canonical_filename(cmd->pool, filename); fspec = ap_os_case_canonical_filename(cmd->pool, filename);
if (apr_stat(&tmp, fspec, cmd->temp_pool) != APR_SUCCESS) { if (apr_stat(&tmp, fspec,
APR_FINFO_NORM, cmd->temp_pool) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, cmd->server, ap_log_error(APLOG_MARK, APLOG_WARNING, errno, cmd->server,
"ISAPI: unable to stat(%s), skipping", filename); "ISAPI: unable to stat(%s), skipping", filename);
return NULL; return NULL;

View File

@@ -157,39 +157,6 @@ static void *create_server_config(apr_pool_t *p, server_rec *s)
return sconf; return sconf;
} }
#if APR_HAS_SENDFILE
static apr_status_t open_file(apr_file_t **file, const char *filename, int flg1, int flg2,
apr_pool_t *p)
{
apr_status_t rv;
#ifdef WIN32
/* The Windows file needs to be opened for overlapped i/o, which APR doesn't
* support.
*/
HANDLE hFile;
/* XXX: This is wrong for unicode FS ... and it doesn't belong in httpd */
hFile = CreateFile(filename, /* pointer to name of the file */
GENERIC_READ, /* access (read-write) mode */
FILE_SHARE_READ, /* share mode */
NULL, /* pointer to security attributes */
OPEN_EXISTING, /* how to create */
FILE_FLAG_OVERLAPPED | FILE_FLAG_SEQUENTIAL_SCAN, /* file attributes */
NULL); /* handle to file with attributes to copy */
if (hFile != INVALID_HANDLE_VALUE) {
rv = apr_put_os_file(file, &hFile, p);
}
else {
rv = GetLastError();
*file = NULL;
}
#else
rv = apr_open(file, filename, flg1, flg2, p);
#endif
return rv;
}
#endif /* APR_HAS_SENDFILE */
static apr_status_t cleanup_file_cache(void *sconfv) static apr_status_t cleanup_file_cache(void *sconfv)
{ {
a_server_config *sconf = sconfv; a_server_config *sconf = sconfv;
@@ -219,8 +186,8 @@ static const char *cachefile(cmd_parms *cmd, void *dummy, const char *filename)
{ {
/* ToDo: /* ToDo:
* Disable the file cache on a Windows 9X box. APR_HAS_SENDFILE will be * Disable the file cache on a Windows 9X box. APR_HAS_SENDFILE will be
* defined in an Apache for Windows build, but apr_sendfile is not * defined in an Apache for Windows build, but apr_sendfile returns
* implemened on Windows 9X because TransmitFile is not available. * APR_ENOTIMPL on Windows 9X because TransmitFile is not available.
*/ */
#if APR_HAS_SENDFILE #if APR_HAS_SENDFILE
@@ -232,7 +199,9 @@ static const char *cachefile(cmd_parms *cmd, void *dummy, const char *filename)
/* canonicalize the file name? */ /* canonicalize the file name? */
/* os_canonical... */ /* os_canonical... */
if ((rc = apr_stat(&tmp.finfo, filename, cmd->temp_pool)) != APR_SUCCESS) { /* XXX: uh... yea, or expect them to be -very- accurate typists */
if ((rc = apr_stat(&tmp.finfo, filename, APR_FINFO_NORM,
cmd->temp_pool)) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_WARNING, rc, cmd->server, ap_log_error(APLOG_MARK, APLOG_WARNING, rc, cmd->server,
"mod_file_cache: unable to stat(%s), skipping", filename); "mod_file_cache: unable to stat(%s), skipping", filename);
return NULL; return NULL;
@@ -243,11 +212,7 @@ static const char *cachefile(cmd_parms *cmd, void *dummy, const char *filename)
return NULL; return NULL;
} }
/* Note: open_file should call apr_open for Unix and CreateFile for Windows. rc = apr_open(&fd, filename, APR_READ | APR_XTHREAD, APR_OS_DEFAULT, cmd->pool);
* The Windows file needs to be opened for async I/O to allow multiple threads
* to serve it up at once.
*/
rc = open_file(&fd, filename, APR_READ, APR_OS_DEFAULT, cmd->pool);
if (rc != APR_SUCCESS) { if (rc != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_WARNING, rc, cmd->server, ap_log_error(APLOG_MARK, APLOG_WARNING, rc, cmd->server,
"mod_file_cache: unable to open(%s, O_RDONLY), skipping", filename); "mod_file_cache: unable to open(%s, O_RDONLY), skipping", filename);
@@ -285,7 +250,8 @@ static const char *mmapfile(cmd_parms *cmd, void *dummy, const char *filename)
const char *fspec; const char *fspec;
fspec = ap_os_case_canonical_filename(cmd->pool, filename); fspec = ap_os_case_canonical_filename(cmd->pool, filename);
if ((rc = apr_stat(&tmp.finfo, fspec, cmd->temp_pool)) != APR_SUCCESS) { if ((rc = apr_stat(&tmp.finfo, fspec, APR_FINFO_NORM,
cmd->temp_pool)) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_WARNING, rc, cmd->server, ap_log_error(APLOG_MARK, APLOG_WARNING, rc, cmd->server,
"mod_file_cache: unable to stat(%s), skipping", filename); "mod_file_cache: unable to stat(%s), skipping", filename);
return NULL; return NULL;

View File

@@ -446,7 +446,7 @@ static dav_datum dav_fs_build_key(apr_pool_t *p, const dav_resource *resource)
apr_finfo_t finfo; apr_finfo_t finfo;
/* ### use lstat() ?? */ /* ### use lstat() ?? */
if (apr_stat(&finfo, file, p) == 0) { if (apr_stat(&finfo, file, APR_FINFO_NORM, p) == APR_SUCCESS) {
/* ### can we use a buffer for this? */ /* ### can we use a buffer for this? */
key.dsize = 1 + sizeof(finfo.inode) + sizeof(finfo.device); key.dsize = 1 + sizeof(finfo.inode) + sizeof(finfo.device);
@@ -663,7 +663,7 @@ static dav_error * dav_fs_load_lock_record(dav_lockdb *lockdb, dav_datum key,
apr_finfo_t finfo; apr_finfo_t finfo;
/* if we don't see the file, then it's a locknull */ /* if we don't see the file, then it's a locknull */
if (apr_lstat(&finfo, fname, p) != 0) { if (apr_lstat(&finfo, fname, APR_FINFO_NORM, p) != APR_SUCCESS) {
if ((err = dav_fs_remove_locknull_member(p, fname, &buf)) != NULL) { if ((err = dav_fs_remove_locknull_member(p, fname, &buf)) != NULL) {
/* ### push a higher-level description? */ /* ### push a higher-level description? */
return err; return err;
@@ -833,7 +833,7 @@ static dav_error * dav_fs_load_locknull_list(apr_pool_t *p, const char *dirpath,
return NULL; return NULL;
} }
if (apr_getfileinfo(&finfo, file) != APR_SUCCESS) { if (apr_getfileinfo(&finfo, APR_FINFO_NORM, file) != APR_SUCCESS) {
err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, err = dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
apr_psprintf(p, apr_psprintf(p,
"Opened but could not stat file %s", "Opened but could not stat file %s",

View File

@@ -427,7 +427,7 @@ static dav_error * dav_fs_copymove_state(
src = apr_pstrcat(p, src_dir, "/" DAV_FS_STATE_DIR "/", src_file, NULL); src = apr_pstrcat(p, src_dir, "/" DAV_FS_STATE_DIR "/", src_file, NULL);
/* the source file doesn't exist */ /* the source file doesn't exist */
if (apr_stat(&src_finfo, src, p) != 0) { if (apr_stat(&src_finfo, src, APR_FINFO_NORM, p) != APR_SUCCESS) {
return NULL; return NULL;
} }
@@ -447,7 +447,7 @@ static dav_error * dav_fs_copymove_state(
} }
/* get info about the state directory */ /* get info about the state directory */
if (apr_stat(&dst_state_finfo, dst, p) != 0) { if (apr_stat(&dst_state_finfo, dst, APR_FINFO_NORM, p) != APR_SUCCESS) {
/* Ack! Where'd it go? */ /* Ack! Where'd it go? */
/* ### use something besides 500? */ /* ### use something besides 500? */
return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, return dav_new_error(p, HTTP_INTERNAL_SERVER_ERROR, 0,
@@ -735,7 +735,8 @@ static dav_resource * dav_fs_get_parent_resource(const dav_resource *resource)
parent_resource->uri = uri; parent_resource->uri = uri;
} }
if (apr_stat(&parent_ctx->finfo, parent_ctx->pathname, ctx->pool) == 0) { if (apr_stat(&parent_ctx->finfo, parent_ctx->pathname,
APR_FINFO_NORM, ctx->pool) == APR_SUCCESS) {
parent_resource->exists = 1; parent_resource->exists = 1;
} }
@@ -1138,7 +1139,7 @@ static dav_error * dav_fs_move_resource(
* so try it * so try it
*/ */
dirpath = ap_make_dirstr_parent(dstinfo->pool, dstinfo->pathname); dirpath = ap_make_dirstr_parent(dstinfo->pool, dstinfo->pathname);
if (apr_stat(&finfo, dirpath, dstinfo->pool) == 0 if (apr_stat(&finfo, dirpath, APR_FINFO_NORM, dstinfo->pool) == 0
&& finfo.device == srcinfo->finfo.device) { && finfo.device == srcinfo->finfo.device) {
can_rename = 1; can_rename = 1;
} }
@@ -1386,7 +1387,8 @@ static dav_error * dav_fs_walker(dav_fs_walker_context *fsctx, int depth)
/* append this file onto the path buffer (copy null term) */ /* append this file onto the path buffer (copy null term) */
dav_buffer_place_mem(pool, &fsctx->path1, name, len + 1, 0); dav_buffer_place_mem(pool, &fsctx->path1, name, len + 1, 0);
if (apr_lstat(&fsctx->info1.finfo, fsctx->path1.buf, pool) != 0) { if (apr_lstat(&fsctx->info1.finfo, fsctx->path1.buf,
APR_FINFO_NORM, pool) != APR_SUCCESS) {
/* woah! where'd it go? */ /* woah! where'd it go? */
/* ### should have a better error here */ /* ### should have a better error here */
err = dav_new_error(pool, HTTP_NOT_FOUND, 0, NULL); err = dav_new_error(pool, HTTP_NOT_FOUND, 0, NULL);

View File

@@ -1268,6 +1268,7 @@ static int find_file(request_rec *r, const char *directive, const char *tag,
request_rec *rr = NULL; request_rec *rr = NULL;
int ret=0; int ret=0;
char *error_fmt = NULL; char *error_fmt = NULL;
apr_status_t rv = APR_SUCCESS;
if (!strcmp(tag, "file")) { if (!strcmp(tag, "file")) {
/* be safe; only files in this directory or below allowed */ /* be safe; only files in this directory or below allowed */
@@ -1284,7 +1285,8 @@ static int find_file(request_rec *r, const char *directive, const char *tag,
if (rr->status == HTTP_OK && rr->finfo.protection != 0) { if (rr->status == HTTP_OK && rr->finfo.protection != 0) {
to_send = rr->filename; to_send = rr->filename;
if (apr_stat(finfo, to_send, rr->pool) != APR_SUCCESS) { if (apr_stat(finfo, to_send,
APR_FINFO_NORM, rr->pool) != APR_SUCCESS) {
error_fmt = "unable to get information about \"%s\" " error_fmt = "unable to get information about \"%s\" "
"in parsed file %s"; "in parsed file %s";
} }
@@ -1297,10 +1299,8 @@ static int find_file(request_rec *r, const char *directive, const char *tag,
if (error_fmt) { if (error_fmt) {
ret = -1; ret = -1;
/* TODO: pass APLOG_NOERRNO if no apr_stat() failure; pass rv from apr_stat() ap_log_rerror(APLOG_MARK, APLOG_ERR | (rv ? 0 : APLOG_NOERRNO),
* otherwise rv, r, error_fmt, to_send, r->filename);
*/
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, error_fmt, to_send, r->filename);
} }
if (rr) ap_destroy_sub_req(rr); if (rr) ap_destroy_sub_req(rr);

View File

@@ -194,10 +194,12 @@ static int log_scripterror(request_rec *r, cgi_server_conf * conf, int ret,
"%s: %s", error, r->filename); "%s: %s", error, r->filename);
if (!conf->logname || if (!conf->logname ||
((apr_stat(&finfo, ap_server_root_relative(r->pool, conf->logname), r->pool) == APR_SUCCESS) ((apr_stat(&finfo, ap_server_root_relative(r->pool, conf->logname),
APR_FINFO_NORM, r->pool) == APR_SUCCESS)
&& (finfo.size > conf->logbytes)) || && (finfo.size > conf->logbytes)) ||
(apr_open(&f, ap_server_root_relative(r->pool, conf->logname), (apr_open(&f, ap_server_root_relative(r->pool, conf->logname),
APR_APPEND|APR_WRITE|APR_CREATE, APR_OS_DEFAULT, r->pool) != APR_SUCCESS)) { APR_APPEND|APR_WRITE|APR_CREATE, APR_OS_DEFAULT, r->pool)
!= APR_SUCCESS)) {
return ret; return ret;
} }
@@ -244,7 +246,8 @@ static int log_script(request_rec *r, cgi_server_conf * conf, int ret,
char time_str[APR_CTIME_LEN]; char time_str[APR_CTIME_LEN];
if (!conf->logname || if (!conf->logname ||
((apr_stat(&finfo, ap_server_root_relative(r->pool, conf->logname), r->pool) == APR_SUCCESS) ((apr_stat(&finfo, ap_server_root_relative(r->pool, conf->logname),
APR_FINFO_NORM, r->pool) == APR_SUCCESS)
&& (finfo.size > conf->logbytes)) || && (finfo.size > conf->logbytes)) ||
(apr_open(&f, ap_server_root_relative(r->pool, conf->logname), (apr_open(&f, ap_server_root_relative(r->pool, conf->logname),
APR_APPEND|APR_WRITE|APR_CREATE, APR_OS_DEFAULT, r->pool) != APR_SUCCESS)) { APR_APPEND|APR_WRITE|APR_CREATE, APR_OS_DEFAULT, r->pool) != APR_SUCCESS)) {
@@ -553,8 +556,8 @@ static int cgi_handler(request_rec *r)
apr_status_t rv; apr_status_t rv;
newfile = apr_pstrcat(r->pool, r->filename, ".EXE", NULL); newfile = apr_pstrcat(r->pool, r->filename, ".EXE", NULL);
if (((rv = apr_stat(&finfo, newfile, r->pool)) != APR_SUCCESS) || if (((rv = apr_stat(&finfo, newfile, APR_FINFO_TYPE, r->pool))
(finfo.filetype != APR_REG)) { != APR_SUCCESS) || (finfo.filetype != APR_REG)) {
return log_scripterror(r, conf, HTTP_NOT_FOUND, rv, return log_scripterror(r, conf, HTTP_NOT_FOUND, rv,
"script not found or unable to stat"); "script not found or unable to stat");
} else { } else {

View File

@@ -176,7 +176,7 @@ static int check_symlinks(char *d, int opts, apr_pool_t *p)
else else
lastp = NULL; lastp = NULL;
res = apr_lstat(&lfi, d, p); res = apr_lstat(&lfi, d, APR_FINFO_NORM, p);
if (lastp) if (lastp)
*lastp = '/'; *lastp = '/';
@@ -194,10 +194,11 @@ static int check_symlinks(char *d, int opts, apr_pool_t *p)
if (!(opts & OPT_SYM_OWNER)) if (!(opts & OPT_SYM_OWNER))
return HTTP_FORBIDDEN; return HTTP_FORBIDDEN;
if (apr_stat(&fi, d, p) < 0) if (apr_stat(&fi, d, APR_FINFO_NORM, p) != APR_SUCCESS)
return HTTP_FORBIDDEN; return HTTP_FORBIDDEN;
return (fi.user == lfi.user) ? OK : HTTP_FORBIDDEN; return ((fi.valid & lfi.valid & APR_FINFO_OWNER)
&& (fi.user == lfi.user)) ? OK : HTTP_FORBIDDEN;
#endif #endif
} }
@@ -271,7 +272,7 @@ static int get_path_info(request_rec *r)
* an APR_PATHINCOMPLETE result to indicate that we are staring at * an APR_PATHINCOMPLETE result to indicate that we are staring at
* an partial virtual root. Only OS2/Win32/Netware need apply it :-) * an partial virtual root. Only OS2/Win32/Netware need apply it :-)
*/ */
rv = apr_stat(&r->finfo, path, r->pool); rv = apr_stat(&r->finfo, path, APR_FINFO_NORM, r->pool);
if (cp != end) if (cp != end)
*cp = '/'; *cp = '/';
@@ -283,7 +284,7 @@ static int get_path_info(request_rec *r)
* argument starts with the component after that. * argument starts with the component after that.
*/ */
if (r->finfo.filetype == APR_DIR && last_cp) { if (r->finfo.filetype == APR_DIR && last_cp) {
r->finfo.protection = 0; /* No such file... */ r->finfo.protection = 0; /* XXX: Wrong test for no such file... */
r->finfo.filetype = APR_NOFILE; /* No such file... */ r->finfo.filetype = APR_NOFILE; /* No such file... */
cp = last_cp; cp = last_cp;
} }
@@ -967,7 +968,8 @@ AP_DECLARE(request_rec *) ap_sub_req_lookup_file(const char *new_file,
rnew->filename = ap_make_full_path(rnew->pool, fdir, new_file); rnew->filename = ap_make_full_path(rnew->pool, fdir, new_file);
ap_parse_uri(rnew, rnew->uri); /* fill in parsed_uri values */ ap_parse_uri(rnew, rnew->uri); /* fill in parsed_uri values */
if (apr_stat(&rnew->finfo, rnew->filename, rnew->pool) != APR_SUCCESS) { if (apr_stat(&rnew->finfo, rnew->filename,
APR_FINFO_NORM, rnew->pool) != APR_SUCCESS) {
rnew->finfo.protection = 0; rnew->finfo.protection = 0;
} }

View File

@@ -1469,7 +1469,8 @@ static float find_content_length(negotiation_state *neg, var_rec *variant)
char *fullname = ap_make_full_path(neg->pool, neg->dir_name, char *fullname = ap_make_full_path(neg->pool, neg->dir_name,
variant->file_name); variant->file_name);
if (apr_stat(&statb, fullname, neg->pool) == APR_SUCCESS) { if (apr_stat(&statb, fullname,
APR_FINFO_NORM, neg->pool) == APR_SUCCESS) {
/* Note, precision may be lost */ /* Note, precision may be lost */
variant->bytes = (float) statb.size; variant->bytes = (float) statb.size;
} }

View File

@@ -497,7 +497,8 @@ static const char *cmd_rewritemap(cmd_parms *cmd, void *dconf, const char *a1,
newmap->fpout = NULL; newmap->fpout = NULL;
if (newmap->checkfile && (sconf->state == ENGINE_ENABLED) if (newmap->checkfile && (sconf->state == ENGINE_ENABLED)
&& (apr_stat(&st, newmap->checkfile, cmd->pool) != APR_SUCCESS)) { && (apr_stat(&st, newmap->checkfile, APR_FINFO_NORM,
cmd->pool) != APR_SUCCESS)) {
return apr_pstrcat(cmd->pool, return apr_pstrcat(cmd->pool,
"RewriteMap: map file or program not found:", "RewriteMap: map file or program not found:",
newmap->checkfile, NULL); newmap->checkfile, NULL);
@@ -2119,14 +2120,14 @@ static int apply_rewrite_cond(request_rec *r, rewritecond_entry *p,
rc = 0; rc = 0;
if (strcmp(p->pattern, "-f") == 0) { if (strcmp(p->pattern, "-f") == 0) {
if (apr_stat(&sb, input, r->pool) == APR_SUCCESS) { if (apr_stat(&sb, input, APR_FINFO_NORM, r->pool) == APR_SUCCESS) {
if (sb.filetype == APR_REG) { if (sb.filetype == APR_REG) {
rc = 1; rc = 1;
} }
} }
} }
else if (strcmp(p->pattern, "-s") == 0) { else if (strcmp(p->pattern, "-s") == 0) {
if (apr_stat(&sb, input, r->pool) == APR_SUCCESS) { if (apr_stat(&sb, input, APR_FINFO_NORM, r->pool) == APR_SUCCESS) {
if ((sb.filetype == APR_REG) && sb.size > 0) { if ((sb.filetype == APR_REG) && sb.size > 0) {
rc = 1; rc = 1;
} }
@@ -2134,7 +2135,7 @@ static int apply_rewrite_cond(request_rec *r, rewritecond_entry *p,
} }
else if (strcmp(p->pattern, "-l") == 0) { else if (strcmp(p->pattern, "-l") == 0) {
#if !defined(OS2) #if !defined(OS2)
if (apr_lstat(&sb, input, r->pool) == APR_SUCCESS) { if (apr_lstat(&sb, input, APR_FINFO_NORM, r->pool) == APR_SUCCESS) {
if (sb.filetype == APR_LNK) { if (sb.filetype == APR_LNK) {
rc = 1; rc = 1;
} }
@@ -2142,7 +2143,7 @@ static int apply_rewrite_cond(request_rec *r, rewritecond_entry *p,
#endif #endif
} }
else if (strcmp(p->pattern, "-d") == 0) { else if (strcmp(p->pattern, "-d") == 0) {
if (apr_stat(&sb, input, r->pool) == APR_SUCCESS) { if (apr_stat(&sb, input, APR_FINFO_NORM, r->pool) == APR_SUCCESS) {
if (sb.filetype == APR_DIR) { if (sb.filetype == APR_DIR) {
rc = 1; rc = 1;
} }
@@ -2179,7 +2180,8 @@ static int apply_rewrite_cond(request_rec *r, rewritecond_entry *p,
/* file exists for any result up to 2xx, no redirects */ /* file exists for any result up to 2xx, no redirects */
if (rsub->status < 300 && if (rsub->status < 300 &&
/* double-check that file exists since default result is 200 */ /* double-check that file exists since default result is 200 */
apr_stat(&sb, rsub->filename, r->pool) == APR_SUCCESS) { apr_stat(&sb, rsub->filename, APR_FINFO_NORM,
r->pool) == APR_SUCCESS) {
rc = 1; rc = 1;
} }
@@ -2661,7 +2663,8 @@ static char *lookup_map(request_rec *r, char *name, char *key)
s = &entries[i]; s = &entries[i];
if (strcmp(s->name, name) == 0) { if (strcmp(s->name, name) == 0) {
if (s->type == MAPTYPE_TXT) { if (s->type == MAPTYPE_TXT) {
if ((rv = apr_stat(&st, s->checkfile, r->pool)) != APR_SUCCESS) { if ((rv = apr_stat(&st, s->checkfile,
APR_FINFO_NORM, r->pool)) != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
"mod_rewrite: can't access text RewriteMap " "mod_rewrite: can't access text RewriteMap "
"file %s", s->checkfile); "file %s", s->checkfile);
@@ -2698,7 +2701,8 @@ static char *lookup_map(request_rec *r, char *name, char *key)
} }
else if (s->type == MAPTYPE_DBM) { else if (s->type == MAPTYPE_DBM) {
#ifndef NO_DBM_REWRITEMAP #ifndef NO_DBM_REWRITEMAP
if ((rv = apr_stat(&st, s->checkfile, r->pool)) != APR_SUCCESS) { if ((rv = apr_stat(&st, s->checkfile,
APR_FINFO_NORM, r->pool)) != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
"mod_rewrite: can't access DBM RewriteMap " "mod_rewrite: can't access DBM RewriteMap "
"file %s", s->checkfile); "file %s", s->checkfile);
@@ -2760,7 +2764,8 @@ static char *lookup_map(request_rec *r, char *name, char *key)
} }
} }
else if (s->type == MAPTYPE_RND) { else if (s->type == MAPTYPE_RND) {
if ((rv = apr_stat(&st, s->checkfile, r->pool)) != APR_SUCCESS) { if ((rv = apr_stat(&st, s->checkfile,
APR_FINFO_NORM, r->pool)) != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
"mod_rewrite: can't access text RewriteMap " "mod_rewrite: can't access text RewriteMap "
"file %s", s->checkfile); "file %s", s->checkfile);
@@ -3596,7 +3601,8 @@ static char *lookup_variable(request_rec *r, char *var)
} }
} }
else { else {
if (apr_stat(&finfo, r->filename, r->pool) == APR_SUCCESS) { if (apr_stat(&finfo, r->filename,
APR_FINFO_NORM, r->pool) == APR_SUCCESS) {
if ((pw = getpwuid(finfo.user)) != NULL) { if ((pw = getpwuid(finfo.user)) != NULL) {
result = pw->pw_name; result = pw->pw_name;
} }
@@ -3611,7 +3617,8 @@ static char *lookup_variable(request_rec *r, char *var)
} }
} }
else { else {
if (apr_stat(&finfo, r->filename, r->pool) == 0) { if (apr_stat(&finfo, r->filename,
APR_FINFO_NORM, r->pool) == 0) {
if ((gr = getgrgid(finfo.group)) != NULL) { if ((gr = getgrgid(finfo.group)) != NULL) {
result = gr->gr_name; result = gr->gr_name;
} }
@@ -4034,7 +4041,7 @@ static int prefix_stat(const char *path, apr_finfo_t *sb)
if ((cp = strchr(curpath+1, '/')) != NULL) { if ((cp = strchr(curpath+1, '/')) != NULL) {
*cp = '\0'; *cp = '\0';
} }
if (apr_stat(sb, curpath, NULL) == 0) { if (apr_stat(sb, curpath, APR_FINFO_NORM, NULL) == APR_SUCCESS) {
return 1; return 1;
} }
else { else {

View File

@@ -344,7 +344,8 @@ static int translate_userdir(request_rec *r)
* used, for example, to run a CGI script for the user. * used, for example, to run a CGI script for the user.
*/ */
if (filename && (!*userdirs || if (filename && (!*userdirs ||
apr_stat(&statbuf, filename, r->pool) == APR_SUCCESS)) { apr_stat(&statbuf, filename,
APR_FINFO_NORM, r->pool) == APR_SUCCESS)) {
r->filename = apr_pstrcat(r->pool, filename, dname, NULL); r->filename = apr_pstrcat(r->pool, filename, dname, NULL);
/* when statbuf contains info on r->filename we can save a syscall /* when statbuf contains info on r->filename we can save a syscall
* by copying it to r->finfo * by copying it to r->finfo

View File

@@ -1271,7 +1271,7 @@ int ap_proxy_cache_send(request_rec *r, ap_cache_el *c)
len = 2; len = 2;
apr_send(fp, CRLF, &len); apr_send(fp, CRLF, &len);
/* send data */ /* send data */
apr_getfileinfo(&finfo, cachefp); apr_getfileinfo(&finfo, APR_FINFO_NORM, cachefp);
if(!r->header_only && ap_send_fd(cachefp, r, offset, finfo.size, &len)) if(!r->header_only && ap_send_fd(cachefp, r, offset, finfo.size, &len))
return HTTP_INTERNAL_SERVER_ERROR; return HTTP_INTERNAL_SERVER_ERROR;
return OK; return OK;

View File

@@ -230,7 +230,8 @@ void unixd_pre_config(apr_pool_t *ptemp)
/* Check for suexec */ /* Check for suexec */
unixd_config.suexec_enabled = 0; unixd_config.suexec_enabled = 0;
if ((apr_stat(&wrapper, SUEXEC_BIN, ptemp)) != APR_SUCCESS) { if ((apr_stat(&wrapper, SUEXEC_BIN,
APR_FINFO_NORM, ptemp)) != APR_SUCCESS) {
return; return;
} }

View File

@@ -1238,7 +1238,8 @@ static const char *isapi_cmd_cachefile(cmd_parms *cmd, void *dummy,
char *fspec; char *fspec;
fspec = ap_os_case_canonical_filename(cmd->pool, filename); fspec = ap_os_case_canonical_filename(cmd->pool, filename);
if (apr_stat(&tmp, fspec, cmd->temp_pool) != APR_SUCCESS) { if (apr_stat(&tmp, fspec,
APR_FINFO_NORM, cmd->temp_pool) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, cmd->server, ap_log_error(APLOG_MARK, APLOG_WARNING, errno, cmd->server,
"ISAPI: unable to stat(%s), skipping", filename); "ISAPI: unable to stat(%s), skipping", filename);
return NULL; return NULL;

View File

@@ -1284,7 +1284,7 @@ void ap_process_resource_config(server_rec *s, const char *fname,
if ((ap_server_pre_read_config->nelts if ((ap_server_pre_read_config->nelts
|| ap_server_post_read_config->nelts) || ap_server_post_read_config->nelts)
&& !(strcmp(fname, ap_server_root_relative(p, SERVER_CONFIG_FILE)))) { && !(strcmp(fname, ap_server_root_relative(p, SERVER_CONFIG_FILE)))) {
if (apr_stat(&finfo, fname, p) != APR_SUCCESS) if (apr_stat(&finfo, fname, APR_FINFO_NORM, p) != APR_SUCCESS)
return; return;
} }

View File

@@ -520,7 +520,8 @@ void ap_log_pid(apr_pool_t *p, const char *fname)
fname = ap_server_root_relative(p, fname); fname = ap_server_root_relative(p, fname);
mypid = getpid(); mypid = getpid();
if (mypid != saved_pid && apr_stat(&finfo, fname, p) == APR_SUCCESS) { if (mypid != saved_pid
&& apr_stat(&finfo, fname, APR_FINFO_NORM, p) == APR_SUCCESS) {
/* WINCH and HUP call this on each restart. /* WINCH and HUP call this on each restart.
* Only warn on first time through for this pid. * Only warn on first time through for this pid.
* *

View File

@@ -1003,8 +1003,8 @@ static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, const char *arg
} }
fname = ap_server_root_relative(cmd->pool, arg); fname = ap_server_root_relative(cmd->pool, arg);
if ((apr_stat(&finfo, fname, cmd->pool) != APR_SUCCESS) || if ((apr_stat(&finfo, fname, APR_FINFO_NORM, cmd->pool) != APR_SUCCESS)
(finfo.filetype != APR_DIR)) { || (finfo.filetype != APR_DIR)) {
return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname,
" does not exist or is not a directory", NULL); " does not exist or is not a directory", NULL);
} }

View File

@@ -1347,8 +1347,8 @@ static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, const char *arg
} }
fname = ap_server_root_relative(cmd->pool, arg); fname = ap_server_root_relative(cmd->pool, arg);
if ((apr_stat(&finfo, fname, cmd->pool) != APR_SUCCESS) || if ((apr_stat(&finfo, fname, APR_FINFO_NORM, cmd->pool) != APR_SUCCESS)
(finfo.filetype != APR_DIR)) { || (finfo.filetype != APR_DIR)) {
return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname,
" does not exist or is not a directory", NULL); " does not exist or is not a directory", NULL);
} }

View File

@@ -1719,8 +1719,8 @@ static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, const char *arg
} }
fname = ap_server_root_relative(cmd->pool, arg); fname = ap_server_root_relative(cmd->pool, arg);
if ((apr_stat(&finfo, fname, cmd->pool) != APR_SUCCESS) || if ((apr_stat(&finfo, fname, cmd->pool) != APR_SUCCESS)
(finfo.filetype != APR_DIR)) { || (finfo.filetype != APR_DIR)) {
return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname,
" does not exist or is not a directory", NULL); " does not exist or is not a directory", NULL);
} }

View File

@@ -1015,8 +1015,8 @@ static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, char *arg)
} }
fname = ap_server_root_relative(cmd->pool, arg); fname = ap_server_root_relative(cmd->pool, arg);
if ((apr_stat(&finfo, fname, cmd->pool) != APR_SUCCESS) || if ((apr_stat(&finfo, fname, APR_FINFO_NORM, cmd->pool) != APR_SUCCESS)
(finfo.filetype != APR_DIR)) { || (finfo.filetype != APR_DIR)) {
return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname,
" does not exist or is not a directory", NULL); " does not exist or is not a directory", NULL);
} }

View File

@@ -1364,8 +1364,8 @@ static const char *set_coredumpdir (cmd_parms *cmd, void *dummy,
} }
fname = ap_server_root_relative(cmd->pool, arg); fname = ap_server_root_relative(cmd->pool, arg);
if ((apr_stat(&finfo, fname, cmd->pool) != APR_SUCCESS) || if ((apr_stat(&finfo, fname, APR_FINFO_NORM, cmd->pool) != APR_SUCCESS)
(finfo.filetype != APR_DIR)) { || (finfo.filetype != APR_DIR)) {
return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname,
" does not exist or is not a directory", NULL); " does not exist or is not a directory", NULL);
} }

View File

@@ -1719,8 +1719,8 @@ static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, const char *arg
} }
fname = ap_server_root_relative(cmd->pool, arg); fname = ap_server_root_relative(cmd->pool, arg);
if ((apr_stat(&finfo, fname, cmd->pool) != APR_SUCCESS) || if ((apr_stat(&finfo, fname, cmd->pool) != APR_SUCCESS)
(finfo.filetype != APR_DIR)) { || (finfo.filetype != APR_DIR)) {
return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname,
" does not exist or is not a directory", NULL); " does not exist or is not a directory", NULL);
} }

View File

@@ -1715,8 +1715,8 @@ static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, const char *arg
} }
fname = ap_server_root_relative(cmd->pool, arg); fname = ap_server_root_relative(cmd->pool, arg);
if ((apr_stat(&finfo, fname, cmd->pool) != APR_SUCCESS) || if ((apr_stat(&finfo, fname, APR_FINFO_NORM, cmd->pool) != APR_SUCCESS)
(finfo.filetype != APR_DIR)) { || (finfo.filetype != APR_DIR)) {
return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname,
" does not exist or is not a directory", NULL); " does not exist or is not a directory", NULL);
} }

View File

@@ -1496,8 +1496,8 @@ static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, char *arg)
} }
fname = ap_server_root_relative(cmd->pool, arg); fname = ap_server_root_relative(cmd->pool, arg);
if ((apr_stat(&finfo, fname, cmd->pool) != APR_SUCCESS) || if ((apr_stat(&finfo, fname, APR_FINFO_NORM, cmd->pool) != APR_SUCCESS)
(finfo.filetype != APR_DIR)) { || (finfo.filetype != APR_DIR)) {
return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname,
" does not exist or is not a directory", NULL); " does not exist or is not a directory", NULL);
} }

View File

@@ -2299,8 +2299,8 @@ static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, char *arg)
} }
fname = ap_server_root_relative(cmd->pool, arg); fname = ap_server_root_relative(cmd->pool, arg);
if ((apr_stat(&finfo, fname, cmd->pool) != APR_SUCCESS) || if ((apr_stat(&finfo, fname, APR_FINFO_NORM, cmd->pool) != APR_SUCCESS)
(finfo.filetype != APR_DIR)) { || (finfo.filetype != APR_DIR)) {
return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname,
" does not exist or is not a directory", NULL); " does not exist or is not a directory", NULL);
} }

View File

@@ -895,7 +895,7 @@ AP_DECLARE(apr_status_t) ap_pcfg_openfile(configfile_t **ret_cfg, apr_pool_t *p,
if (status != APR_SUCCESS) if (status != APR_SUCCESS)
return status; return status;
status = apr_getfileinfo(&finfo, file); status = apr_getfileinfo(&finfo, APR_FINFO_NORM, file);
if (status != APR_SUCCESS) if (status != APR_SUCCESS)
return status; return status;
@@ -1679,7 +1679,7 @@ AP_DECLARE(int) ap_is_directory(apr_pool_t *p, const char *path)
{ {
apr_finfo_t finfo; apr_finfo_t finfo;
if (apr_stat(&finfo, path, p) == -1) if (apr_stat(&finfo, path, APR_FINFO_NORM, p) != APR_SUCCESS)
return 0; /* in error condition, just return no */ return 0; /* in error condition, just return no */
return (finfo.filetype == APR_DIR); return (finfo.filetype == APR_DIR);
@@ -1689,7 +1689,7 @@ AP_DECLARE(int) ap_is_rdirectory(apr_pool_t *p, const char *path)
{ {
apr_finfo_t finfo; apr_finfo_t finfo;
if (apr_lstat(&finfo, path, p) == -1) if (apr_lstat(&finfo, path, APR_FINFO_NORM, p) != APR_SUCCESS)
return 0; /* in error condition, just return no */ return 0; /* in error condition, just return no */
return (finfo.filetype == APR_DIR); return (finfo.filetype == APR_DIR);

View File

@@ -903,14 +903,14 @@ static void test(void)
static void copyright(void) static void copyright(void)
{ {
if (!use_html) { if (!use_html) {
printf("This is ApacheBench, Version %s\n", AB_VERSION " <$Revision: 1.52 $> apache-2.0"); printf("This is ApacheBench, Version %s\n", AB_VERSION " <$Revision: 1.53 $> apache-2.0");
printf("Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n"); printf("Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n");
printf("Copyright (c) 1998-2000 The Apache Software Foundation, http://www.apache.org/\n"); printf("Copyright (c) 1998-2000 The Apache Software Foundation, http://www.apache.org/\n");
printf("\n"); printf("\n");
} }
else { else {
printf("<p>\n"); printf("<p>\n");
printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i> apache-2.0<br>\n", AB_VERSION, "$Revision: 1.52 $"); printf(" This is ApacheBench, Version %s <i>&lt;%s&gt;</i> apache-2.0<br>\n", AB_VERSION, "$Revision: 1.53 $");
printf(" Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br>\n"); printf(" Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br>\n");
printf(" Copyright (c) 1998-2000 The Apache Software Foundation, http://www.apache.org/<br>\n"); printf(" Copyright (c) 1998-2000 The Apache Software Foundation, http://www.apache.org/<br>\n");
printf("</p>\n<p>\n"); printf("</p>\n<p>\n");
@@ -1002,7 +1002,7 @@ static int open_postfile(const char *pfile)
return rv; return rv;
} }
apr_getfileinfo(&finfo, postfd); apr_getfileinfo(&finfo, APR_FINFO_NORM, postfd);
postlen = finfo.size; postlen = finfo.size;
postdata = (char *)malloc(postlen); postdata = (char *)malloc(postlen);
if (!postdata) { if (!postdata) {

View File

@@ -357,7 +357,7 @@ static int exists(char *fname)
apr_finfo_t sbuf; apr_finfo_t sbuf;
apr_status_t check; apr_status_t check;
check = apr_stat(&sbuf, fname, NULL); check = apr_stat(&sbuf, fname, APR_FINFO_NORM, NULL);
return (check ? 0 : 1); return (check ? 0 : 1);
} }