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

Re: str2result() and slapd-sock

Michael Ströder wrote:
> I'm trying to find out why slapd-socks always outputs all lines returned by
> the external sock listeners with comment "unknown" although everything seems
> to work correctly.
> ----------------------------- snip -----------------------------
> 5603fc08 conn=1000 op=1 BIND dn="uid=äöüÄÖÜß,ou=realdb,dc=example,dc=org"
> method=128
> 5603fc08 str2result (msgid: 2
> code: 49
> matched: uid=äöüÄÖÜß,ou=realdb,dc=example,dc=org
> info: You loose! (wrong password)
> ) unknown
> 5603fc08 str2result (
> ) unknown
> 5603fc08 conn=1000 op=1 RESULT tag=97 err=49 text= You loose! (wrong password)
> ----------------------------- snip -----------------------------
> The (correct) Python string returned by the listener was:
> 'RESULT\nmsgid: 2\ncode: 49\nmatched:
> uid=\xc3\xa4\xc3\xb6\xc3\xbc\xc3\x84\xc3\x96\xc3\x9c\xc3\x9f,ou=realdb,dc=example,dc=org\ninfo:
> You loose! (wrong password)\n\n'
> I tried to understand what's going on in str2result()
> (in file servers/slapd/result.c) but failed.
> AFAICS in slapd-sock(5) the external listener should always return a line with
> "code: <digit>" after the "RESULT" line. But to me it seems that the function
> would return with rc=0 if there's only a single "RESULT" line (due to break in
> line 1674).
> And I also can't see why the else clause in 1727 is reached.
> I wonder whether slapd-sock is confused by the two trailing line feeds.

AFAICT the else statement with the debug statement is hit because the
"RESULT\n" line is not really consumed before the while loop (line 1671) and
that results in this wrong output. s is still at the beginning of "RESULT\n"
line when entering the while loop.

Is that correct?

Ciao, Michael.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature