libcli/ldap Don't try and encode a control with a NULL OID
authorAndrew Bartlett <abartlet@samba.org>
Wed, 20 Oct 2010 03:27:57 +0000 (14:27 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 20 Oct 2010 04:13:44 +0000 (04:13 +0000)
ctrl->oid is set to NULL by the Samba4 rootDSE module when removing
controls that should not be exposed over LDAP (to avoid a realloc).

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Wed Oct 20 04:13:44 UTC 2010 on sn-devel-104

libcli/ldap/ldap_message.c

index b9f9dff223a7fe2007a7981b03972e23c22dd3b9..7756e731b247fd08796c0303d228dd5eaf098d22 100644 (file)
@@ -167,6 +167,12 @@ static bool ldap_encode_control(void *mem_ctx, struct asn1_data *data,
        }
 
        for (i = 0; handlers[i].oid != NULL; i++) {
+               if (!ctrl->oid) {
+                       /* not encoding this control, the OID has been
+                        * set to NULL indicating it isn't really
+                        * here */
+                       return true;
+               }
                if (strcmp(handlers[i].oid, ctrl->oid) == 0) {
                        if (!handlers[i].encode) {
                                if (ctrl->critical) {