On Wed, Aug 01, 2012 at 01:58:16PM -0400, Jeff Trawick wrote:
> Your post-perdir-config patch has been committed to trunk with r1368121.

Thanks!

> Attached is a patch to trunk that allows you to hook in to the stat
> calls from directory walk.  Call apr_stat() like core_dirwalk_stat()
> but check for APR_STATUS_IS_EACCES(rv) and decide whether to run
> lingering close and exit.  Let us know how that goes.
> 
> You still need the parse-htaccess patch for now.

I backported this to 2.4.2, and changed mpm-itk to hook into that function
with the following hook:

  static apr_status_t itk_dirwalk_stat(apr_finfo_t *finfo, request_rec *r,
                                       apr_int32_t wanted)
  {
      apr_status_t status = apr_stat(finfo, r->filename, wanted, r->pool);
      if (ap_has_irreversibly_setuid && APR_STATUS_IS_EACCES(status)) {
           ap_log_rerror(APLOG_MARK, APLOG_WARNING, status, r,
                         "Couldn't read %s, closing connection.",
                         r->filename);
           ap_lingering_close(r->connection);
           clean_child_exit(0);
      }
      return status;
  }

Seems to work great, from my limited testing. As an extra bonus, I can easily
call clean_child_exit() (which runs more cleanup hooks) instead of exit(),
since this is in the MPM's own .c file.

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

Reply via email to