LDAP: detect non-binary attributes properly
authorAlfred Gebert <alfred.gebert@gmail.com>
Fri, 5 Nov 2010 14:53:41 +0000 (15:53 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 5 Nov 2010 14:53:41 +0000 (15:53 +0100)
If the query result has a binary attribute, the binary attribute is
base64 encoded. But all following non binary attributes are also base64
encoded which is wrong.

This is a test (LDAP server is public).

curl
ldap://x500.bund.de:389/o=Bund,c=DE?userCertificate,certificateSerialNumber?sub
?cn=*Woehleke*

lib/openldap.c

index 4d5db4a..ee4915f 100644 (file)
@@ -499,6 +499,8 @@ static ssize_t ldap_recv(struct connectdata *conn, int sockindex, char *buf,
 
       if (bv.bv_len > 7 && !strncmp(bv.bv_val + bv.bv_len - 7, ";binary", 7))
         binary = 1;
+      else
+        binary = 0;
 
       for (i=0; bvals[i].bv_val != NULL; i++) {
         int binval = 0;