cvs commit: apache/src mod_include.c

1997-07-12 Thread Marc Slemko
marc97/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  ChangesPath
  1.39  +40 -36apache/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);

cvs commit: apache/src mod_include.c

1997-06-28 Thread Dean Gaudet
dgaudet 97/06/28 12:49:39

  Modified:src   mod_include.c
  Log:
  PR#742: mod_include was not properly changing directory
  
  Reviewed by:  Dean, Brian
  Submitted by: Marc
  
  Revision  ChangesPath
  1.36  +2 -0  apache/src/mod_include.c
  
  Index: mod_include.c
  ===
  RCS file: /export/home/cvs/apache/src/mod_include.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -C3 -r1.35 -r1.36
  *** mod_include.c 1997/06/22 03:40:24 1.35
  --- mod_include.c 1997/06/28 19:49:38 1.36
  ***
  *** 524,529 
  --- 524,530 
}

destroy_sub_req (rr);
  + chdir_file(r-filename);

return 0;
}
  ***
  *** 571,576 
  --- 572,578 

if (!error_fmt  run_sub_req (rr))
error_fmt = unable to include %s in parsed file %s;
  + chdir_file(r-filename);

if (error_fmt) {
log_printf(r-server, error_fmt, tag_val, r-filename);
  
  
  


cvs commit: apache/src mod_include.c

1997-06-28 Thread Dean Gaudet
dgaudet 97/06/28 12:50:16

  Modified:src   Tag: APACHE_1_2_X  mod_include.c
  Log:
  PR#742: mod_include was not properly changing directory
  
  Reviewed by:  Dean, Brian
  Submitted by: Marc
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.33.2.2  +2 -0  apache/src/mod_include.c
  
  Index: mod_include.c
  ===
  RCS file: /export/home/cvs/apache/src/mod_include.c,v
  retrieving revision 1.33.2.1
  retrieving revision 1.33.2.2
  diff -C3 -r1.33.2.1 -r1.33.2.2
  *** mod_include.c 1997/06/27 02:28:55 1.33.2.1
  --- mod_include.c 1997/06/28 19:50:15 1.33.2.2
  ***
  *** 520,525 
  --- 520,526 
}

destroy_sub_req (rr);
  + chdir_file(r-filename);

return 0;
}
  ***
  *** 567,572 
  --- 568,574 

if (!error_fmt  run_sub_req (rr))
error_fmt = unable to include %s in parsed file %s;
  + chdir_file(r-filename);

if (error_fmt) {
log_printf(r-server, error_fmt, tag_val, r-filename);
  
  
  


cvs commit: apache/src mod_include.c

1997-06-04 Thread Rodent of Unusual Size
coar97/06/04 17:57:46

  Modified:src   mod_include.c
  Log:
Add in bits necessary to use -DUSE_PERL_SSI with an
sfio enabled Perl.
  
  Reviewed by:  Jim Jagielski, Rob Hartill
  Submitted by: Doug MacEachern
  
  Revision  ChangesPath
  1.33  +6 -0  apache/src/mod_include.c
  
  Index: mod_include.c
  ===
  RCS file: /export/home/cvs/apache/src/mod_include.c,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -C3 -r1.32 -r1.33
  *** mod_include.c 1997/05/29 04:23:12 1.32
  --- mod_include.c 1997/06/05 00:57:45 1.33
  ***
  *** 71,76 
  --- 71,81 
 */

#ifdef USE_PERL_SSI
  + #include config.h
  + #ifdef USE_SFIO
  + #undef USE_SFIO
  + #define USE_STDIO
  + #endif
#include modules/perl/mod_perl.h
#else
#include httpd.h
  ***
  *** 748,753 
  --- 753,759 
else if(strnEQ(tag,done, 4))
break;
}
  + perl_stdout2client(r);
perl_call_handler(sub, r, av);
return OK;
}
  
  
  


cvs commit: apache/src mod_include.c

1996-12-08 Thread Brian Behlendorf
brian   96/12/08 20:54:24

  Modified:src   mod_include.c
  Log:
  Reviewed by:  lotsa folks...
  Obtained from:  Howard Fear, Alexei Kosut
  
  1) The patch that I submitted a couple of days ago which recieved
 one +1 and fizzled.  Fixes an ommision that caused include variables
 to not be parsed in config errmsg directives.  Potential
 incompatibilites are the same as the extensions of mod_include
 generally. [Howard Fear]
  
  2) Patch submitted by Ben Yoshino [EMAIL PROTECTED]
 to allow backslash quoting of characters that would otherwise
 be taken as value terminators.  Ex:
 !--exec cmd=echo \hello, world\ --
 Potential incompatibilities only to people who carelessly throw
 around '\'s. [Howard Fear]
  
  3) Patch to fix the other part of the problem report submitted by
 Ben Yoshino [EMAIL PROTECTED].  I took that approach
 outlined in my email this morning and added a flag to parse_string
 to pass the variable name through on the exec cmd directive when
 the variable hasn't been defined.  It will still substitute a
 null value for all other directives.  It will also substitute a
 null value if the variable has been defined with a null value:
!--#if expr=$notset --   # substitutes null (if fails)
!--#exec cmd=echo '$notset' --   # echo '$notset'
!--#set var=notset value= --
!--#exec cmd=echo '$notset' --   # echo ''
 I believe that this approach minimizes the potential incompatibilties
 for current ssi and xssi users. [Howard Fear]
  
  4) Patch to fix compiler warnings reported by [EMAIL PROTECTED]
 Changes are cosmetic and shouldn't effect logic. [Howard Fear]
  
  5) Remove HAVE_POSIX_REGEX cruft [Alexei Kosut, Rasmus Lerdorf
  
  Revision  ChangesPath
  1.18  +39 -35apache/src/mod_include.c
  
  Index: mod_include.c
  ===
  RCS file: /export/home/cvs/apache/src/mod_include.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -C3 -r1.17 -r1.18
  *** mod_include.c 1996/12/01 20:29:05 1.17
  --- mod_include.c 1996/12/09 04:54:22 1.18
  ***
  *** 66,76 
#include http_log.h
#include http_main.h
#include util_script.h
  - #ifdef HAVE_POSIX_REGEX
  - #include regex.h
  - #else
  - #include regex.h
  - #endif

#define STARTING_SEQUENCE !--#
#define ENDING_SEQUENCE --
  --- 66,71 
  ***
  *** 309,315 
t[tagbuf_len - 1] = '\0';
return NULL;
}
  ! if (c == term) break;
*(t++) = c;
}
*t = '\0';
  --- 304,316 
t[tagbuf_len - 1] = '\0';
return NULL;
}
  ! /* Want to accept \ as a valid character within a string. */
  ! if (c == '\\') {
  ! *(t++) = c; /* Add backslash */
  ! GET_CHAR(in,c,NULL,p);
  ! if (c == term) /* Only if */
  ! *(--t) = c; /* Replace backslash ONLY for terminator */
  ! } else if (c == term) break;
*(t++) = c;
}
*t = '\0';
  ***
  *** 341,347 
/*
 * Do variable substitution on strings
 */
  ! void parse_string(request_rec *r, char *in, char *out, int length)
{
char ch;
char *next = out;
  --- 342,349 
/*
 * Do variable substitution on strings
 */
  ! void parse_string(request_rec *r, char *in, char *out, int length,
  !   int leave_name)
{
char ch;
char *next = out;
  ***
  *** 385,399 
in++;
} 

  - /* Leave single dollar signs like the shell does */
val = (char *)NULL;
  ! if (*var == '\0') {
  ! if (strcmp(vtext, $) == 0) {
  ! var[0]='$', var[1]='\0';
  ! val = var[0];
  ! }
  ! } else
  ! val = table_get (r-subprocess_env, var[0]); 
while ((val != (char *)NULL)  (*val != '\0')) {
*next++ = *val++;
if (++numchars == (length -1)) break;
  --- 387,400 
in++;
} 

val = (char *)NULL;
  ! if (var[0] == '\0') {
  ! val = vtext[0];
  ! } else {
  ! val = table_get (r-subprocess_env, var[0]);
  ! if (!val  leave_name)
  ! val = vtext[0];
  ! }
while ((val != (char *)NULL)  (*val != '\0')) {
*next++ = *val++;
if (++numchars == (length -1)) break;
  ***
  *** 459,465 
request_rec *rr=NULL;
char *error_fmt = NULL;

  ! parse_string(r, tag_val, parsed_string, MAX_STRING_LEN);
if (tag[0] == 'f')
{ /* be safe; 

cvs commit: apache/src mod_include.c

1996-08-06 Thread Alexei Kosut
akosut  96/08/06 17:15:06

  Modified:src   mod_include.c
  Log:
  Add XSSI functionality.
  
  Submitted by: Howard Fear
  Reviewed by: Alexei Kosut, Rob Hartill, Randy Terbush
  
  Revision  ChangesPath
  1.13  +936 -78   apache/src/mod_include.c
  
  Index: mod_include.c
  ===
  RCS file: /export/home/cvs/apache/src/mod_include.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -C3 -r1.12 -r1.13
  *** mod_include.c 1996/07/28 19:27:48 1.12
  --- mod_include.c 1996/08/07 00:15:03 1.13
  ***
  *** 68,73 
  --- 68,78 
#include http_log.h
#include http_main.h
#include util_script.h
  + #ifdef HAVE_POSIX_REGEX
  + #include regex.h
  + #else
  + #include regex.h
  + #endif

#define STARTING_SEQUENCE !--#
#define ENDING_SEQUENCE --
  ***
  *** 80,85 
  --- 85,91 
static char *get_tag(pool *p, FILE *in, char *tag, int tag_len, int 
dodecode);
static int get_directive(FILE *in, char *d, pool *p);

  + 
/*  Environment function -- 
*/

void add_include_vars(request_rec *r, char *timefmt)
  ***
  *** 99,105 
  table_set(e, USER_NAME, pw-pw_name);
} else {
  char uid[16];
  !   sprintf(uid, user#%ld, (unsigned long)r-finfo.st_uid);
  table_set(e, USER_NAME, uid);
}

  --- 105,111 
  table_set(e, USER_NAME, pw-pw_name);
} else {
  char uid[16];
  !   sprintf(uid, user#%lu, (unsigned long)r-finfo.st_uid);
  table_set(e, USER_NAME, uid);
}

  ***
  *** 118,124 
 { \
   int i = getc(f); \
   if(feof(f) || ferror(f) || (i == -1)) { \
  ! pfclose(p, f); \
return r; \
   } \
   c = (char)i; \
  --- 124,130 
 { \
   int i = getc(f); \
   if(feof(f) || ferror(f) || (i == -1)) { \
  ! pfclose(p,f); \
return r; \
   } \
   c = (char)i; \
  ***
  *** 130,136 
 * matter much, but this is an inner loop...
 */

  ! int find_string(FILE *in,char *str, request_rec *r) {
int x,l=strlen(str),p;
char c;

  --- 136,142 
 * matter much, but this is an inner loop...
 */

  ! int find_string(FILE *in,char *str, request_rec *r, int printing) {
int x,l=strlen(str),p;
char c;

  ***
  *** 145,154 
if(r) {
if(p) {
for(x=0;xp;x++) {
  ! rputc(str[x],r);
}
}
  ! rputc(c,r);
}
p=0;
}
  --- 151,160 
if(r) {
if(p) {
for(x=0;xp;x++) {
  ! if (printing) rputc(str[x],r);
}
}
  ! if (printing) rputc(c,r);
}
p=0;
}
  ***
  *** 286,292 
tag_val = t;

while (isspace(c)) GET_CHAR(in, c, NULL,p); /* space before = */
  ! if (c != '=') return NULL;

do {
GET_CHAR(in,c,NULL,p);  /* space after = */
  --- 292,301 
tag_val = t;

while (isspace(c)) GET_CHAR(in, c, NULL,p); /* space before = */
  ! if (c != '=') {
  ! ungetc(c, in);
  ! return NULL;
  ! }

do {
GET_CHAR(in,c,NULL,p);  /* space after = */
  ***
  *** 310,316 
return pstrdup (p, tag_val);
}

  - /* the pool is required to allow GET_CHAR to call pfclose */
static int
get_directive(FILE *in, char *d, pool *p) {
char c;
  --- 319,324 
  ***
  *** 332,337 
  --- 340,417 
return 0;
}

  + /*
  +  * Do variable substitution on strings
  +  */
  + void parse_string(request_rec *r, char *in, char *out, int length)
  + {
  + char ch;
  + char *next = out;
  + int numchars = 0;
  + 
  + while ((ch = *in++) != '\0') {
  + switch(ch) {
  +   case '\\':
  + *next++ = (*in != '\0') ? *in++ : '\0';
  + break;
  +   case '$':
  +   {
  + char var[MAX_STRING_LEN];
  + char vtext[MAX_STRING_LEN];
  + char *val;
  + int braces=0;
  + int vlen, vtlen;
  + /* 
  +  * Keep the $ and { around because we do no substitution
  +  * if the variable isn't found
  +  */
  + vlen = vtlen = 0;
  + vtext[vtlen++] = ch;
  + if (*in == '{') { braces = 1; vtext[vtlen++] = *in++; }
  + while (*in != '\0') {
  + if (vlen == (MAX_STRING_LEN - 1)) 

cvs commit: apache/src mod_include.c

1996-07-26 Thread Randy Terbush
randy   96/07/26 21:43:24

  Modified:src   mod_include.c
  Log:
  Fix problem where closing an invalid file descriptor causes core
  a coredump. Reported on Linux.
  Reviewed by: Randy Terbush, Howard Fear
  Submitted by: Howard Fear
  
  Revision  ChangesPath
  1.11  +1 -1  apache/src/mod_include.c
  
  Index: mod_include.c
  ===
  RCS file: /export/home/cvs/apache/src/mod_include.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -C3 -r1.10 -r1.11
  *** mod_include.c 1996/07/21 20:03:43 1.10
  --- mod_include.c 1996/07/27 04:43:22 1.11
  ***
  *** 501,507 

arg.r = r; arg.s = s;

  ! if (!spawn_child (r-connection-pool, include_cmd_child, arg,
  kill_after_timeout, NULL, f))
return -1;

  --- 501,507 

arg.r = r; arg.s = s;

  ! if (!spawn_child (r-pool, include_cmd_child, arg,
  kill_after_timeout, NULL, f))
return -1;

  
  
  


cvs commit: apache/src mod_include.c

1996-03-19 Thread Alexei Kosut
akosut  96/03/19 18:55:19

  Modified:src   mod_include.c
  Log:
  Made it so XBITHACK behavior only occurs for files of type text/html, as
  any other file type doesn't really make sense.
  
  Revision  ChangesPath
  1.5   +1 -1  apache/src/mod_include.c
  
  Index: mod_include.c
  ===
  RCS file: /export/home/cvs/apache/src/mod_include.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -C3 -r1.4 -r1.5
  *** mod_include.c 1996/03/01 02:50:54 1.4
  --- mod_include.c 1996/03/20 02:55:18 1.5
  ***
  *** 879,885 
handler_rec includes_handlers[] = {
{ INCLUDES_MAGIC_TYPE, send_parsed_file },
{ INCLUDES_MAGIC_TYPE3, send_parsed_file },
  ! { */*, xbithack_handler },
{ NULL }
};

  --- 879,885 
handler_rec includes_handlers[] = {
{ INCLUDES_MAGIC_TYPE, send_parsed_file },
{ INCLUDES_MAGIC_TYPE3, send_parsed_file },
  ! { text/html, xbithack_handler },
{ NULL }
};