httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Slemko <m...@hyperreal.org>
Subject cvs commit: apache/src mod_include.c
Date Sat, 12 Jul 1997 19:46:55 GMT
marc        97/07/12 12:46:55

  Modified:    src       mod_include.c
  Log:
  Fixup of mod_include logging.  Fixes an entirely incorrect message for
  an execution failure, adds quotes around the item in the message that
  is the problem, and fixes the number of slots in the string agree with
  the number of params to the logging call.
  
  Reviewed by:	Dean Gaudet, Jim Jagielski
  PR: 797
  
  Revision  Changes    Path
  1.39      +40 -36    apache/src/mod_include.c
  
  Index: mod_include.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_include.c,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -C3 -r1.38 -r1.39
  *** mod_include.c	1997/06/29 17:38:02	1.38
  --- mod_include.c	1997/07/12 19:46:54	1.39
  ***************
  *** 462,468 ****
                var[vlen] = vtext[vtlen] = '\0';
                if (braces == 1) {
                    if (*in != '}') {
  !                     log_printf(r->server, "Invalid variable %s%s", vtext,in);
                        *next = '\0';
                        return;
                    } else
  --- 462,468 ----
                var[vlen] = vtext[vtlen] = '\0';
                if (braces == 1) {
                    if (*in != '}') {
  !                     log_printf(r->server, "Invalid variable \"%s%s\"", vtext,in);
                        *next = '\0';
                        return;
                    } else
  ***************
  *** 549,567 ****
    		char tmp[MAX_STRING_LEN+2];
    		ap_snprintf(tmp, sizeof(tmp), "/%s/", parsed_string);
    		if (parsed_string[0] == '/' || strstr(tmp, "/../") != NULL)
  ! 		    error_fmt = "unable to include file %s in parsed file %s";
    		else
    		    rr = sub_req_lookup_file (parsed_string, r);
    	    } else
    		rr = sub_req_lookup_uri (parsed_string, r);
    	    
    	    if (!error_fmt && rr->status != 200)
  ! 	        error_fmt = "unable to include %s in parsed file %s";
    
    	    if (!error_fmt && noexec && rr->content_type
    		&& (strncmp (rr->content_type, "text/", 5)))
    	        error_fmt =
  ! 		  "unable to include potential exec %s in parsed file %s";
                if (error_fmt == NULL)
                {
                    request_rec *p;
  --- 549,567 ----
    		char tmp[MAX_STRING_LEN+2];
    		ap_snprintf(tmp, sizeof(tmp), "/%s/", parsed_string);
    		if (parsed_string[0] == '/' || strstr(tmp, "/../") != NULL)
  ! 		    error_fmt = "unable to include file \"%s\" in parsed file %s";
    		else
    		    rr = sub_req_lookup_file (parsed_string, r);
    	    } else
    		rr = sub_req_lookup_uri (parsed_string, r);
    	    
    	    if (!error_fmt && rr->status != 200)
  ! 	        error_fmt = "unable to include \"%s\" in parsed file %s";
    
    	    if (!error_fmt && noexec && rr->content_type
    		&& (strncmp (rr->content_type, "text/", 5)))
    	        error_fmt =
  ! 		  "unable to include potential exec \"%s\" in parsed file %s";
                if (error_fmt == NULL)
                {
                    request_rec *p;
  ***************
  *** 569,579 ****
                    for (p=r; p != NULL; p=p->main)
                        if (strcmp(p->filename, rr->filename) == 0) break;
                    if (p != NULL)
  !                     error_fmt = "Recursive include of %s in parsed file %s";
                }
    	    
    	    if (!error_fmt && run_sub_req (rr))
  ! 	        error_fmt = "unable to include %s in parsed file %s";
    	    chdir_file(r->filename);
    		    
                if (error_fmt) {
  --- 569,579 ----
                    for (p=r; p != NULL; p=p->main)
                        if (strcmp(p->filename, rr->filename) == 0) break;
                    if (p != NULL)
  !                     error_fmt = "Recursive include of \"%s\" in parsed file %s";
                }
    	    
    	    if (!error_fmt && run_sub_req (rr))
  ! 	        error_fmt = "unable to include \"%s\" in parsed file %s";
    	    chdir_file(r->filename);
    		    
                if (error_fmt) {
  ***************
  *** 586,592 ****
            else if(!strcmp(tag,"done"))
                return 0;
            else {
  !             log_printf(r->server, "unknown parameter %s to tag include in %s",
                           tag, r->filename);
                rputs(error, r);
            }
  --- 586,592 ----
            else if(!strcmp(tag,"done"))
                return 0;
            else {
  !             log_printf(r->server, "unknown parameter \"%s\" to tag include in %s",
                           tag, r->filename);
                rputs(error, r);
            }
  ***************
  *** 701,708 ****
            if(!strcmp(tag,"cmd")) {
                parse_string(r, tag_val, parsed_string, MAX_STRING_LEN, 1);
                if(include_cmd(parsed_string, r) == -1) {
  !                 log_printf(r->server, "unknown parameter %s to tag include in %s",
  !                            tag, r->filename);
                    rputs(error, r);
                }
                /* just in case some stooge changed directories */
  --- 701,708 ----
            if(!strcmp(tag,"cmd")) {
                parse_string(r, tag_val, parsed_string, MAX_STRING_LEN, 1);
                if(include_cmd(parsed_string, r) == -1) {
  !                 log_printf(r->server, "execution failure for parameter \"%s\" to tag
exec in file %s", 
  !                 tag, r->filename);
                    rputs(error, r);
                }
                /* just in case some stooge changed directories */
  ***************
  *** 711,717 ****
            else if(!strcmp(tag,"cgi")) {
                parse_string(r, tag_val, parsed_string, MAX_STRING_LEN, 0);
                if(include_cgi(parsed_string, r) == -1) {
  !                 log_printf(r->server, "invalid CGI ref %s in %s",tag_val,file);
                    rputs(error, r);
                }
                /* grumble groan */
  --- 711,717 ----
            else if(!strcmp(tag,"cgi")) {
                parse_string(r, tag_val, parsed_string, MAX_STRING_LEN, 0);
                if(include_cgi(parsed_string, r) == -1) {
  !                 log_printf(r->server, "invalid CGI ref \"%s\" in %s",tag_val,file);
                    rputs(error, r);
                }
                /* grumble groan */
  ***************
  *** 720,726 ****
            else if(!strcmp(tag,"done"))
                return 0;
            else {
  !             log_printf(r->server, "unknown parameter %s to tag exec in %s",
                           tag, file);
                rputs(error, r);
            }
  --- 720,726 ----
            else if(!strcmp(tag,"done"))
                return 0;
            else {
  !             log_printf(r->server, "unknown parameter \"%s\" to tag exec in %s",
                           tag, file);
                rputs(error, r);
            }
  ***************
  *** 743,749 ****
            } else if(!strcmp(tag,"done"))
                return 0;
            else {
  !             log_printf(r->server, "unknown parameter %s to tag echo in %s",
                    tag, r->filename);
                rputs(error, r);
            }
  --- 743,749 ----
            } else if(!strcmp(tag,"done"))
                return 0;
            else {
  !             log_printf(r->server, "unknown parameter \"%s\" to tag echo in %s",
                    tag, r->filename);
                rputs(error, r);
            }
  ***************
  *** 814,820 ****
            else if(!strcmp(tag,"done"))
                return 0;
            else {
  !             log_printf(r->server,"unknown parameter %s to tag config in %s",
                        tag, r->filename);
                rputs(error, r);
            }
  --- 814,820 ----
            else if(!strcmp(tag,"done"))
                return 0;
            else {
  !             log_printf(r->server,"unknown parameter \"%s\" to tag config in %s",
                        tag, r->filename);
                rputs(error, r);
            }
  ***************
  *** 834,840 ****
            to_send = make_full_path (r->pool, dir, tag_val);
            if(stat(to_send,finfo) == -1) {
                log_printf(r->server,
  !                     "unable to get information about %s in parsed file %s",
                        to_send, r->filename);
                rputs(error, r);
                return -1;
  --- 834,840 ----
            to_send = make_full_path (r->pool, dir, tag_val);
            if(stat(to_send,finfo) == -1) {
                log_printf(r->server,
  !                     "unable to get information about \"%s\" in parsed file %s",
                        to_send, r->filename);
                rputs(error, r);
                return -1;
  ***************
  *** 850,856 ****
    	    return 0;
            } else {
                log_printf(r->server,
  !                     "unable to get information about %s in parsed file %s",
                        tag_val, r->filename);
                rputs(error, r);
    	    destroy_sub_req (rr);
  --- 850,856 ----
    	    return 0;
            } else {
                log_printf(r->server,
  !                     "unable to get information about \"%s\" in parsed file %s",
                        tag_val, r->filename);
                rputs(error, r);
    	    destroy_sub_req (rr);
  ***************
  *** 858,864 ****
            }
        }
        else {
  !         log_printf(r->server,"unknown parameter %s to tag %s in %s",
                    tag, directive, r->filename);
            rputs(error, r);
            return -1;
  --- 858,864 ----
            }
        }
        else {
  !         log_printf(r->server,"unknown parameter \"%s\" to tag %s in %s",
                    tag, directive, r->filename);
            rputs(error, r);
            return -1;
  ***************
  *** 932,938 ****
    
        compiled = pregcomp (r->pool, rexp, REG_EXTENDED|REG_NOSUB);
        if (compiled == NULL) {
  !         log_printf(r->server, "unable to compile pattern %s", rexp);
            return -1;
        }
        regex_error = regexec(compiled, string, 0, (regmatch_t *)NULL, 0);
  --- 932,938 ----
    
        compiled = pregcomp (r->pool, rexp, REG_EXTENDED|REG_NOSUB);
        if (compiled == NULL) {
  !         log_printf(r->server, "unable to compile pattern \"%s\"", rexp);
            return -1;
        }
        regex_error = regexec(compiled, string, 0, (regmatch_t *)NULL, 0);
  ***************
  *** 1060,1066 ****
        if ((parse = expr) == (char *)NULL) return(0);
        root = current = (struct parse_node*)NULL;
        if ((expr_pool = make_sub_pool(r->pool)) == (struct pool *)NULL) {
  !         log_printf(r->server, "out of memory", r->filename);
            rputs(error, r);
            return(0);
        }
  --- 1060,1066 ----
        if ((parse = expr) == (char *)NULL) return(0);
        root = current = (struct parse_node*)NULL;
        if ((expr_pool = make_sub_pool(r->pool)) == (struct pool *)NULL) {
  !         log_printf(r->server, "out of memory processing file %s", r->filename);
            rputs(error, r);
            return(0);
        }
  ***************
  *** 1069,1075 ****
        while (1) {
            new = (struct parse_node*)palloc(expr_pool, sizeof (struct parse_node));
            if (new == (struct parse_node*)NULL) {
  !             log_printf(r->server,"out of memory", r->filename);
                rputs(error, r);
                goto RETURN;
            }
  --- 1069,1075 ----
        while (1) {
            new = (struct parse_node*)palloc(expr_pool, sizeof (struct parse_node));
            if (new == (struct parse_node*)NULL) {
  !             log_printf(r->server,"out of memory processing file %s", r->filename);
                rputs(error, r);
                goto RETURN;
            }
  ***************
  *** 1106,1112 ****
                    break;
                  default:
                    log_printf(r->server,
  !                     "Invalid expression %s", expr, r->filename);
                    rputs(error, r);
                    goto RETURN;
                }
  --- 1106,1112 ----
                    break;
                  default:
                    log_printf(r->server,
  !                     "Invalid expression \"%s\" in file %s", expr, r->filename);
                    rputs(error, r);
                    goto RETURN;
                }
  ***************
  *** 1119,1125 ****
    #endif
                if (current == (struct parse_node*)NULL) {
                    log_printf(r->server,
  !                     "Invalid expression %s", expr, r->filename);
                    rputs(error, r);
                    goto RETURN;
                }
  --- 1119,1125 ----
    #endif
                if (current == (struct parse_node*)NULL) {
                    log_printf(r->server,
  !                     "Invalid expression \"%s\" in file %s", expr, r->filename);
                    rputs(error, r);
                    goto RETURN;
                }
  ***************
  *** 1139,1145 ****
                        break;
                      default:
                        log_printf(r->server,
  !                         "Invalid expression %s", expr, r->filename);
                        rputs(error, r);
                        goto RETURN;
                    }
  --- 1139,1145 ----
                        break;
                      default:
                        log_printf(r->server,
  !                         "Invalid expression \"%s\" in file %s", expr, r->filename);
                        rputs(error, r);
                        goto RETURN;
                    }
  ***************
  *** 1178,1184 ****
                        break;
                      default:
                        log_printf(r->server,
  !                         "Invalid expression %s", expr, r->filename);
                        rputs(error, r);
                        goto RETURN;
                    }
  --- 1178,1184 ----
                        break;
                      default:
                        log_printf(r->server,
  !                         "Invalid expression \"%s\" in file %s", expr, r->filename);
                        rputs(error, r);
                        goto RETURN;
                    }
  ***************
  *** 1204,1210 ****
    #endif
                if (current == (struct parse_node*)NULL) {
                    log_printf(r->server,
  !                     "Invalid expression %s", expr, r->filename);
                    rputs(error, r);
                    goto RETURN;
                }
  --- 1204,1210 ----
    #endif
                if (current == (struct parse_node*)NULL) {
                    log_printf(r->server,
  !                     "Invalid expression \"%s\" in file %s", expr, r->filename);
                    rputs(error, r);
                    goto RETURN;
                }
  ***************
  *** 1223,1230 ****
                      case token_eq:
                      case token_ne:
                      default:
  !                     log_printf(r->server,
  !                         "Invalid expression %s", expr, r->filename);
                        rputs(error, r);
                        goto RETURN;
                    }
  --- 1223,1231 ----
                      case token_eq:
                      case token_ne:
                      default:
  !                     log_printf(r->server, 
  !                         "Invalid expression \"%s\" in file %s", 
  !                         expr, r->filename);
                        rputs(error, r);
                        goto RETURN;
                    }
  ***************
  *** 1255,1261 ****
                    current = current->parent;
                }
                if (current == (struct parse_node*)NULL) {
  !                 log_printf(r->server,"Unmatched ')'in %s\n", expr, r->filename);
                    rputs(error, r);
                    goto RETURN;
                }
  --- 1256,1262 ----
                    current = current->parent;
                }
                if (current == (struct parse_node*)NULL) {
  !                 log_printf(r->server,"Unmatched ')' in %s", expr, r->filename);
                    rputs(error, r);
                    goto RETURN;
                }
  ***************
  *** 1283,1289 ****
                      case token_group:
                      default:
                        log_printf(r->server,
  !                         "Invalid expression %s", expr, r->filename);
                        rputs(error, r);
                        goto RETURN;
                    }
  --- 1284,1291 ----
                      case token_group:
                      default:
                        log_printf(r->server,
  !                         "Invalid expression \"%s\" in file %s", 
  ! 			expr, r->filename);
                        rputs(error, r);
                        goto RETURN;
                    }
  ***************
  *** 1330,1336 ****
                if (current->left == (struct parse_node*)NULL ||
                            current->right == (struct parse_node*)NULL) {
                    log_printf(r->server,
  !                     "Invalid expression %s", expr, r->filename);
                    rputs(error, r);
                    goto RETURN;
                }
  --- 1332,1338 ----
                if (current->left == (struct parse_node*)NULL ||
                            current->right == (struct parse_node*)NULL) {
                    log_printf(r->server,
  !                     "Invalid expression \"%s\" in file %s", expr, r->filename);
                    rputs(error, r);
                    goto RETURN;
                }
  ***************
  *** 1391,1397 ****
                            (current->left->token.type != token_string) ||
                            (current->right->token.type != token_string)) {
                    log_printf(r->server,
  !                     "Invalid expression %s", expr, r->filename);
                    rputs(error, r);
                    goto RETURN;
                }
  --- 1393,1399 ----
                            (current->left->token.type != token_string) ||
                            (current->right->token.type != token_string)) {
                    log_printf(r->server,
  !                     "Invalid expression \"%s\" in file %s", expr, r->filename);
                    rputs(error, r);
                    goto RETURN;
                }
  ***************
  *** 1409,1415 ****
                    if (current->right->token.value[len-1] == '/') {
                        current->right->token.value[len-1] = '\0';
                    } else {
  !                     log_printf(r->server,"Invalid rexp %s",
                                current->right->token.value, r->filename);
                        rputs(error, r);
                        goto RETURN;
  --- 1411,1417 ----
                    if (current->right->token.value[len-1] == '/') {
                        current->right->token.value[len-1] = '\0';
                    } else {
  !                     log_printf(r->server,"Invalid rexp \"%s\" in file %s",
                                current->right->token.value, r->filename);
                        rputs(error, r);
                        goto RETURN;
  ***************
  *** 1474,1485 ****
                break;
    
              case token_lbrace:
  !             log_printf(r->server,"Unmatched '(' in %s\n", expr, r->filename);
                rputs(error, r);
                goto RETURN;
    
              case token_rbrace:
  !             log_printf(r->server,"Unmatched ')' in %s\n", expr, r->filename);
                rputs(error, r);
                goto RETURN;
    
  --- 1476,1489 ----
                break;
    
              case token_lbrace:
  !             log_printf(r->server,"Unmatched '(' in %s in file %s", 
  ! 		expr, r->filename);
                rputs(error, r);
                goto RETURN;
    
              case token_rbrace:
  !             log_printf(r->server,"Unmatched ')' in %s in file %s\n", 
  ! 		expr, r->filename);
                rputs(error, r);
                goto RETURN;
    
  ***************
  *** 1519,1525 ****
    rvputs(r,"**** if expr=\"", expr, "\"\n", NULL);
    #endif
            } else {
  !             log_printf(r->server,"unknown parameter %s to tag if in %s",
                        tag, r->filename);
                rputs(error, r);
            }
  --- 1523,1529 ----
    rvputs(r,"**** if expr=\"", expr, "\"\n", NULL);
    #endif
            } else {
  !             log_printf(r->server,"unknown parameter \"%s\" to tag if in %s",
                        tag, r->filename);
                rputs(error, r);
            }
  ***************
  *** 1556,1562 ****
    rvputs(r,"**** if expr=\"", expr, "\"\n", NULL);
    #endif
            } else {
  !             log_printf(r->server,"unknown parameter %s to tag if in %s",
                        tag, r->filename);
                rputs(error, r);
            }
  --- 1560,1566 ----
    rvputs(r,"**** if expr=\"", expr, "\"\n", NULL);
    #endif
            } else {
  !             log_printf(r->server,"unknown parameter \"%s\" to tag if in %s",
                        tag, r->filename);
                rputs(error, r);
            }
  ***************
  *** 1748,1754 ****
    #endif
                else {
                    log_printf(r->server,
  !                         "httpd: unknown directive %s in parsed doc %s",
                            directive,r->filename);
                    if (printing) rputs(error, r);
                    ret=find_string(f,ENDING_SEQUENCE,r,0);
  --- 1752,1758 ----
    #endif
                else {
                    log_printf(r->server,
  !                         "httpd: unknown directive \"%s\" in parsed doc %s",
                            directive,r->filename);
                    if (printing) rputs(error, r);
                    ret=find_string(f,ENDING_SEQUENCE,r,0);
  
  
  

Mime
View raw message