}
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) {
}
case LDAP_TAG_UnbindRequest: {
/* struct ldap_UnbindRequest *r = &msg->r.UnbindRequest; */
+ asn1_push_tag(data, ASN1_APPLICATION_SIMPLE(msg->type));
+ asn1_pop_tag(data);
break;
}
case LDAP_TAG_SearchRequest: {
if (!ldap_encode_control(mem_ctx, data,
control_handlers,
msg->controls[i])) {
+ DEBUG(1,("Unable to encode control %s\n",
+ msg->controls[i]->oid));
return false;
}
}
msg->type = LDAP_TAG_SearchRequest;
asn1_start_tag(data, tag);
asn1_read_OctetString_talloc(msg, data, &r->basedn);
- asn1_read_enumerated(data, (int *)&(r->scope));
- asn1_read_enumerated(data, (int *)&(r->deref));
+ asn1_read_enumerated(data, (int *)(void *)&(r->scope));
+ asn1_read_enumerated(data, (int *)(void *)&(r->deref));
asn1_read_Integer(data, &sizelimit);
r->sizelimit = sizelimit;
asn1_read_Integer(data, &timelimit);
*/
NTSTATUS ldap_full_packet(void *private_data, DATA_BLOB blob, size_t *packet_size)
{
- return asn1_full_tag(blob, ASN1_SEQUENCE(0), packet_size);
+ if (blob.length < 6) {
+ /*
+ * We need at least 6 bytes to workout the length
+ * of the pdu.
+ */
+ return STATUS_MORE_ENTRIES;
+ }
+ return asn1_peek_full_tag(blob, ASN1_SEQUENCE(0), packet_size);
}