httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steinar H. Gunderson" <sgunder...@bigfoot.com>
Subject Re: Hey Steinar... Re: Revisiting the pre_htaccess hook
Date Wed, 10 Jul 2013 11:14:43 GMT
On Tue, Jul 09, 2013 at 08:53:03AM -0400, Jeff Trawick wrote:
> Do you have time to test with this patch on top of 2.4.x and report back?
> 
> http://people.apache.org/~sf/open_htaccess_hook.patch

Hi,

I've tried this, adjusted mpm-itk, and it seems to work. Why do I need to
return AP_DECLINED and not DECLINED from this hook, though?

FWIW, here's my hook:

    ap_hook_open_htaccess(itk_open_htaccess, NULL, NULL, APR_HOOK_REALLY_FIRST);

[...]

    static apr_status_t itk_open_htaccess(request_rec *r,
                                          const char *dir_name, const char *access_name,
                                          ap_configfile_t **conffile, const char **full_name)
    {
        int status;
    
        if (!ap_has_irreversibly_setuid || r->main != NULL) {
            return AP_DECLINED;
        }
    
        *full_name = ap_make_full_path(r->pool, dir_name, access_name);
        status = ap_pcfg_openfile(conffile, r->pool, *full_name);
    
        if (APR_STATUS_IS_EACCES(status)) {
             ap_log_rerror(APLOG_MARK, APLOG_WARNING, errno, r,
                           "Couldn't read %s, closing connection.",
                           *full_name);
             ap_lingering_close(r->connection);
             exit(0);
        }
    
        return status;
    }

I don't like all that much having to duplicate the “official” hook
(in particular the ap_make_full_path() call), but I guess it's better than
what used to be there, and it's only two lines.

/* Steinar */
-- 
Homepage: http://www.sesse.net/

Mime
View raw message