Bug 592389 - Anonymous resource limits not set if no BIND is performed
Summary: Anonymous resource limits not set if no BIND is performed
Alias: None
Product: 389
Classification: Retired
Component: Directory Server
Version: 1.2.5
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Nathan Kinder
QA Contact: Viktor Ashirov
Depends On:
Blocks: 434914 389_1.2.6
TreeView+ depends on / blocked
Reported: 2010-05-14 18:23 UTC by Nathan Kinder
Modified: 2015-12-07 16:45 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2015-12-07 16:45:22 UTC

Attachments (Terms of Use)
Proposed Patch (4.09 KB, patch)
2010-05-20 21:28 UTC, Nathan Kinder
nkinder: review?
rmeggins: review+
Details | Diff

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

Note You need to log in before you can comment on or make changes to this bug.