libcli/security: fix sid_type_lookup().
[kai/samba.git] / 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) {