From edffd9f41077a677111f2a15a33abb18dc86a4a9 Mon Sep 17 00:00:00 2001 From: robs Date: Sat, 21 Sep 2002 03:25:56 +0000 Subject: [PATCH] *) Eliminate need for dummy files for external servers under Apache2 *) Fix auth compatibility mode handling for access checker and authorizer --- CHANGES | 6 ++++- mod_fastcgi.c | 75 +++++++++++++++++++++++++++++++---------------------------- 2 files changed, 44 insertions(+), 37 deletions(-) diff --git a/CHANGES b/CHANGES index 958f40c..4b0819c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,8 @@ -2.2.13 +2.2.13 + + *) Eliminate need for dummy files for external servers under Apache2 + + *) Fix auth compatibility mode handling for access checker and authorizer *) Fix HEAD request handling. Based on a patch by Chris Lightfoot [chris@ex-parrot.com] diff --git a/mod_fastcgi.c b/mod_fastcgi.c index 25be340..bc30f7b 100644 --- a/mod_fastcgi.c +++ b/mod_fastcgi.c @@ -3,7 +3,7 @@ * * Apache server module for FastCGI. * - * $Id: mod_fastcgi.c,v 1.137 2002/09/04 03:23:33 robs Exp $ + * $Id: mod_fastcgi.c,v 1.138 2002/09/21 03:25:56 robs Exp $ * * Copyright (c) 1995-1996 Open Market, Inc. * @@ -2305,40 +2305,51 @@ static int do_work(request_rec * const r, fcgi_request * const fr) return rv; } -static fcgi_request *create_fcgi_request(request_rec * const r, const char *fs_path) +static fcgi_request *create_fcgi_request(request_rec * const r, const char *path) { - struct stat *my_finfo; + const char *fs_path; pool * const p = r->pool; fcgi_server *fs; fcgi_request * const fr = (fcgi_request *)ap_pcalloc(p, sizeof(fcgi_request)); -#ifndef APACHE2 - if (fs_path) + fs_path = path ? path : r->filename; + + fs = fcgi_util_fs_get_by_id(fs_path, fcgi_util_get_server_uid(r->server), + fcgi_util_get_server_gid(r->server)); + if (fs == NULL) { -#endif - my_finfo = (struct stat *)ap_palloc(p, sizeof(struct stat)); - if (stat(fs_path, my_finfo) < 0) { - ap_log_rerror(FCGI_LOG_ERR_ERRNO, r, - "FastCGI: stat() of \"%s\" failed", fs_path); - return NULL; - } + const char * err; + struct stat *my_finfo; + + /* dynamic? */ + #ifndef APACHE2 - } - else { - my_finfo = &r->finfo; - fs_path = r->filename; - } + if (path == NULL) + { + /* AP2: its bogus that we don't make use of r->finfo, but + * its an apr_finfo_t and there is no apr_os_finfo_get() */ + + my_finfo = &r->finfo; + } + else #endif + { + my_finfo = (struct stat *) ap_palloc(p, sizeof(struct stat)); + + if (stat(fs_path, my_finfo) < 0) + { + ap_log_rerror(FCGI_LOG_ERR_ERRNO, r, + "FastCGI: stat() of \"%s\" failed", fs_path); + return NULL; + } + } - fs = fcgi_util_fs_get_by_id(fs_path, fcgi_util_get_server_uid(r->server), - fcgi_util_get_server_gid(r->server)); - if (fs == NULL) { - /* Its a request for a dynamic FastCGI application */ - const char * const err = - fcgi_util_fs_is_path_ok(p, fs_path, my_finfo); + err = fcgi_util_fs_is_path_ok(p, fs_path, my_finfo); - if (err) { - ap_log_rerror(FCGI_LOG_ERR_NOERRNO, r, "FastCGI: invalid (dynamic) server \"%s\": %s", fs_path, err); + if (err) + { + ap_log_rerror(FCGI_LOG_ERR_NOERRNO, r, + "FastCGI: invalid (dynamic) server \"%s\": %s", fs_path, err); return NULL; } } @@ -2448,22 +2459,14 @@ static int content_handler(request_rec *r) int ret; #ifdef APACHE2 - if (strcmp(r->handler, "fastcgi-script")) return DECLINED; - - /* Setup a new FastCGI request */ - if ((fr = create_fcgi_request(r, r->filename)) == NULL) - return HTTP_INTERNAL_SERVER_ERROR; - -#else +#endif /* Setup a new FastCGI request */ if ((fr = create_fcgi_request(r, NULL)) == NULL) return HTTP_INTERNAL_SERVER_ERROR; -#endif - /* If its a dynamic invocation, make sure scripts are OK here */ if (fr->dynamic && !(ap_allow_options(r) & OPT_EXECCGI) && !apache_is_scriptaliased(r)) { ap_log_rerror(FCGI_LOG_ERR_NOERRNO, r, @@ -2622,7 +2625,7 @@ static int check_user_authorization(request_rec *r) fr->role = FCGI_AUTHORIZER; /* Do we need compatibility mode? */ - fr->auth_compat = (dir_config->authenticator_options & FCGI_COMPAT); + fr->auth_compat = (dir_config->authorizer_options & FCGI_COMPAT); if ((res = do_work(r, fr)) != OK) goto AuthorizationFailed; @@ -2680,7 +2683,7 @@ static int check_access(request_rec *r) fr->role = FCGI_AUTHORIZER; /* Do we need compatibility mode? */ - fr->auth_compat = (dir_config->authenticator_options & FCGI_COMPAT); + fr->auth_compat = (dir_config->access_checker_options & FCGI_COMPAT); if ((res = do_work(r, fr)) != OK) goto AccessFailed; -- 2.11.4.GIT