[python-ldap] [PATCH] Fix check for an empty error message
Michael Ströder
michael at stroeder.com
Fri Jan 6 10:11:29 EST 2017
Bradley Baetz via python-ldap wrote:
> When trying to get the server's error message, check if the string is empty
> rather than checking the pointer against '\0'. (This is already NULL-checked
> in the previous line)
Thanks for your fix.
Your patch got badly formatted in the HTML mail.
But I've committed this to CVS HEAD (see below).
Could you please elaborate a bit on how this affected your python-ldap usage.
Such a note in file CHANGES might be helpful for others.
Ciao, Michael.
P.S.: Please subscribe to the low-traffic python-ldap mailing list. So I don't
have to approve all your postings and you'll get all responses.
Index: Modules/errors.c
===================================================================
RCS file: /cvsroot/python-ldap/python-ldap/Modules/errors.c,v
retrieving revision 1.25
diff -u -r1.25 errors.c
--- Modules/errors.c 23 Jun 2015 09:45:09 -0000 1.25
+++ Modules/errors.c 6 Jan 2017 15:00:24 -0000
@@ -98,7 +98,7 @@
Py_XDECREF(str);
} else if (ldap_get_option(l, LDAP_OPT_ERROR_STRING, &error) >= 0
&& error != NULL) {
- if (error != '\0') {
+ if (*error != '\0') {
str = PyString_FromString(error);
if (str)
PyDict_SetItemString( info, "info", str );
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3829 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20170106/55eb5937/attachment.bin>
More information about the python-ldap
mailing list