[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: ldapmodify crashes with long-ish input for an entry



Dameon Wagner wrote:
On Sat, Jan 03 2015 at 01:31:10 +0000, Howard Chu scribbled
Define lengthy - how many bytes?

For the complete LDIF of the entry update in question, it is 672808
bytes (658K) -- I haven't done an exhaustive "trial and error"
analysis to find the boundary between OK and too-big, but at 68233
bytes (67K, or 1000 lines of updates for the entry) the update
completes OK, but at 205105 bytes (201K or 3000 lines) the update
fails as described.

That looks like a bug in Cyrus SASL. What SASL mechanism are you
using?

GSSAPI -- we use Kerberos for nearly everything, and the task in
question uses a credential cache created from a keytab using k5start,
though as an independent process (we're not using k5start to run the
task's commands itself).

/etc/sasl/slapd.conf for the system in question contains only
"mech_list: gssapi".

While I must admit that C isn't my forte (I'm more on the admin side
of sysadmin than on the development side), I'm comfortable reading
code and had a look through the code-base for those sb_sasl* messages
and didn't see anything specific enough for my untrained (or
unfamiliar) eye to use as a clue for further sleuthing.

While it is quite probably an incorrect assumption, I assumed at the
time that the messages may have been caused by the client side closing
or dropping the connection unexpectedly.

If it is of any interest, I see the same issue with both
libsasl2-modules-gssapi-heimdal and libsasl2-modules-gssapi-mit Debian
packages.

That's good information. Unfortunately I can't reproduce the problem here, ldapmodifying a group with 4640 members (237KB) works fine for me thru SASL.

It might be enlightening to run slapd with -d2 to show the packet decoding activity. Also run ldapmodify with -d2.

The LDIF for the failed entry consists of:

#---8<-------------------------------------------------------------
dn: <DN-FOR-FAILED-ENTRY>
changetype: modify
replace: member
member: <DN-FOR-MEMBER>
...
member: <DN-FOR-ANOTHER-MEMBER>
#---8<-------------------------------------------------------------

where the list of members was, in this case, 9799 long.  The LDIF
itself is 30097 lines long, and was happy for the first ~15000
lines.

If I prune out the modifications for the troublesome DN, the
remainder of the file also goes through happily.

As a work-around I can manually split up the list into several
blocks (tested with roughly 1000 member updates per block) with
"replace: member" for the first, to match the current behaviour,
and "add: member" for the rest. In this format, ldapmodify is
happy to process the LDIF (all in one connection, but as discreet
operations).  (Note: the authenticated user has "unlimited" limits
in the config)

Given that, it sounds like it could be a bug in ldapmodify (I
don't think it's on the slapd end).  I've tested on both the
debian stable package (version 2.4.31-1+nmu2), and with a locally
compiled build direct from the project's download pages (also
2.4.31 to start with, to see if it was an introduced bug).

Has anyone else on the list seen anything like this before?

2.4.31 is over 2 years old. 2.4.41 is about to be released. Debian
is known to break their packages from time to time with ill-advised
"security" patches. You should try with freshly built source.

Yeah, we've hit that sort of thing before, and is one reason why we
have compiled our own packages in the past (not just for openldap),
but it's something we try to avoid if possible, and attempt to
re-converge on Debian packages where patches and updates we we're
applying are eventually applied in Debian.

Yesterday I complied 2.4.40 and switched the managed configuration to
use that package for the test system in question.  Unfortunately it
had the same issue.

Since writing originally, I've had a look (with my previously admitted
limited C skills) to compare any differences between ldapmodify for
the (working) 2.4.24, the (not working) 2.4.31 and the (also not
working) 2.4.40.  There's little change to speak of from what I can
see, and nothing that looked to my eye like it might be the cause
(though I've only really looked through clients/tools/ldapmodify.c,
and very briefly through libraries/libldap/modify.c)

I also see no relevant changes from 2.4.24 to the current RE for ldapmodify.c or libldap/cyrus.c (where encoding/decoding is done).

If your tools are dynamically linked, you might try mixing the tools and libraries. E.g., try the 2.4.24 ldapmodify against the newer libldap. If that reproduces the bug, then we know to look closer at libldap.

After that, I'm less sure that ldapmodify is where the problem lies
(rather it's just where I'm seeing it manifest).

Thanks for your help Howard -- if you're at FlossUK again this year I
should remember to buy you a pint by way of thanks in general (not
just as a bribe for helping me out now :) and do bring the violin
again, it's a great way to start a presentation! (Re: your talk about
mdb in Edinburgh 2012)

Ah I hadn't submitted a talk for FlossUK this year. Will see if I get sufficiently motivated to come up with one...

--
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/