GNU bug report logs - #64089
30.0.50; `ldap-search' errors out with `wrong-type-argument listp' when called WITHDN == t

Previous Next

Package: emacs;

Reported by: Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>

Date: Thu, 15 Jun 2023 21:29:02 UTC

Severity: normal

Fixed in version 30.0.50

Done: Filipp Gunbin <fgunbin <at> fastmail.fm>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 64089 <at> debbugs.gnu.org, Jens Schmidt <jschmidt4gnu <at> vodafonemail.de>
Subject: bug#64089: 30.0.50; `ldap-search' errors out with `wrong-type-argument listp' when called WITHDN == t)
Date: Fri, 16 Jun 2023 11:12:10 -0400
>> 
>> (ldap-search "(uid=<uid>)"
>>                "ldap://<host>"
>>                '("mail")
>>                nil
>>                t)
>> => ((("dn" "cn=<NAME>,L=<REGION>,DC=<DOMAIN>,DC=COM") ("mail" 
>> "<name>@<domain>.com")))
>> 
>> I tried to make the patch as conservative as possible and intentionally 
>> do not check syntax of the dn line if its parsing is not required.
>
>> @@ -703,7 +703,17 @@ ldap-search-internal
>>  	(while (progn
>>  		 (skip-chars-forward " \t\n")
>>  		 (not (eobp)))
>> -          (setq dn (buffer-substring (point) (line-end-position)))
>> +          ;; Ignore first (dn) line if WITHDN equals nil.  If WITHDN
>> +          ;; is non-nil, check syntax of the line and split it into a
>> +          ;; pair as expected by `ldap-decode-attribute' (Bug#64089).
>> +          ;; If the syntax is wrong, better throw an error here, since
>> +          ;; otherwise `ldap-decode-attribute' would throw a much less
>> +          ;; comprehensible error later.
>> +          (cond ((not withdn))
>> +                ((looking-at "^dn[=:\t ]+\\(.*\\)$")
>> +                 (setq dn (list "dn" (match-string 1))))
>> +                (t (error "Incorrect dn line \"%s\" in ldapsearch result"
>> +                          (buffer-substring (point) (line-end-position)))))
>>  	  (forward-line 1)
>>            (while (looking-at "^\\([A-Za-z][-A-Za-z0-9]*\
>>  \\|[0-9]+\\(?:\\.[0-9]+\\)*\\)\\(;[-A-Za-z0-9]+\\)*[=:\t ]+\
>
> Stefan, any comments?

I've no practical experience with LDAP and am not very knowledgeable
about `ldap.el`, so take my opinion with a large grain of MSG.

> I think this is okay for emacs-29; do you agree?

This looks fine to me, indeed.  Just one thing: the regexp doesn't need
the `^`, right?


        Stefan





This bug report was last modified 2 years and 28 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.