summaryrefslogtreecommitdiffstats
path: root/lib/libaccess/authdb.cpp
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2006-02-23 20:48:05 +0000
committerRich Megginson <rmeggins@redhat.com>2006-02-23 20:48:05 +0000
commitf7db1581846c89528347a342c34829bb02a939ae (patch)
treed236d11083e31d939a43e9ff30cb96243d839bde /lib/libaccess/authdb.cpp
parentd62cdb091aae94777755f2db4e00cab968289202 (diff)
downloadds-f7db1581846c89528347a342c34829bb02a939ae.tar.gz
ds-f7db1581846c89528347a342c34829bb02a939ae.tar.xz
ds-f7db1581846c89528347a342c34829bb02a939ae.zip
Bug(s) fixed: 179137
Bug Description: recursion causes OOM with bad DN in dn2ancestor Reviewed by: All (Thanks!) Fix Description: The fix looks scary, but I thought it would be best to get rid of recursion entirely (ugh - recursion in a multi threaded server - this isn't lisp . . .). Along with eliminating recursion, I created a new function called slapi_dn_find_parent that just returns a pointer to the beginning of the parent of the given dn, rather than returning a copy (as in slapi_dn_parent), to eliminate malloc/free in cases where it is unnecessary such as iterating through the parents in an DN. The new function is basically just the guts of slapi_dn_parent with one twist, specifically to address the bug in question - it skips through consecutive runs of DN separator characters. We should probably have a function like const char *slapi_dn_is_valid(const char *) that returns NULL if the given DN is valid or returns a pointer to the first invalid character if not. We could probably save a lot of time in processing bad or malicious client requests. Anyway, back to dn2ancestor. The given ancestordn must contain the _unnormalized_ parent DN, since some clients get irritated when they get back an DN in a different form than given. However, we need to have a normalized DN to pass to dn2entry, and we cannot use a single Slapi_DN that has both a dn and a ndn that are passed in byval (unless we add a new API or skip the API altogether), so the variable ancestorndn holds the normalized DN. Using the original pointer to the given sdn also allows us to avoid malloc/free entirely. Platforms tested: Fedora Core 4 Flag Day: no Doc impact: no QA impact: should be covered by regular nightly and manual testing New Tests integrated into TET: We need a test case that calls moddn and modify operations with really bad DNs, consisting of nothing but thousands of ',', '+', and '=' chars.
Diffstat (limited to 'lib/libaccess/authdb.cpp')
0 files changed, 0 insertions, 0 deletions