Bug 592389

Summary: Anonymous resource limits not set if no BIND is performed
Product: [Retired] 389 Reporter: Nathan Kinder <nkinder>
Component: Directory ServerAssignee: Nathan Kinder <nkinder>
Status: CLOSED CURRENTRELEASE QA Contact: Viktor Ashirov <vashirov>
Severity: high Docs Contact:
Priority: high    
Version: 1.2.5CC: andrey.ivanov, jgalipea, rmeggins
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-07 16:45:22 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 434914, 543590    
Description Flags
Proposed Patch nkinder: review?, rmeggins: review+

Description Nathan Kinder 2010-05-14 18:23:05 UTC
It appears that the anonymous resource limits are not set if an explicit BIND is not performed.  The anonymous limits are set when bind_credentials_set() or bind_credentials_set_nolock() is called, but these are only called from the bind code.

We need to be sure to set the limits for an anonymous user who does not perform an explicit bind.

Comment 1 Nathan Kinder 2010-05-20 00:33:32 UTC
So it turns out that this issue is occurring even when an anonymous BIND is performed.  Some other code changes in bind.c must have broken the anonymous limits feature.  I have a patch that makes anonymous limits take effect when an anonymous or unauthenticated BIND is performed.

Dealing with the case where no BIND operation is performed is going to take a bit more surgery.  The way the server currently works is that when a BIND is performed, the limits are set if any bind-based resource limits exist (for real users or anonymous with my patch).  When a search is processed in a backend, it uses any bind based resource limits if they are set, otherwise the global limits for that backend are used.  To have the anonymous limits work when no bind is performed, we would have to set the anonymous limits for all connections when they are created.  We would then need to clear these limits at the beginning of the bind code and allow them to either be reset or left blank for the backend global settings to take effect.

Comment 3 Nathan Kinder 2010-05-20 21:28:55 UTC
Created attachment 415519 [details]
Proposed Patch

The anonymous resource limits were not being properly set.  This
patch ensures that the limits are set properly when an anonymous
or unauthenticated BIND operation is performed.  It also sets the
anonymous limits when we do a read on a connection that has not
yet perfomed a BIND.  These limits will be overwritten with any
default or user-based limits once a valid BIND is performed.

Comment 4 Nathan Kinder 2010-05-20 21:47:17 UTC
Thanks to Rich for his review!  Pushed to master.

Counting objects: 13, done.
Delta compression using 2 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 1.43 KiB, done.
Total 7 (delta 5), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
   ecb1e8a..55489b8  master -> master

Comment 6 Jenny Severance 2010-06-04 18:59:12 UTC
verified - RHEL 4


1.  Global sizelimit:
# ldapsearch -x -p 389 -h `hostname` -D "cn=Directory Manager" -w Secret123 -b "cn=config" | grep sizelimit
nsslapd-sizelimit: 20

2. nsslapd-anonlimitsdn:
# ldapsearch -x -p 389 -h `hostname` -D "cn=Directory Manager" -w Secret123 -b "cn=config" | grep anonlimit
nsslapd-anonlimitsdn: uid=jgalipea,ou=people,dc=example,dc=com

3. Limit on User:
# /usr/lib/mozldap6/ldapsearch -p 389 -h `hostname` -D "cn=Directory Manager" -w Secret123 -b "uid=jgalipea,ou=people,dc=example,dc=com" "(objectclass=*)" nssizelimit
version: 1
dn: uid=jgalipea,ou=People,dc=example,dc=com
nssizelimit: 5

4. anonymous bind search:
# /usr/lib/mozldap6/ldapsearch -p 389 -h `hostname` -b "dc=example,dc=com" "(objectclass=*)" cnversion: 1
dn: dc=example,dc=com

dn: cn=Directory Administrators,dc=example,dc=com
cn: Directory Administrators

dn: ou=Groups,dc=example,dc=com

dn: ou=People,dc=example,dc=com

dn: ou=Special Users,dc=example,dc=com
ldap_search: Sizelimit exceeded