Changes with Apache 2.0b1
+ *) Modify the apr_stat/lstat/getfileinfo calls within apache to use
+ the most optimal APR_FINFO_wanted bits. This spares Win32 from
+ performing very expensive owner, group and permission lookups
+ and allows the server to function until these apr_finfo_t fields
+ are implemented under Win32. [William Rowe]
+
*) Support for typedsafe optional functions - that is functions exported by
optional modules, which, therefore, may or may not be present, depending
on configuration. See the experimental modules mod_optional_fn_{ex,im}port
fspec = ap_os_case_canonical_filename(cmd->pool, filename);
if (apr_stat(&tmp, fspec,
- APR_FINFO_NORM, cmd->temp_pool) != APR_SUCCESS) {
+ APR_FINFO_TYPE, cmd->temp_pool) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, cmd->server,
"ISAPI: unable to stat(%s), skipping", filename);
return NULL;
/* canonicalize the file name? */
/* os_canonical... */
/* XXX: uh... yea, or expect them to be -very- accurate typists */
- if ((rc = apr_stat(&tmp.finfo, filename, APR_FINFO_NORM,
+ if ((rc = apr_stat(&tmp.finfo, filename, APR_FINFO_MIN,
cmd->temp_pool)) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_WARNING, rc, cmd->server,
"mod_file_cache: unable to stat(%s), skipping", filename);
const char *fspec;
fspec = ap_os_case_canonical_filename(cmd->pool, filename);
- if ((rc = apr_stat(&tmp.finfo, fspec, APR_FINFO_NORM,
+ if ((rc = apr_stat(&tmp.finfo, fspec, APR_FINFO_MIN,
cmd->temp_pool)) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_WARNING, rc, cmd->server,
"mod_file_cache: unable to stat(%s), skipping", filename);
else
lastp = NULL;
- res = apr_lstat(&lfi, d, APR_FINFO_NORM, p);
+ res = apr_lstat(&lfi, d, APR_FINFO_TYPE | APR_FINFO_OWNER, p);
if (lastp)
*lastp = '/';
* the like may cons up a way to run the transaction anyway)...
*/
- if ((res != APR_SUCCESS) || lfi.filetype != APR_LNK)
+ if ((res != APR_SUCCESS && res != APR_INCOMPLETE)
+ || (lfi.filetype != APR_LNK))
return OK;
/* OK, it's a symlink. May still be OK with OPT_SYM_OWNER */
if (!(opts & OPT_SYM_OWNER))
return HTTP_FORBIDDEN;
- if (apr_stat(&fi, d, APR_FINFO_NORM, p) != APR_SUCCESS)
+ /* OPT_SYM_OWNER only works if we can get the owner from the file */
+
+ if (res != APR_SUCCESS)
+ return HTTP_FORBIDDEN;
+
+ if (apr_stat(&fi, d, APR_FINFO_OWNER, p) != APR_SUCCESS)
return HTTP_FORBIDDEN;
- return ((fi.valid & lfi.valid & APR_FINFO_OWNER)
- && (fi.user == lfi.user)) ? OK : HTTP_FORBIDDEN;
+ /* TODO: replace with an apr_compare_users() fn */
+ return (fi.user == lfi.user) ? OK : HTTP_FORBIDDEN;
#endif
}
if (cp != end)
*cp = '/';
- if (rv == APR_SUCCESS) {
+ if (rv == APR_SUCCESS || rv == APR_INCOMPLETE) {
/*
* Aha! Found something. If it was a directory, we will search
* contents of that directory for a multi_match, so the PATH_INFO
*cp = '\0';
return OK;
}
-
- if (APR_STATUS_IS_ENOENT(rv) || APR_STATUS_IS_ENOTDIR(rv)) {
+ else if (APR_STATUS_IS_ENOENT(rv) || APR_STATUS_IS_ENOTDIR(rv)) {
last_cp = cp;
while (--cp > path && *cp != '/')
if (ap_strchr_c(new_file, '/') == NULL) {
char *udir = ap_make_dirstr_parent(rnew->pool, r->uri);
+ apr_status_t rv;
rnew->uri = ap_make_full_path(rnew->pool, udir, 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,
- APR_FINFO_NORM, rnew->pool) != APR_SUCCESS) {
+ if (((rv = apr_stat(&rnew->finfo, rnew->filename,
+ APR_FINFO_NORM, rnew->pool)) != APR_SUCCESS)
+ && (rv != APR_INCOMPLETE)) {
rnew->finfo.protection = 0;
}
variant->file_name);
if (apr_stat(&statb, fullname,
- APR_FINFO_NORM, neg->pool) == APR_SUCCESS) {
+ APR_FINFO_SIZE, neg->pool) == APR_SUCCESS) {
/* Note, precision may be lost */
variant->bytes = (float) statb.size;
}
fspec = ap_os_case_canonical_filename(cmd->pool, filename);
if (apr_stat(&tmp, fspec,
- APR_FINFO_NORM, cmd->temp_pool) != APR_SUCCESS) {
+ APR_FINFO_TYPE, cmd->temp_pool) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_WARNING, errno, cmd->server,
"ISAPI: unable to stat(%s), skipping", filename);
return NULL;
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, APR_FINFO_NORM, p) != APR_SUCCESS)
+ if (apr_lstat(&finfo, fname, APR_FINFO_TYPE, p) != APR_SUCCESS)
return;
}
/*
* here we want to check if the candidate file is really a
* directory, and most definitely NOT a symlink (to prevent
- * horrible loops). If so, let's recurse and toss it back into
- * the function.
+ * horrible loops). So we do so above using apr_lstat.
+ * If so, let's recurse and toss it back into the function.
*/
- if (ap_is_rdirectory(ptemp, fname)) {
+ if (finfo.filetype == APR_DIR) {
apr_dir_t *dirp;
apr_finfo_t dirent;
int current;
fname = ap_server_root_relative(p, fname);
mypid = getpid();
if (mypid != saved_pid
- && apr_stat(&finfo, fname, APR_FINFO_NORM, p) == APR_SUCCESS) {
+ && apr_stat(&finfo, fname, APR_FINFO_MTIME, p) == APR_SUCCESS) {
/* WINCH and HUP call this on each restart.
* Only warn on first time through for this pid.
*
}
fname = ap_server_root_relative(cmd->pool, arg);
- if ((apr_stat(&finfo, fname, APR_FINFO_NORM, cmd->pool) != APR_SUCCESS)
+ if ((apr_stat(&finfo, fname, APR_FINFO_TYPE, cmd->pool) != APR_SUCCESS)
|| (finfo.filetype != APR_DIR)) {
return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname,
" does not exist or is not a directory", NULL);
}
fname = ap_server_root_relative(cmd->pool, arg);
- if ((apr_stat(&finfo, fname, APR_FINFO_NORM, cmd->pool) != APR_SUCCESS)
+ if ((apr_stat(&finfo, fname, APR_FINFO_TYPE, cmd->pool) != APR_SUCCESS)
|| (finfo.filetype != APR_DIR)) {
return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname,
" does not exist or is not a directory", NULL);
}
fname = ap_server_root_relative(cmd->pool, arg);
- if ((apr_stat(&finfo, fname, APR_FINFO_NORM, cmd->pool) != APR_SUCCESS)
+ if ((apr_stat(&finfo, fname, APR_FINFO_TYPE, cmd->pool) != APR_SUCCESS)
|| (finfo.filetype != APR_DIR)) {
return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname,
" does not exist or is not a directory", NULL);
}
fname = ap_server_root_relative(cmd->pool, arg);
- if ((apr_stat(&finfo, fname, APR_FINFO_NORM, cmd->pool) != APR_SUCCESS)
+ if ((apr_stat(&finfo, fname, APR_FINFO_TYPE, cmd->pool) != APR_SUCCESS)
|| (finfo.filetype != APR_DIR)) {
return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname,
" does not exist or is not a directory", NULL);
}
fname = ap_server_root_relative(cmd->pool, arg);
- if ((apr_stat(&finfo, fname, APR_FINFO_NORM, cmd->pool) != APR_SUCCESS)
+ if ((apr_stat(&finfo, fname, APR_FINFO_TYPE, cmd->pool) != APR_SUCCESS)
|| (finfo.filetype != APR_DIR)) {
return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname,
" does not exist or is not a directory", NULL);
}
fname = ap_server_root_relative(cmd->pool, arg);
- if ((apr_stat(&finfo, fname, APR_FINFO_NORM, cmd->pool) != APR_SUCCESS)
+ if ((apr_stat(&finfo, fname, APR_FINFO_TYPE, cmd->pool) != APR_SUCCESS)
|| (finfo.filetype != APR_DIR)) {
return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname,
" does not exist or is not a directory", NULL);
}
fname = ap_server_root_relative(cmd->pool, arg);
- if ((apr_stat(&finfo, fname, APR_FINFO_NORM, cmd->pool) != APR_SUCCESS)
+ if ((apr_stat(&finfo, fname, APR_FINFO_TYPE, cmd->pool) != APR_SUCCESS)
|| (finfo.filetype != APR_DIR)) {
return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname,
" does not exist or is not a directory", NULL);
if (status != APR_SUCCESS)
return status;
- status = apr_getfileinfo(&finfo, APR_FINFO_NORM, file);
+ status = apr_getfileinfo(&finfo, APR_FINFO_TYPE, file);
if (status != APR_SUCCESS)
return status;
{
apr_finfo_t finfo;
- if (apr_stat(&finfo, path, APR_FINFO_NORM, p) != APR_SUCCESS)
+ if (apr_stat(&finfo, path, APR_FINFO_TYPE, p) != APR_SUCCESS)
return 0; /* in error condition, just return no */
return (finfo.filetype == APR_DIR);
{
apr_finfo_t finfo;
- if (apr_lstat(&finfo, path, APR_FINFO_NORM, p) != APR_SUCCESS)
+ if (apr_lstat(&finfo, path, APR_FINFO_TYPE, p) != APR_SUCCESS)
return 0; /* in error condition, just return no */
return (finfo.filetype == APR_DIR);