cvs commit: apachen/src/modules/proxy proxy_ftp.c proxy_util.c
jim 97/12/30 07:10:54 Modified:.STATUS src CHANGES src/ap Makefile.tmpl src/main alloc.c http_config.c http_config.h http_core.c http_main.c httpd.h util.c src/modules/proxy proxy_ftp.c proxy_util.c Added: src/ap ap_cpystrn.c Log: Submitted by: Jim Jagielski Reviewed by: Dean Gaudet, Dirk-Willem van Gulik, Ken Coar Idea by:Martin Kraemer The move from strncpy() to ap_cpystrn(), which is home-brewed and is located in ./src/ap Revision ChangesPath 1.40 +1 -4 apachen/STATUS Index: STATUS === RCS file: /export/home/cvs/apachen/STATUS,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- STATUS1997/12/29 15:09:47 1.39 +++ STATUS1997/12/30 15:10:39 1.40 @@ -60,12 +60,9 @@ * Ben Hyde's [PATCH] Serialize the update to pool.sub_* in destroy_pool (take 2) * Ken's [PATCH] for PR#1195 ( in realm names) +* Jim's [PATCH] ap_cpystrn() function (replace strncpy) Take II Available Patches: - -* Jim's [PATCH] ap_cpystrn() function (replace strncpy) Take II - [EMAIL PROTECTED] - Status: Jim +1, Dirk +1, Marc wants to think about the name, Dean +1 * [PATCH] mod_digest/1599: proxy authentication using the digest auth scheme never succeeds (fwd) 1.552 +4 -0 apachen/src/CHANGES Index: CHANGES === RCS file: /export/home/cvs/apachen/src/CHANGES,v retrieving revision 1.551 retrieving revision 1.552 diff -u -r1.551 -r1.552 --- CHANGES 1997/12/29 17:51:51 1.551 +++ CHANGES 1997/12/30 15:10:41 1.552 @@ -1,5 +1,9 @@ Changes with Apache 1.3b4 + *) migration from strncpy() to our enhanced version called + ap_cpystrn() for performance and functionality reasons. + Located in libap.a. [Jim Jagielski] + *) table_set() and table_unset() did not deal correctly with multiple occurrences of the same key. [Stephen Scheck [EMAIL PROTECTED], Ben Laurie] PR#1604 1.6 +2 -1 apachen/src/ap/Makefile.tmpl Index: Makefile.tmpl === RCS file: /export/home/cvs/apachen/src/ap/Makefile.tmpl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Makefile.tmpl 1997/12/28 04:51:01 1.5 +++ Makefile.tmpl 1997/12/30 15:10:42 1.6 @@ -6,7 +6,7 @@ LIB=libap.a -OBJS=ap_signal.o ap_slack.o ap_snprintf.o ap_strings.o +OBJS=ap_signal.o ap_slack.o ap_snprintf.o ap_strings.o ap_cpystrn.o .c.o: $(CC) -c $(INCLUDES) $(CFLAGS) $(SPACER) $ @@ -28,3 +28,4 @@ ap_slack.o: $(INCDIR)/httpd.h $(INCDIR)/http_log.h ap_snprintf.o: $(INCDIR)/conf.h ap_strings.o: $(INCDIR)/httpd.h +ap_cpystrn.o: $(INCDIR)/httpd.h 1.1 apachen/src/ap/ap_cpystrn.c Index: ap_cpystrn.c === /* * Copyright (c) 1995-1997 The Apache Group. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright *notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright *notice, this list of conditions and the following disclaimer in *the documentation and/or other materials provided with the *distribution. * * 3. All advertising materials mentioning features or use of this *software must display the following acknowledgment: *This product includes software developed by the Apache Group *for use in the Apache HTTP server project (http://www.apache.org/). * * 4. The names Apache Server and Apache Group must not be used to *endorse or promote products derived from this software without *prior written permission. For written permission, please contact *[EMAIL PROTECTED] * * 5. Redistributions of any form whatsoever must retain the following *acknowledgment: *This product includes software developed by the Apache Group *for use in the Apache HTTP server project (http://www.apache.org/). * * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR *
cvs commit: apachen/src/ap ap_cpystrn.c
ben 97/12/30 08:42:33 Modified:src ApacheCore.mak src/ap ap_cpystrn.c Log: Make ap_cpystrn() work on Windoze. Revision ChangesPath 1.25 +40 -6 apachen/src/ApacheCore.mak Index: ApacheCore.mak === RCS file: /export/home/cvs/apachen/src/ApacheCore.mak,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- ApacheCore.mak1997/12/28 11:52:00 1.24 +++ ApacheCore.mak1997/12/30 16:42:31 1.25 @@ -52,6 +52,7 @@ CLEAN : [EMAIL PROTECTED] $(INTDIR)\alloc.obj + [EMAIL PROTECTED] $(INTDIR)\ap_cpystrn.obj [EMAIL PROTECTED] $(INTDIR)\ap_snprintf.obj [EMAIL PROTECTED] $(INTDIR)\ap_strings.obj [EMAIL PROTECTED] $(INTDIR)\buff.obj @@ -126,6 +127,7 @@ .\ApacheCore.def LINK32_OBJS= \ $(INTDIR)\alloc.obj \ + $(INTDIR)\ap_cpystrn.obj \ $(INTDIR)\ap_snprintf.obj \ $(INTDIR)\ap_strings.obj \ $(INTDIR)\buff.obj \ @@ -197,6 +199,8 @@ CLEAN : [EMAIL PROTECTED] $(INTDIR)\alloc.obj [EMAIL PROTECTED] $(INTDIR)\alloc.sbr + [EMAIL PROTECTED] $(INTDIR)\ap_cpystrn.obj + [EMAIL PROTECTED] $(INTDIR)\ap_cpystrn.sbr [EMAIL PROTECTED] $(INTDIR)\ap_snprintf.obj [EMAIL PROTECTED] $(INTDIR)\ap_snprintf.sbr [EMAIL PROTECTED] $(INTDIR)\ap_strings.obj @@ -307,6 +311,7 @@ BSC32_FLAGS=/nologo /o$(OUTDIR)\ApacheCore.bsc BSC32_SBRS= \ $(INTDIR)\alloc.sbr \ + $(INTDIR)\ap_cpystrn.sbr \ $(INTDIR)\ap_snprintf.sbr \ $(INTDIR)\ap_strings.sbr \ $(INTDIR)\buff.sbr \ @@ -367,6 +372,7 @@ .\ApacheCore.def LINK32_OBJS= \ $(INTDIR)\alloc.obj \ + $(INTDIR)\ap_cpystrn.obj \ $(INTDIR)\ap_snprintf.obj \ $(INTDIR)\ap_strings.obj \ $(INTDIR)\buff.obj \ @@ -493,6 +499,40 @@ !ENDIF +SOURCE=.\ap\ap_cpystrn.c +DEP_CPP_AP_CP=\ + .\main\alloc.h\ + .\main\buff.h\ + .\main\conf.h\ + .\main\httpd.h\ + .\os\win32\os.h\ + .\os\win32\readdir.h\ + .\regex\regex.h\ + {$(INCLUDE)}sys\stat.h\ + {$(INCLUDE)}sys\types.h\ + +NODEP_CPP_AP_CP=\ + .\main\os.h\ + .\main\sfio.h\ + + +!IF $(CFG) == ApacheCore - Win32 Release + + +$(INTDIR)\ap_cpystrn.obj : $(SOURCE) $(DEP_CPP_AP_CP) $(INTDIR) + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ELSEIF $(CFG) == ApacheCore - Win32 Debug + + +$(INTDIR)\ap_cpystrn.obj $(INTDIR)\ap_cpystrn.sbr : $(SOURCE)\ + $(DEP_CPP_AP_CP) $(INTDIR) + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + SOURCE=.\ap\ap_snprintf.c !IF $(CFG) == ApacheCore - Win32 Release @@ -534,12 +574,6 @@ .\os\win32\os.h\ .\os\win32\readdir.h\ .\regex\regex.h\ - {$(INCLUDE)}sys\stat.h\ - {$(INCLUDE)}sys\types.h\ - -NODEP_CPP_AP_ST=\ - .\main\os.h\ - .\main\sfio.h\ $(INTDIR)\ap_strings.obj : $(SOURCE) $(DEP_CPP_AP_ST) $(INTDIR) 1.2 +1 -1 apachen/src/ap/ap_cpystrn.c Index: ap_cpystrn.c === RCS file: /export/home/cvs/apachen/src/ap/ap_cpystrn.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ap_cpystrn.c 1997/12/30 15:10:43 1.1 +++ ap_cpystrn.c 1997/12/30 16:42:32 1.2 @@ -66,7 +66,7 @@ * ap_cpystrn() follows the same call structure as strncpy(). */ -char *ap_cpystrn(char *dst, const char *src, size_t dst_size) +API_EXPORT(char *) ap_cpystrn(char *dst, const char *src, size_t dst_size) { char *d, *end;
cvs commit: apachen STATUS
dgaudet 97/12/30 10:43:06 Modified:.STATUS Log: foo Revision ChangesPath 1.41 +4 -0 apachen/STATUS Index: STATUS === RCS file: /export/home/cvs/apachen/STATUS,v retrieving revision 1.40 retrieving revision 1.41 diff -u -r1.40 -r1.41 --- STATUS1997/12/30 15:10:39 1.40 +++ STATUS1997/12/30 18:43:05 1.41 @@ -64,6 +64,10 @@ Available Patches: +* Dean's [PATCH] 1.3: DoS attack + [EMAIL PROTECTED] + Status: Dean +1 + * [PATCH] mod_digest/1599: proxy authentication using the digest auth scheme never succeeds (fwd) [EMAIL PROTECTED]
cvs commit: apachen/src/main util.c
dgaudet 97/12/30 11:55:50 Modified:src/main util.c Log: Fix some off-by-1s, and do some strength reduction from ap_cpystrn to memcpy. Revision ChangesPath 1.81 +6 -9 apachen/src/main/util.c Index: util.c === RCS file: /export/home/cvs/apachen/src/main/util.c,v retrieving revision 1.80 retrieving revision 1.81 diff -u -r1.80 -r1.81 --- util.c1997/12/30 19:03:18 1.80 +++ util.c1997/12/30 19:55:48 1.81 @@ -287,11 +287,8 @@ } else if (no nmatch pmatch[no].rm_so pmatch[no].rm_eo) { len = pmatch[no].rm_eo - pmatch[no].rm_so; - ap_cpystrn(dst, source + pmatch[no].rm_so, len); + memcpy(dst, source + pmatch[no].rm_so, len); dst += len; - /* is this still valid? jj 12/26/97 */ - if (*(dst - 1) == '\0') /* ap_cpystrn hit NULL. */ - return NULL; } } @@ -447,7 +444,7 @@ if (s[x] == '/') if ((++f) == n) { res = palloc(p, x + 2); - ap_cpystrn(res, s, x); + memcpy(res, s, x); res[x] = '/'; res[x + 1] = '\0'; return res; @@ -506,7 +503,7 @@ } res = palloc(atrans, pos + 1); -ap_cpystrn(res, *line, pos); +ap_cpystrn(res, *line, pos + 1); while ((*line)[pos] == stop) ++pos; @@ -540,7 +537,7 @@ } res = palloc(atrans, pos + 1); -ap_cpystrn(res, *line, pos); +ap_cpystrn(res, *line, pos + 1); while (isspace((*line)[pos])) ++pos; @@ -567,7 +564,7 @@ } res = palloc(atrans, pos + 1); -ap_cpystrn(res, *line, pos); +ap_cpystrn(res, *line, pos + 1); ++pos; @@ -850,7 +847,7 @@ tok_len = ptr - tok_start; token = palloc(p, tok_len + 1); -ap_cpystrn(token, tok_start, tok_len); +ap_cpystrn(token, tok_start, tok_len + 1); /* Advance accept_line pointer to the next non-white byte */
cvs commit: apachen/src/main alloc.c
dgaudet 97/12/30 11:56:12 Modified:src/main alloc.c Log: another off-by-1 Revision ChangesPath 1.65 +1 -1 apachen/src/main/alloc.c Index: alloc.c === RCS file: /export/home/cvs/apachen/src/main/alloc.c,v retrieving revision 1.64 retrieving revision 1.65 diff -u -r1.64 -r1.65 --- alloc.c 1997/12/30 15:10:44 1.64 +++ alloc.c 1997/12/30 19:56:11 1.65 @@ -536,7 +536,7 @@ if (s == NULL) return NULL; res = palloc(a, n + 1); -ap_cpystrn(res, s, n); +ap_cpystrn(res, s, n + 1); return res; }
cvs commit: apachen/src/support suexec.c
brian 97/12/30 12:17:16 Modified:src/support suexec.c Log: Environment variable REQUEST_URI set by util_script.c but not passed on to suexec until now. Revision ChangesPath 1.30 +1 -0 apachen/src/support/suexec.c Index: suexec.c === RCS file: /export/home/cvs/apachen/src/support/suexec.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- suexec.c 1997/10/22 20:30:46 1.29 +++ suexec.c 1997/12/30 20:17:15 1.30 @@ -140,6 +140,7 @@ REDIRECT_STATUS, REDIRECT_URL, REQUEST_METHOD, +REQUEST_URI, SCRIPT_FILENAME, SCRIPT_NAME, SCRIPT_URI,
cvs commit: apachen/src/modules/proxy proxy_util.c
marc97/12/30 12:43:54 Modified:src/modules/proxy proxy_util.c Log: Fix bogus size in ap_snprintf call that I introduced in 1.2bmumble. Is a bigger problem now because of the ap_snprintf changes to treat len of 0 == 0 instead of infinite. Reviewed by: Jim Jagielski, Dean Gaudet Revision ChangesPath 1.39 +3 -3 apachen/src/modules/proxy/proxy_util.c Index: proxy_util.c === RCS file: /export/home/cvs/apachen/src/modules/proxy/proxy_util.c,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- proxy_util.c 1997/12/30 15:10:53 1.38 +++ proxy_util.c 1997/12/30 20:43:54 1.39 @@ -338,9 +338,9 @@ if (mon == 12) return x; -if (strlen(x) 31) - x = palloc(p, 31); -ap_snprintf(x, strlen(x) + 1, %s, %.2d %s %d %.2d:%.2d:%.2d GMT, wday[wk], mday, +if (strlen(x) 30) + x = palloc(p, 30); +ap_snprintf(x, 30, %s, %.2d %s %d %.2d:%.2d:%.2d GMT, wday[wk], mday, months[mon], year, hour, min, sec); return x; }
cvs commit: apachen/src/modules/proxy proxy_util.c
marc97/12/30 15:29:47 Modified:src/modules/proxy proxy_util.c Log: Fix broken proxy caching introduced by ap_cpystrn changes. Revision ChangesPath 1.40 +2 -2 apachen/src/modules/proxy/proxy_util.c Index: proxy_util.c === RCS file: /export/home/cvs/apachen/src/modules/proxy/proxy_util.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- proxy_util.c 1997/12/30 20:43:54 1.39 +++ proxy_util.c 1997/12/30 23:29:46 1.40 @@ -639,7 +639,7 @@ /* now split into directory levels */ for (i = k = d = 0; d ndepth; ++d) { - ap_cpystrn(val[i], tmp[k], nlength); + memcpy(val[i], tmp[k], nlength); k += nlength; val[i + nlength] = '/'; i += nlength + 1; @@ -689,7 +689,7 @@ /* now split into directory levels */ for (i = k = d = 0; d ndepth; ++d) { - ap_cpystrn(val[i], tmp[k], nlength); + memcpy(val[i], tmp[k], nlength); k += nlength; val[i + nlength] = '/'; i += nlength + 1;