You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Brian Havard <br...@kheldar.apana.org.au> on 1999/02/14 05:22:37 UTC

[PATCH] Improve OS/2 ap_os_canonical_filename()'s behaviour handing invalid file names

This patch removes the ap_assert() triggered by an invalid file name and 
instead returns the file name unchanged.

This allows <Directory proxy:*> directives to work and prevents invalid 
requests from killing the process.



Index: util_os2.c
===================================================================
RCS file: /cvs/apache-1.3/src/os/os2/util_os2.c,v
retrieving revision 1.1
diff -u -r1.1 util_os2.c
--- util_os2.c	1998/07/20 16:40:40	1.1
+++ util_os2.c	1999/02/14 02:52:52
@@ -1,4 +1,5 @@
 #define INCL_DOSFILEMGR
+#define INCL_DOSERRORS
 #include <os2.h>
 #include "httpd.h"
 #include "http_log.h"
@@ -19,7 +20,16 @@
         buf[--len] = 0;
       
     rc = DosQueryPathInfo(buf, FIL_QUERYFULLNAME, buf2, HUGE_STRING_LEN);
-    ap_assert(rc == 0);
+
+    if (rc) {
+        if ( rc != ERROR_INVALID_NAME ) {
+            ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, NULL, "OS/2 error %d for file %s", rc, szFile);
+            return ap_pstrdup(pPool, "");
+        } else {
+            return ap_pstrdup(pPool, szFile);
+        }
+    }
+
     strlwr(buf2);
     
 /* Switch backslashes to forward */

--
 ______________________________________________________________________________
 |  Brian Havard                 |  "He is not the messiah!                   |
 |  brianh@kheldar.apana.org.au  |  He's a very naughty boy!" - Life of Brian |
 ------------------------------------------------------------------------------