You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ben Laurie <be...@gonzo.ben.algroup.co.uk> on 1996/10/09 12:06:29 UTC

Re: cvs commit: apache/src mod_access.c

I still don't think we have reached consensus on whether this patch should use
BrowserMatch. I am strongly of the opinion that it should. If others agree then
this would become an environment variable match instead of a user agent match,
and would, therefore, be a considerably more general facility. I'm happy to
make the changes... I think! Don't forget that BrowserMatch uses REs, which are
much more powerful than strstr, so there is an advantage even in this limited
case.

Cheers,

Ben.

Brian Behlendorf wrote:
> 
> brian       96/10/08 13:34:11
> 
>   Modified:    src       mod_access.c
>   Log:
>   Reviewed by:	Brian Behlendorf
>   Submitted by:	Rob Hartill <ro...@imdb.com>
>   
>   Adds "user-agents" to "deny" logic, to prevent accesses on a per-user-agent basis.
>   
>   Revision  Changes    Path
>   1.6       +13 -1     apache/src/mod_access.c
>   
>   Index: mod_access.c
>   ===================================================================
>   RCS file: /export/home/cvs/apache/src/mod_access.c,v
>   retrieving revision 1.5
>   retrieving revision 1.6
>   diff -C3 -r1.5 -r1.6
>   *** mod_access.c	1996/09/24 12:11:21	1.5
>   --- mod_access.c	1996/10/08 20:34:07	1.6
>   ***************
>   *** 50,56 ****
>      *
>      */
>     
>   ! /* $Id: mod_access.c,v 1.5 1996/09/24 12:11:21 mjc Exp $  */
>     
>     /*
>      * Security options etc.
>   --- 50,56 ----
>      *
>      */
>     
>   ! /* $Id: mod_access.c,v 1.6 1996/10/08 20:34:07 brian Exp $  */
>     
>     /*
>      * Security options etc.
>   ***************
>   *** 178,183 ****
>   --- 178,195 ----
>         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)
>   
>   
>   

-- 
Ben Laurie                  Phone: +44 (181) 994 6435
Freelance Consultant and    Fax:   +44 (181) 994 6472
Technical Director          Email: ben@algroup.co.uk
A.L. Digital Ltd,           URL: http://www.algroup.co.uk
London, England.            Apache Group member (http://www.apache.org)