httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Hartill <r...@imdb.com>
Subject Re: deny from user-agents
Date Tue, 10 Sep 1996 12:16:52 GMT

I worte:

>usage example:
>
>  order allow,deny
>  allow from all
>  deny from user-agents MS-Catapult/0.9 dumb-robot/1.2
>

Here's a better patch that'll allow the user-agents to come after a list
of disliked hosts, e.g.

deny from evil.com hackers.org user-agents MS-Catapult/0.9 dumb-robot/1.2


*** mod_access.c.orig	Tue Sep 10 12:11:48 1996
--- mod_access.c	Tue Sep 10 13:11:34 1996
***************
*** 178,183 ****
--- 178,194 ----
      for (i = 0; i < a->nelts; ++i) {
          if (!(mmask & ap[i].limited))
  	    continue;
+         if (ap[i].from && !strcmp(ap[i].from, "user-agents")) {
+            char * this_agent = table_get(r->headers_in, "User-Agent");
+ 	     int j;
+ 
+            if (!this_agent) return 0;
+ 
+            for (j = i+1; j < a->nelts; ++j) {
+               if (strstr(this_agent, ap[j].from)) return 1;
+            }
+            return 0;
+         }
  	if (!strcmp (ap[i].from, "all"))
  	    return 1;
  	if (!gothost)

Mime
View raw message