fielding 99/01/08 12:08:28
Modified: src CHANGES src/include ap_mmn.h httpd.h src/main http_request.c util.c src/os/bs2000 os.h src/os/os2 os.h src/os/tpf os.h src/os/unix os.h src/os/win32 os.h Log: Moved prototypes/defines for ap_os_canonical_filename(), ap_os_case_canonical_filename(), ap_os_systemcase_filename(), and ap_os_is_filename_valid() from httpd.h to the separate os.h files. Moved BS2000-specific os_set_account() and os_init_job_environment() prototypes to bs2000/os.h. HAVE_CANONICAL_FILENAME no londer needed. Revision Changes Path 1.1208 +6 -0 apache-1.3/src/CHANGES Index: CHANGES =================================================================== RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1207 retrieving revision 1.1208 diff -u -r1.1207 -r1.1208 --- CHANGES 1999/01/08 17:54:37 1.1207 +++ CHANGES 1999/01/08 20:08:18 1.1208 @@ -1,5 +1,11 @@ Changes with Apache 1.3.4 + *) Moved prototypes/defines for ap_os_canonical_filename(), + ap_os_case_canonical_filename(), ap_os_systemcase_filename(), and + ap_os_is_filename_valid() from httpd.h to the separate os.h files. + Moved BS2000-specific os_set_account() and os_init_job_environment() + prototypes to bs2000/os.h. [Roy Fielding] + *) Renamed macros status_drops_connection to ap_status_drops_connection and vestigial scan_script_header to ap_scan_script_header_err, mostly for aesthetic reasons. [Roy Fielding] 1.21 +1 -1 apache-1.3/src/include/ap_mmn.h Index: ap_mmn.h =================================================================== RCS file: /home/cvs/apache-1.3/src/include/ap_mmn.h,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- ap_mmn.h 1999/01/06 19:14:51 1.20 +++ ap_mmn.h 1999/01/08 20:08:21 1.21 @@ -195,7 +195,7 @@ * 19990101 - renamed macro escape_uri() to ap_escape_uri() * - added MODULE_MAGIC_COOKIE to identify module structs * 19990103 (1.3.4-dev) - added ap_array_pstrcat() - * 19990105 (1.3.4-dev) - added ap_os_is_filename_valid() to Win32 + * 19990105 (1.3.4-dev) - added ap_os_is_filename_valid() * 19990106 (1.3.4-dev) - Move MODULE_MAGIC_COOKIE to the end of the * STANDARD_MODULE_STUFF macro so the version * numbers and file name remain at invariant offsets 1.260 +0 -21 apache-1.3/src/include/httpd.h Index: httpd.h =================================================================== RCS file: /home/cvs/apache-1.3/src/include/httpd.h,v retrieving revision 1.259 retrieving revision 1.260 diff -u -r1.259 -r1.260 --- httpd.h 1999/01/08 17:54:39 1.259 +++ httpd.h 1999/01/08 20:08:21 1.260 @@ -1017,27 +1017,6 @@ API_EXPORT(int) ap_can_exec(const struct stat *); API_EXPORT(void) ap_chdir_file(const char *file); -#ifndef HAVE_CANONICAL_FILENAME -#define ap_os_canonical_filename(p,f) (f) -#define ap_os_case_canonical_filename(p,f) (f) -#define ap_os_systemcase_filename(p,f) (f) -#else -API_EXPORT(char *) ap_os_canonical_filename(pool *p, const char *file); -#ifdef WIN32 -API_EXPORT(char *) ap_os_case_canonical_filename(pool *pPool, const char *szFile); -API_EXPORT(char *) ap_os_systemcase_filename(pool *pPool, const char *szFile); -API_EXPORT(int) ap_os_is_filename_valid(const char *file); -#else -#define ap_os_case_canonical_filename(p,f) ap_os_canonical_filename(p,f) -#define ap_os_systemcase_filename(p,f) ap_os_canonical_filename(p,f) -#endif -#endif - -#ifdef _OSD_POSIX -extern const char *os_set_account(pool *p, const char *account); -extern int os_init_job_environment(server_rec *s, const char *user_name, int one_process); -#endif /* _OSD_POSIX */ - char *ap_get_local_host(pool *); unsigned long ap_get_virthost_addr(char *hostname, unsigned short *port); 1.143 +5 -11 apache-1.3/src/main/http_request.c Index: http_request.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/http_request.c,v retrieving revision 1.142 retrieving revision 1.143 diff -u -r1.142 -r1.143 --- http_request.c 1999/01/08 17:54:42 1.142 +++ http_request.c 1999/01/08 20:08:23 1.143 @@ -229,11 +229,11 @@ *cp = '\0'; -#ifdef WIN32 - /* We must not stat() filenames such as "/file/aux" since it can cause - * delays or lockups. So pretend that they do not exist by returning - * an ENOENT error. This will force us to drop that part of the path and - * keep looking back for a "real" file that exists, while still allowing + /* We must not stat() filenames that may cause os-specific system + * problems, such as "/file/aux" on DOS-abused filesystems. + * So pretend that they do not exist by returning an ENOENT error. + * This will force us to drop that part of the path and keep + * looking back for a "real" file that exists, while still allowing * the "invalid" path parts within the PATH_INFO. */ if (!ap_os_is_filename_valid(path)) { @@ -244,10 +244,6 @@ errno = 0; rv = stat(path, &r->finfo); } -#else - errno = 0; - rv = stat(path, &r->finfo); -#endif if (cp != end) *cp = '/'; @@ -407,13 +403,11 @@ ap_no2slash(test_filename); num_dirs = ap_count_dirs(test_filename); -#ifdef WIN32 if (!ap_os_is_filename_valid(r->filename)) { ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, "Filename is not valid: %s", r->filename); return HTTP_FORBIDDEN; } -#endif if ((res = check_safe_file(r))) { return res; 1.145 +0 -2 apache-1.3/src/main/util.c Index: util.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/util.c,v retrieving revision 1.144 retrieving revision 1.145 diff -u -r1.144 -r1.145 --- util.c 1999/01/05 08:17:30 1.144 +++ util.c 1999/01/08 20:08:23 1.145 @@ -761,7 +761,6 @@ return NULL; } -#if defined(WIN32) if (!ap_os_is_filename_valid(name)) { ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, NULL, "Access to config file %s denied: not a valid filename", @@ -769,7 +768,6 @@ errno = EACCES; return NULL; } -#endif file = ap_pfopen(p, name, "r"); #ifdef DEBUG 1.14 +15 -0 apache-1.3/src/os/bs2000/os.h Index: os.h =================================================================== RCS file: /home/cvs/apache-1.3/src/os/bs2000/os.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- os.h 1998/12/15 08:55:14 1.13 +++ os.h 1999/01/08 20:08:25 1.14 @@ -29,6 +29,21 @@ extern int ap_os_is_path_absolute(const char *file); #endif +/* Other ap_os_ routines not used by this platform */ + +#define ap_os_canonical_filename(p,f) (f) +#define ap_os_case_canonical_filename(p,f) (f) +#define ap_os_systemcase_filename(p,f) (f) +#define ap_os_is_filename_valid(f) (1) + +/* Routines in bs2login.c */ + +#ifdef _OSD_POSIX +extern const char *os_set_account(pool *p, const char *account); +extern int os_init_job_environment(server_rec *s, const char *user_name, + int one_process); +#endif + /* Sorry if this is ugly, but the include order doesn't allow me * to use request_rec here... */ struct request_rec; 1.10 +10 -1 apache-1.3/src/os/os2/os.h Index: os.h =================================================================== RCS file: /home/cvs/apache-1.3/src/os/os2/os.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- os.h 1998/12/15 08:55:15 1.9 +++ os.h 1999/01/08 20:08:25 1.10 @@ -2,7 +2,6 @@ #define APACHE_OS_H #define PLATFORM "OS/2" -#define HAVE_CANONICAL_FILENAME /* * This file in included in all Apache source code. It contains definitions @@ -27,6 +26,16 @@ */ extern int ap_os_is_path_absolute(const char *file); #endif + +/* Canonical Filename Routines */ + +API_EXPORT(char *) ap_os_canonical_filename(pool *p, const char *file); + +#define ap_os_case_canonical_filename(p,f) ap_os_canonical_filename(p,f) +#define ap_os_systemcase_filename(p,f) ap_os_canonical_filename(p,f) + +/* FIXME: the following should be implemented on this platform */ +#define ap_os_is_filename_valid(f) (1) /* OS/2 doesn't have symlinks so S_ISLNK is always false */ #define S_ISLNK(m) 0 1.4 +7 -0 apache-1.3/src/os/tpf/os.h Index: os.h =================================================================== RCS file: /home/cvs/apache-1.3/src/os/tpf/os.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- os.h 1999/01/06 21:57:05 1.3 +++ os.h 1999/01/08 20:08:26 1.4 @@ -33,6 +33,13 @@ extern int ap_os_is_path_absolute(const char *file); #endif +/* Other ap_os_ routines not used by this platform */ + +#define ap_os_canonical_filename(p,f) (f) +#define ap_os_case_canonical_filename(p,f) (f) +#define ap_os_systemcase_filename(p,f) (f) +#define ap_os_is_filename_valid(f) (1) + /* Sorry if this is ugly, but the include order doesn't allow me * to use request_rec here... */ struct request_rec; 1.37 +7 -0 apache-1.3/src/os/unix/os.h Index: os.h =================================================================== RCS file: /home/cvs/apache-1.3/src/os/unix/os.h,v retrieving revision 1.36 retrieving revision 1.37 diff -u -r1.36 -r1.37 --- os.h 1999/01/02 14:12:20 1.36 +++ os.h 1999/01/08 20:08:27 1.37 @@ -86,6 +86,13 @@ extern int ap_os_is_path_absolute(const char *file); #endif +/* Other ap_os_ routines not used by this platform */ + +#define ap_os_canonical_filename(p,f) (f) +#define ap_os_case_canonical_filename(p,f) (f) +#define ap_os_systemcase_filename(p,f) (f) +#define ap_os_is_filename_valid(f) (1) + /* * Abstraction layer for loading * Apache modules under run-time via 1.26 +8 -1 apache-1.3/src/os/win32/os.h Index: os.h =================================================================== RCS file: /home/cvs/apache-1.3/src/os/win32/os.h,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- os.h 1998/11/05 19:20:17 1.25 +++ os.h 1999/01/08 20:08:27 1.26 @@ -33,7 +33,6 @@ #define HAVE_MMAP #define USE_MMAP_SCOREBOARD #define MULTITHREAD -#define HAVE_CANONICAL_FILENAME typedef int uid_t; typedef int gid_t; typedef int pid_t; @@ -104,6 +103,14 @@ #define _spawnle os_spawnle #define spawnle os_spawnle API_EXPORT(int) os_spawnle(int mode,const char *cmdname,...); + +/* Canonical Filename Routines in util_win32.c */ + +API_EXPORT(char *) ap_os_canonical_filename(pool *p, const char *file); +API_EXPORT(char *) ap_os_case_canonical_filename(pool *pPool, + const char *szFile); +API_EXPORT(char *) ap_os_systemcase_filename(pool *pPool, const char *szFile); +API_EXPORT(int) ap_os_is_filename_valid(const char *file); /* Abstractions for dealing with shared object files (DLLs on Win32). * These are used by mod_so.c