From cd1ef027c2eecef202d1b320304524dc11aa07f9 Mon Sep 17 00:00:00 2001 From: "William A. Rowe Jr" Date: Sat, 20 Jan 2001 21:42:23 +0000 Subject: [PATCH] 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 --- modules/arch/win32/mod_isapi.c | 3 +- modules/cache/mod_file_cache.c | 50 ++++----------------- modules/dav/fs/lock.c | 6 +-- modules/dav/fs/repos.c | 12 ++--- modules/filters/mod_include.c | 10 ++--- modules/generators/mod_cgi.c | 13 +++--- modules/http/http_request.c | 16 ++++--- modules/mappers/mod_negotiation.c | 3 +- modules/mappers/mod_rewrite.c | 31 ++++++++----- modules/mappers/mod_userdir.c | 3 +- modules/proxy/proxy_util.c | 2 +- os/unix/unixd.c | 3 +- os/win32/mod_isapi.c | 3 +- server/config.c | 2 +- server/log.c | 3 +- server/mpm/beos/beos.c | 4 +- server/mpm/dexter/dexter.c | 4 +- server/mpm/experimental/perchild/perchild.c | 4 +- server/mpm/mpmt_beos/mpmt_beos.c | 4 +- server/mpm/mpmt_pthread/mpmt_pthread.c | 4 +- server/mpm/perchild/perchild.c | 4 +- server/mpm/prefork/prefork.c | 4 +- server/mpm/spmt_os2/spmt_os2.c | 4 +- server/mpm/winnt/mpm_winnt.c | 4 +- server/util.c | 6 +-- support/ab.c | 6 +-- support/htpasswd.c | 2 +- 27 files changed, 98 insertions(+), 112 deletions(-) diff --git a/modules/arch/win32/mod_isapi.c b/modules/arch/win32/mod_isapi.c index 543fff835f..b2a551b33a 100644 --- a/modules/arch/win32/mod_isapi.c +++ b/modules/arch/win32/mod_isapi.c @@ -1238,7 +1238,8 @@ static const char *isapi_cmd_cachefile(cmd_parms *cmd, void *dummy, char *fspec; 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, "ISAPI: unable to stat(%s), skipping", filename); return NULL; diff --git a/modules/cache/mod_file_cache.c b/modules/cache/mod_file_cache.c index ed78b65473..cb815d82a2 100644 --- a/modules/cache/mod_file_cache.c +++ b/modules/cache/mod_file_cache.c @@ -157,39 +157,6 @@ static void *create_server_config(apr_pool_t *p, server_rec *s) 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) { a_server_config *sconf = sconfv; @@ -219,8 +186,8 @@ static const char *cachefile(cmd_parms *cmd, void *dummy, const char *filename) { /* ToDo: * 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 - * implemened on Windows 9X because TransmitFile is not available. + * defined in an Apache for Windows build, but apr_sendfile returns + * APR_ENOTIMPL on Windows 9X because TransmitFile is not available. */ #if APR_HAS_SENDFILE @@ -232,7 +199,9 @@ static const char *cachefile(cmd_parms *cmd, void *dummy, const char *filename) /* canonicalize the file name? */ /* 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, "mod_file_cache: unable to stat(%s), skipping", filename); return NULL; @@ -243,11 +212,7 @@ static const char *cachefile(cmd_parms *cmd, void *dummy, const char *filename) return NULL; } - /* Note: open_file should call apr_open for Unix and CreateFile for Windows. - * 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); + rc = apr_open(&fd, filename, APR_READ | APR_XTHREAD, APR_OS_DEFAULT, cmd->pool); if (rc != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_WARNING, rc, cmd->server, "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; 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, "mod_file_cache: unable to stat(%s), skipping", filename); return NULL; diff --git a/modules/dav/fs/lock.c b/modules/dav/fs/lock.c index f04267ddae..66b73cffce 100644 --- a/modules/dav/fs/lock.c +++ b/modules/dav/fs/lock.c @@ -446,7 +446,7 @@ static dav_datum dav_fs_build_key(apr_pool_t *p, const dav_resource *resource) apr_finfo_t finfo; /* ### 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? */ 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; /* 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) { /* ### push a higher-level description? */ return err; @@ -833,7 +833,7 @@ static dav_error * dav_fs_load_locknull_list(apr_pool_t *p, const char *dirpath, 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, apr_psprintf(p, "Opened but could not stat file %s", diff --git a/modules/dav/fs/repos.c b/modules/dav/fs/repos.c index f9ac747ff3..120efbc9be 100644 --- a/modules/dav/fs/repos.c +++ b/modules/dav/fs/repos.c @@ -427,7 +427,7 @@ static dav_error * dav_fs_copymove_state( src = apr_pstrcat(p, src_dir, "/" DAV_FS_STATE_DIR "/", src_file, NULL); /* 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; } @@ -447,7 +447,7 @@ static dav_error * dav_fs_copymove_state( } /* 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? */ /* ### use something besides 500? */ 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; } - 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; } @@ -1138,7 +1139,7 @@ static dav_error * dav_fs_move_resource( * so try it */ 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) { 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) */ 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? */ /* ### should have a better error here */ err = dav_new_error(pool, HTTP_NOT_FOUND, 0, NULL); diff --git a/modules/filters/mod_include.c b/modules/filters/mod_include.c index d6be156382..eae9f798b6 100644 --- a/modules/filters/mod_include.c +++ b/modules/filters/mod_include.c @@ -1268,6 +1268,7 @@ static int find_file(request_rec *r, const char *directive, const char *tag, request_rec *rr = NULL; int ret=0; char *error_fmt = NULL; + apr_status_t rv = APR_SUCCESS; if (!strcmp(tag, "file")) { /* 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) { 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\" " "in parsed file %s"; } @@ -1297,10 +1299,8 @@ static int find_file(request_rec *r, const char *directive, const char *tag, if (error_fmt) { ret = -1; - /* TODO: pass APLOG_NOERRNO if no apr_stat() failure; pass rv from apr_stat() - * otherwise - */ - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, error_fmt, to_send, r->filename); + ap_log_rerror(APLOG_MARK, APLOG_ERR | (rv ? 0 : APLOG_NOERRNO), + rv, r, error_fmt, to_send, r->filename); } if (rr) ap_destroy_sub_req(rr); diff --git a/modules/generators/mod_cgi.c b/modules/generators/mod_cgi.c index 8ce1e8811b..aaf4d10dc1 100644 --- a/modules/generators/mod_cgi.c +++ b/modules/generators/mod_cgi.c @@ -194,10 +194,12 @@ static int log_scripterror(request_rec *r, cgi_server_conf * conf, int ret, "%s: %s", error, r->filename); 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)) || (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; } @@ -244,7 +246,8 @@ static int log_script(request_rec *r, cgi_server_conf * conf, int ret, char time_str[APR_CTIME_LEN]; 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)) || (apr_open(&f, ap_server_root_relative(r->pool, conf->logname), 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; newfile = apr_pstrcat(r->pool, r->filename, ".EXE", NULL); - if (((rv = apr_stat(&finfo, newfile, r->pool)) != APR_SUCCESS) || - (finfo.filetype != APR_REG)) { + if (((rv = apr_stat(&finfo, newfile, APR_FINFO_TYPE, r->pool)) + != APR_SUCCESS) || (finfo.filetype != APR_REG)) { return log_scripterror(r, conf, HTTP_NOT_FOUND, rv, "script not found or unable to stat"); } else { diff --git a/modules/http/http_request.c b/modules/http/http_request.c index 528e608086..f8a69f8409 100644 --- a/modules/http/http_request.c +++ b/modules/http/http_request.c @@ -176,7 +176,7 @@ static int check_symlinks(char *d, int opts, apr_pool_t *p) else lastp = NULL; - res = apr_lstat(&lfi, d, p); + res = apr_lstat(&lfi, d, APR_FINFO_NORM, p); if (lastp) *lastp = '/'; @@ -194,10 +194,11 @@ static int check_symlinks(char *d, int opts, apr_pool_t *p) if (!(opts & OPT_SYM_OWNER)) 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 (fi.user == lfi.user) ? OK : HTTP_FORBIDDEN; + return ((fi.valid & lfi.valid & APR_FINFO_OWNER) + && (fi.user == lfi.user)) ? OK : HTTP_FORBIDDEN; #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 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) *cp = '/'; @@ -283,8 +284,8 @@ static int get_path_info(request_rec *r) * argument starts with the component after that. */ if (r->finfo.filetype == APR_DIR && last_cp) { - r->finfo.protection = 0; /* No such file... */ - r->finfo.filetype = APR_NOFILE; /* No such file... */ + r->finfo.protection = 0; /* XXX: Wrong test for no such file... */ + r->finfo.filetype = APR_NOFILE; /* No such file... */ 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); 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; } diff --git a/modules/mappers/mod_negotiation.c b/modules/mappers/mod_negotiation.c index 0c76b1ae25..b7036b7de6 100644 --- a/modules/mappers/mod_negotiation.c +++ b/modules/mappers/mod_negotiation.c @@ -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, 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 */ variant->bytes = (float) statb.size; } diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 5236a99693..222f07c466 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -497,7 +497,8 @@ static const char *cmd_rewritemap(cmd_parms *cmd, void *dconf, const char *a1, newmap->fpout = NULL; 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, "RewriteMap: map file or program not found:", newmap->checkfile, NULL); @@ -2119,14 +2120,14 @@ static int apply_rewrite_cond(request_rec *r, rewritecond_entry *p, rc = 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) { rc = 1; } } } 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) { rc = 1; } @@ -2134,7 +2135,7 @@ static int apply_rewrite_cond(request_rec *r, rewritecond_entry *p, } else if (strcmp(p->pattern, "-l") == 0) { #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) { rc = 1; } @@ -2142,7 +2143,7 @@ static int apply_rewrite_cond(request_rec *r, rewritecond_entry *p, #endif } 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) { 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 */ if (rsub->status < 300 && /* 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; } @@ -2661,7 +2663,8 @@ static char *lookup_map(request_rec *r, char *name, char *key) s = &entries[i]; if (strcmp(s->name, name) == 0) { 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, "mod_rewrite: can't access text RewriteMap " "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) { #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, "mod_rewrite: can't access DBM RewriteMap " "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) { - 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, "mod_rewrite: can't access text RewriteMap " "file %s", s->checkfile); @@ -3596,7 +3601,8 @@ static char *lookup_variable(request_rec *r, char *var) } } 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) { result = pw->pw_name; } @@ -3611,7 +3617,8 @@ static char *lookup_variable(request_rec *r, char *var) } } 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) { 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) { *cp = '\0'; } - if (apr_stat(sb, curpath, NULL) == 0) { + if (apr_stat(sb, curpath, APR_FINFO_NORM, NULL) == APR_SUCCESS) { return 1; } else { diff --git a/modules/mappers/mod_userdir.c b/modules/mappers/mod_userdir.c index 06ce5e2f89..76845020aa 100644 --- a/modules/mappers/mod_userdir.c +++ b/modules/mappers/mod_userdir.c @@ -344,7 +344,8 @@ static int translate_userdir(request_rec *r) * used, for example, to run a CGI script for the user. */ 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); /* when statbuf contains info on r->filename we can save a syscall * by copying it to r->finfo diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index 5e2d1ae28c..8060f62fb4 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -1271,7 +1271,7 @@ int ap_proxy_cache_send(request_rec *r, ap_cache_el *c) len = 2; apr_send(fp, CRLF, &len); /* 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)) return HTTP_INTERNAL_SERVER_ERROR; return OK; diff --git a/os/unix/unixd.c b/os/unix/unixd.c index dc2eb2def2..3c13dd4e3e 100644 --- a/os/unix/unixd.c +++ b/os/unix/unixd.c @@ -230,7 +230,8 @@ void unixd_pre_config(apr_pool_t *ptemp) /* Check for suexec */ 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; } diff --git a/os/win32/mod_isapi.c b/os/win32/mod_isapi.c index 543fff835f..b2a551b33a 100644 --- a/os/win32/mod_isapi.c +++ b/os/win32/mod_isapi.c @@ -1238,7 +1238,8 @@ static const char *isapi_cmd_cachefile(cmd_parms *cmd, void *dummy, char *fspec; 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, "ISAPI: unable to stat(%s), skipping", filename); return NULL; diff --git a/server/config.c b/server/config.c index 2fe8fca10a..290f966cc6 100644 --- a/server/config.c +++ b/server/config.c @@ -1284,7 +1284,7 @@ void ap_process_resource_config(server_rec *s, const char *fname, if ((ap_server_pre_read_config->nelts || ap_server_post_read_config->nelts) && !(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; } diff --git a/server/log.c b/server/log.c index 8fe8b89ad3..24751d570c 100644 --- a/server/log.c +++ b/server/log.c @@ -520,7 +520,8 @@ void ap_log_pid(apr_pool_t *p, const char *fname) fname = ap_server_root_relative(p, fname); 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. * Only warn on first time through for this pid. * diff --git a/server/mpm/beos/beos.c b/server/mpm/beos/beos.c index cbd607c44b..efd1f735d3 100644 --- a/server/mpm/beos/beos.c +++ b/server/mpm/beos/beos.c @@ -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); - if ((apr_stat(&finfo, fname, cmd->pool) != APR_SUCCESS) || - (finfo.filetype != APR_DIR)) { + if ((apr_stat(&finfo, fname, APR_FINFO_NORM, cmd->pool) != APR_SUCCESS) + || (finfo.filetype != APR_DIR)) { return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, " does not exist or is not a directory", NULL); } diff --git a/server/mpm/dexter/dexter.c b/server/mpm/dexter/dexter.c index c4b035eee7..be77322504 100644 --- a/server/mpm/dexter/dexter.c +++ b/server/mpm/dexter/dexter.c @@ -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); - if ((apr_stat(&finfo, fname, cmd->pool) != APR_SUCCESS) || - (finfo.filetype != APR_DIR)) { + if ((apr_stat(&finfo, fname, APR_FINFO_NORM, cmd->pool) != APR_SUCCESS) + || (finfo.filetype != APR_DIR)) { return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, " does not exist or is not a directory", NULL); } diff --git a/server/mpm/experimental/perchild/perchild.c b/server/mpm/experimental/perchild/perchild.c index c9dd28a850..10932bc8e0 100644 --- a/server/mpm/experimental/perchild/perchild.c +++ b/server/mpm/experimental/perchild/perchild.c @@ -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); - if ((apr_stat(&finfo, fname, cmd->pool) != APR_SUCCESS) || - (finfo.filetype != APR_DIR)) { + if ((apr_stat(&finfo, fname, cmd->pool) != APR_SUCCESS) + || (finfo.filetype != APR_DIR)) { return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, " does not exist or is not a directory", NULL); } diff --git a/server/mpm/mpmt_beos/mpmt_beos.c b/server/mpm/mpmt_beos/mpmt_beos.c index c2cb11d4b9..618ec8a990 100644 --- a/server/mpm/mpmt_beos/mpmt_beos.c +++ b/server/mpm/mpmt_beos/mpmt_beos.c @@ -1015,8 +1015,8 @@ static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, char *arg) } fname = ap_server_root_relative(cmd->pool, arg); - if ((apr_stat(&finfo, fname, cmd->pool) != APR_SUCCESS) || - (finfo.filetype != APR_DIR)) { + if ((apr_stat(&finfo, fname, APR_FINFO_NORM, cmd->pool) != APR_SUCCESS) + || (finfo.filetype != APR_DIR)) { return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, " does not exist or is not a directory", NULL); } diff --git a/server/mpm/mpmt_pthread/mpmt_pthread.c b/server/mpm/mpmt_pthread/mpmt_pthread.c index 4b8a92ddc8..19a234eb97 100644 --- a/server/mpm/mpmt_pthread/mpmt_pthread.c +++ b/server/mpm/mpmt_pthread/mpmt_pthread.c @@ -1364,8 +1364,8 @@ static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, } fname = ap_server_root_relative(cmd->pool, arg); - if ((apr_stat(&finfo, fname, cmd->pool) != APR_SUCCESS) || - (finfo.filetype != APR_DIR)) { + if ((apr_stat(&finfo, fname, APR_FINFO_NORM, cmd->pool) != APR_SUCCESS) + || (finfo.filetype != APR_DIR)) { return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, " does not exist or is not a directory", NULL); } diff --git a/server/mpm/perchild/perchild.c b/server/mpm/perchild/perchild.c index c9dd28a850..10932bc8e0 100644 --- a/server/mpm/perchild/perchild.c +++ b/server/mpm/perchild/perchild.c @@ -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); - if ((apr_stat(&finfo, fname, cmd->pool) != APR_SUCCESS) || - (finfo.filetype != APR_DIR)) { + if ((apr_stat(&finfo, fname, cmd->pool) != APR_SUCCESS) + || (finfo.filetype != APR_DIR)) { return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, " does not exist or is not a directory", NULL); } diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index caf41e169d..eb1968482b 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -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); - if ((apr_stat(&finfo, fname, cmd->pool) != APR_SUCCESS) || - (finfo.filetype != APR_DIR)) { + if ((apr_stat(&finfo, fname, APR_FINFO_NORM, cmd->pool) != APR_SUCCESS) + || (finfo.filetype != APR_DIR)) { return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, " does not exist or is not a directory", NULL); } diff --git a/server/mpm/spmt_os2/spmt_os2.c b/server/mpm/spmt_os2/spmt_os2.c index 84f8a77b76..1c5cfaf32d 100644 --- a/server/mpm/spmt_os2/spmt_os2.c +++ b/server/mpm/spmt_os2/spmt_os2.c @@ -1496,8 +1496,8 @@ static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, char *arg) } fname = ap_server_root_relative(cmd->pool, arg); - if ((apr_stat(&finfo, fname, cmd->pool) != APR_SUCCESS) || - (finfo.filetype != APR_DIR)) { + if ((apr_stat(&finfo, fname, APR_FINFO_NORM, cmd->pool) != APR_SUCCESS) + || (finfo.filetype != APR_DIR)) { return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, " does not exist or is not a directory", NULL); } diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c index 43502a440e..cd31219080 100644 --- a/server/mpm/winnt/mpm_winnt.c +++ b/server/mpm/winnt/mpm_winnt.c @@ -2299,8 +2299,8 @@ static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, char *arg) } fname = ap_server_root_relative(cmd->pool, arg); - if ((apr_stat(&finfo, fname, cmd->pool) != APR_SUCCESS) || - (finfo.filetype != APR_DIR)) { + if ((apr_stat(&finfo, fname, APR_FINFO_NORM, cmd->pool) != APR_SUCCESS) + || (finfo.filetype != APR_DIR)) { return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname, " does not exist or is not a directory", NULL); } diff --git a/server/util.c b/server/util.c index 891e3112ed..fd5a82de40 100644 --- a/server/util.c +++ b/server/util.c @@ -895,7 +895,7 @@ AP_DECLARE(apr_status_t) ap_pcfg_openfile(configfile_t **ret_cfg, apr_pool_t *p, if (status != APR_SUCCESS) return status; - status = apr_getfileinfo(&finfo, file); + status = apr_getfileinfo(&finfo, APR_FINFO_NORM, file); if (status != APR_SUCCESS) return status; @@ -1679,7 +1679,7 @@ AP_DECLARE(int) ap_is_directory(apr_pool_t *p, const char *path) { 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 (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; - 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 (finfo.filetype == APR_DIR); diff --git a/support/ab.c b/support/ab.c index d1924709f9..723f7a2a90 100644 --- a/support/ab.c +++ b/support/ab.c @@ -903,14 +903,14 @@ static void test(void) static void copyright(void) { 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) 1998-2000 The Apache Software Foundation, http://www.apache.org/\n"); printf("\n"); } else { printf("

\n"); - printf(" This is ApacheBench, Version %s <%s> apache-2.0
\n", AB_VERSION, "$Revision: 1.52 $"); + printf(" This is ApacheBench, Version %s <%s> apache-2.0
\n", AB_VERSION, "$Revision: 1.53 $"); 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("

\n

\n"); @@ -1002,7 +1002,7 @@ static int open_postfile(const char *pfile) return rv; } - apr_getfileinfo(&finfo, postfd); + apr_getfileinfo(&finfo, APR_FINFO_NORM, postfd); postlen = finfo.size; postdata = (char *)malloc(postlen); if (!postdata) { diff --git a/support/htpasswd.c b/support/htpasswd.c index e9eeefab00..ea79e83372 100644 --- a/support/htpasswd.c +++ b/support/htpasswd.c @@ -357,7 +357,7 @@ static int exists(char *fname) apr_finfo_t sbuf; apr_status_t check; - check = apr_stat(&sbuf, fname, NULL); + check = apr_stat(&sbuf, fname, APR_FINFO_NORM, NULL); return (check ? 0 : 1); } -- 2.40.0