Added more URL prefixes to is_bogus() to reflect the
authorArt Cancro <ajc@citadel.org>
Wed, 9 May 2007 18:59:58 +0000 (18:59 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 9 May 2007 18:59:58 +0000 (18:59 +0000)
latest collection of brain-dead Microsoft shitware that assumes
everyone is an IIS box.

webcit/context_loop.c

index 7f18c09764e39107af46feb81fde7576ff5f14b0..a4759ce9911e9a576b1dc2dcd30ab25d776c0604 100644 (file)
@@ -232,18 +232,27 @@ int lingering_close(int fd)
  */
 int is_bogus(char *http_cmd) {
        char *url;
+       int i, max;
 
        url = strstr(http_cmd, " ");
        if (url == NULL) return(1);
        ++url;
 
-       /** Worms and trojans and viruses, oh my! */
-       if (!strncasecmp(url, "/scripts/root.exe", 17)) return(2);
-       if (!strncasecmp(url, "/c/winnt", 8)) return(2);
-       if (!strncasecmp(url, "/MSADC/", 7)) return(2);
+       char *bogus_prefixes[] = {
+               "/scripts/root.exe",    /**< Worms and trojans and viruses, oh my! */
+               "/c/winnt",
+               "/MSADC/",
+               "/_vti",                /**< Broken Microsoft DAV implementation */
+               "/MSOffice"             /**< Stoopid MSOffice thinks everyone is IIS */
+       };
 
-       /** Broken Microsoft DAV implementation */
-       if (!strncasecmp(url, "/_vti", 5)) return(3);
+       max = sizeof(bogus_prefixes) / sizeof(char *);
+
+       for (i=0; i<max; ++i) {
+               if (!strncasecmp(url, bogus_prefixes[i], strlen(bogus_prefixes[i]))) {
+                       return(2);
+               }
+       }
 
        return(0);      /* probably ok */
 }