Bug 45674

Summary: Allow to change error code returned by "Require ldap-filter"
Product: Apache httpd-2 Reporter: Alexandra Kossovsky <Alexandra.Kossovsky>
Component: mod_authz_ldapAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: NEW ---    
Severity: enhancement Keywords: FixedInTrunk
Priority: P2    
Version: 2.2.9   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Attachments: AuthzLDAPUnauthorized directive may be set to 401 or 403

Description Alexandra Kossovsky 2008-08-22 06:57:05 UTC
Created attachment 22474 [details]
AuthzLDAPUnauthorized directive may be set to 401 or 403

I have a configuration where different parts of website are available to different people. Something like:
<VirtualHost *:443>
AuthType Kerberos
  <Location /xxx>
    Require ldap-filter uid=*
  </Location>
  <Location /yyy>
    Require ldap-filter &(o=something)(zz=value)
  </Location>
</VirtualHost>

When user fails to pass through "require ldap-filter" directive when accessing /yyy directory, he gets error 401.  In many browsers, it means that he is re-asked to type his name/password, even if he decides to go back to /xxx directory. So, I'd like mod_authz_ldap to return 403 instead of 401 in such cases.

There already was similar bug 40721 (I completely agree with you that 401 MUST be the default error code), but I propose to make things more flexible.

The attached patch adds AuthzLDAPUnauthorized directive, which is 401 by default, but may be set to 403 by user.

If you'd like it to have boolean switch (to avoid user setting AuthzLDAPUnauthorized to 200), feel free to ask me to rework my patch.
Comment 1 Eric Covener 2014-01-19 20:41:59 UTC
Fixed in 2.4 and later with AuthzSendForbiddenOnFailure