httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: httpd-2.0/modules/generators mod_cgi.c mod_cgid.c
Date Wed, 03 Jan 2001 20:03:48 GMT
trawick     01/01/03 12:03:48

  Modified:    .        CHANGES
               modules/generators mod_cgi.c mod_cgid.c
  Log:
  mod_cgi: Fix some problems where the wrong error value was being traced
  (errno instead of apr_status).
  
  mod_cgid: Keep some of the code in synch with the version in mod_cgi.
  
  Revision  Changes    Path
  1.33      +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- CHANGES	2001/01/03 16:36:03	1.32
  +++ CHANGES	2001/01/03 20:03:47	1.33
  @@ -1,5 +1,8 @@
   Changes with Apache 2.0b1
   
  +  *) mod_cgi: Fix some problems where the wrong error value was being
  +     traced.  [Jeff Trawick]
  +
     *) EBCDIC: Fix some missing ASCII conversion on some protocol data.
        [Jeff Trawick]
   
  
  
  
  1.75      +20 -17    httpd-2.0/modules/generators/mod_cgi.c
  
  Index: mod_cgi.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgi.c,v
  retrieving revision 1.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- mod_cgi.c	2000/12/27 23:30:07	1.74
  +++ mod_cgi.c	2001/01/03 20:03:48	1.75
  @@ -183,14 +183,15 @@
   };
   
   static int log_scripterror(request_rec *r, cgi_server_conf * conf, int ret,
  -			   int show_errno, char *error)
  +			   apr_status_t rv, char *error)
   {
       apr_file_t *f = NULL;
       apr_finfo_t finfo;
       char time_str[APR_CTIME_LEN];
  +    int log_flags = rv ? APLOG_ERR : APLOG_NOERRNO | APLOG_ERR;
   
  -    ap_log_rerror(APLOG_MARK, show_errno|APLOG_ERR, errno, r, 
  -		"%s: %s", error, r->filename);
  +    ap_log_rerror(APLOG_MARK, log_flags, rv, r, 
  +                  "%s: %s", error, r->filename);
   
       if (!conf->logname ||
           ((apr_stat(&finfo, ap_server_root_relative(r->pool, conf->logname), r->pool)
== APR_SUCCESS)
  @@ -511,6 +512,7 @@
       int is_included = !strcmp(r->protocol, "INCLUDED");
       apr_pool_t *p;
       cgi_server_conf *conf;
  +    apr_status_t rv;
   
       p = r->main ? r->main->pool : r->pool;
   
  @@ -530,10 +532,10 @@
       conf = ap_get_module_config(r->server->module_config, &cgi_module);
   
       if (!(ap_allow_options(r) & OPT_EXECCGI) && !is_scriptaliased(r))
  -        return log_scripterror(r, conf, HTTP_FORBIDDEN, APLOG_NOERRNO,
  +        return log_scripterror(r, conf, HTTP_FORBIDDEN, 0,
                                  "Options ExecCGI is off in this directory");
       if (nph && is_included)
  -        return log_scripterror(r, conf, HTTP_FORBIDDEN, APLOG_NOERRNO,
  +        return log_scripterror(r, conf, HTTP_FORBIDDEN, 0,
                                  "attempt to include NPH CGI script");
   
   #if defined(OS2) || defined(WIN32)
  @@ -545,11 +547,12 @@
       if (r->finfo.protection == 0) {
           apr_finfo_t finfo;
           char *newfile;
  +        apr_status_t rv;
   
           newfile = apr_pstrcat(r->pool, r->filename, ".EXE", NULL);
  -        if ((apr_stat(&finfo, newfile, r->pool) != APR_SUCCESS) || 
  +        if (((rv = apr_stat(&finfo, newfile, r->pool)) != APR_SUCCESS) || 
               (finfo.filetype != APR_REG)) {
  -            return log_scripterror(r, conf, HTTP_NOT_FOUND, 0,
  +            return log_scripterror(r, conf, HTTP_NOT_FOUND, rv,
                                      "script not found or unable to stat");
           } else {
               r->filename = newfile;
  @@ -557,17 +560,17 @@
       }
   #else
       if (r->finfo.protection == 0)
  -	return log_scripterror(r, conf, HTTP_NOT_FOUND, APLOG_NOERRNO,
  +	return log_scripterror(r, conf, HTTP_NOT_FOUND, 0,
   			       "script not found or unable to stat");
   #endif
       if (r->finfo.filetype == APR_DIR)
  -	return log_scripterror(r, conf, HTTP_FORBIDDEN, APLOG_NOERRNO,
  +	return log_scripterror(r, conf, HTTP_FORBIDDEN, 0,
   			       "attempt to invoke directory as script");
   
   /*
       if (!ap_suexec_enabled) {
   	if (!ap_can_exec(&r->finfo))
  -	    return log_scripterror(r, conf, HTTP_FORBIDDEN, APLOG_NOERRNO,
  +	    return log_scripterror(r, conf, HTTP_FORBIDDEN, 0,
   				   "file permissions deny server execution");
       }
   
  @@ -578,23 +581,23 @@
       ap_add_common_vars(r);
   
       /* build the command line */
  -    if (build_command_line(&command, r, p) != APR_SUCCESS) {
  -	ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r,
  +    if ((rv = build_command_line(&command, r, p)) != APR_SUCCESS) {
  +	ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
   	      "couldn't spawn child process: %s", r->filename);
   	return HTTP_INTERNAL_SERVER_ERROR;
       }
       /* build the argument list */
  -    else if (build_argv_list(&argv, r, p) != APR_SUCCESS) {
  -	ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r,
  +    else if ((rv = build_argv_list(&argv, r, p)) != APR_SUCCESS) {
  +	ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
   		      "couldn't spawn child process: %s", r->filename);
   	return HTTP_INTERNAL_SERVER_ERROR;
       }
       argv[0] = apr_pstrdup(p, command);
   
       /* run the script in its own process */
  -    if (run_cgi_child(&script_out, &script_in, &script_err,
  -                      command, argv, r, p) != APR_SUCCESS) {
  -        ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r,
  +    if ((rv = run_cgi_child(&script_out, &script_in, &script_err,
  +                            command, argv, r, p)) != APR_SUCCESS) {
  +        ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
                         "couldn't spawn child process: %s", r->filename);
           return HTTP_INTERNAL_SERVER_ERROR;
       }
  
  
  
  1.57      +13 -24    httpd-2.0/modules/generators/mod_cgid.c
  
  Index: mod_cgid.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgid.c,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- mod_cgid.c	2001/01/02 17:57:42	1.56
  +++ mod_cgid.c	2001/01/03 20:03:48	1.57
  @@ -609,13 +609,14 @@
   }; 
   
   static int log_scripterror(request_rec *r, cgid_server_conf * conf, int ret, 
  -                           int show_errno, char *error) 
  +                           apr_status_t rv, char *error) 
   { 
       apr_file_t *f = NULL; 
       struct stat finfo; 
       char time_str[APR_CTIME_LEN];
  +    int log_flags = rv ? APLOG_ERR : APLOG_NOERRNO | APLOG_ERR;
   
  -    ap_log_rerror(APLOG_MARK, show_errno|APLOG_ERR, errno, r, 
  +    ap_log_rerror(APLOG_MARK, log_flags, rv, r, 
                   "%s: %s", error, r->filename); 
   
       if (!conf->logname || 
  @@ -765,39 +766,27 @@
           argv0 = r->filename; 
   
       if (!(ap_allow_options(r) & OPT_EXECCGI) && !is_scriptaliased(r)) 
  -        return log_scripterror(r, conf, HTTP_FORBIDDEN, APLOG_NOERRNO, 
  +        return log_scripterror(r, conf, HTTP_FORBIDDEN, 0, 
                                  "Options ExecCGI is off in this directory"); 
       if (nph && is_included) 
  -        return log_scripterror(r, conf, HTTP_FORBIDDEN, APLOG_NOERRNO, 
  +        return log_scripterror(r, conf, HTTP_FORBIDDEN, 0, 
                                  "attempt to include NPH CGI script"); 
   
  -#if defined(OS2) || defined(WIN32) 
  -    /* Allow for cgid files without the .EXE extension on them under OS/2 */ 
  -    if (r->finfo.st_mode == 0) { 
  -        struct stat statbuf; 
  -        char *newfile; 
  -
  -        newfile = apr_pstrcat(r->pool, r->filename, ".EXE", NULL); 
  -
  -        if ((stat(newfile, &statbuf) != 0) || (!S_ISREG(statbuf.st_mode))) { 
  -            return log_scripterror(r, conf, HTTP_NOT_FOUND, 0, 
  -                                   "script not found or unable to stat"); 
  -        } else { 
  -            r->filename = newfile; 
  -        } 
  -    } 
  +#if defined(OS2) || defined(WIN32)
  +#error mod_cgid does not work on this platform.  If you teach it to, look 
  +#error at mod_cgi.c for required code in this path.
   #else 
       if (r->finfo.protection == 0) 
  -        return log_scripterror(r, conf, HTTP_NOT_FOUND, APLOG_NOERRNO, 
  +        return log_scripterror(r, conf, HTTP_NOT_FOUND, 0, 
                                  "script not found or unable to stat"); 
   #endif 
       if (r->finfo.filetype == APR_DIR) 
  -        return log_scripterror(r, conf, HTTP_FORBIDDEN, APLOG_NOERRNO, 
  +        return log_scripterror(r, conf, HTTP_FORBIDDEN, 0, 
                                  "attempt to invoke directory as script"); 
   /*
       if (!ap_suexec_enabled) { 
           if (!ap_can_exec(&r->finfo)) 
  -            return log_scripterror(r, conf, HTTP_FORBIDDEN, APLOG_NOERRNO, 
  +            return log_scripterror(r, conf, HTTP_FORBIDDEN, 0, 
                                      "file permissions deny server execution"); 
       } 
   */
  @@ -806,7 +795,7 @@
       env = ap_create_environment(r->pool, r->subprocess_env); 
   
       if ((sd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
  -            return log_scripterror(r, conf, HTTP_INTERNAL_SERVER_ERROR, 0, 
  +            return log_scripterror(r, conf, HTTP_INTERNAL_SERVER_ERROR, errno, 
                                      "unable to create socket to cgi daemon");
       } 
       memset(&unix_addr, 0, sizeof(unix_addr));
  @@ -814,7 +803,7 @@
       strcpy(unix_addr.sun_path, conf->sockname);
   
       if (connect(sd, (struct sockaddr *)&unix_addr, sizeof(unix_addr)) < 0) {
  -            return log_scripterror(r, conf, HTTP_INTERNAL_SERVER_ERROR, 0, 
  +            return log_scripterror(r, conf, HTTP_INTERNAL_SERVER_ERROR, errno, 
                                      "unable to connect to cgi daemon");
       } 
   
  
  
  

Mime
View raw message