2 Unix SMB/CIFS mplementation.
3 LDAP protocol helper functions for SAMBA
5 Copyright (C) Simo Sorce 2005
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "../lib/util/asn1.h"
24 #include "libcli/ldap/libcli_ldap.h"
25 #include "lib/ldb/include/ldb.h"
26 #include "libcli/ldap/ldap_proto.h"
27 #include "dsdb/samdb/samdb.h"
29 static bool decode_server_sort_response(void *mem_ctx, DATA_BLOB in, void *_out)
31 void **out = (void **)_out;
33 struct asn1_data *data = asn1_init(mem_ctx);
34 struct ldb_sort_resp_control *lsrc;
36 if (!data) return false;
38 if (!asn1_load(data, in)) {
42 lsrc = talloc(mem_ctx, struct ldb_sort_resp_control);
47 if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) {
51 if (!asn1_read_enumerated(data, &(lsrc->result))) {
55 lsrc->attr_desc = NULL;
56 if (asn1_peek_tag(data, ASN1_OCTET_STRING)) {
57 if (!asn1_read_OctetString(data, mem_ctx, &attr)) {
60 lsrc->attr_desc = talloc_strndup(lsrc, (const char *)attr.data, attr.length);
61 if (!lsrc->attr_desc) {
66 if (!asn1_end_tag(data)) {
75 static bool decode_server_sort_request(void *mem_ctx, DATA_BLOB in, void *_out)
77 void **out = (void **)_out;
80 struct asn1_data *data = asn1_init(mem_ctx);
81 struct ldb_server_sort_control **lssc;
84 if (!data) return false;
86 if (!asn1_load(data, in)) {
90 if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) {
96 for (num = 0; asn1_peek_tag(data, ASN1_SEQUENCE(0)); num++) {
97 lssc = talloc_realloc(mem_ctx, lssc, struct ldb_server_sort_control *, num + 2);
101 lssc[num] = talloc_zero(lssc, struct ldb_server_sort_control);
106 if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) {
110 if (!asn1_read_OctetString(data, mem_ctx, &attr)) {
114 lssc[num]->attributeName = talloc_strndup(lssc[num], (const char *)attr.data, attr.length);
115 if (!lssc [num]->attributeName) {
119 if (asn1_peek_tag(data, ASN1_OCTET_STRING)) {
120 if (!asn1_read_OctetString(data, mem_ctx, &rule)) {
123 lssc[num]->orderingRule = talloc_strndup(lssc[num], (const char *)rule.data, rule.length);
124 if (!lssc[num]->orderingRule) {
129 if (asn1_peek_tag(data, ASN1_CONTEXT_SIMPLE(1))) {
131 if (!asn1_read_BOOLEAN_context(data, &reverse, 1)) {
134 lssc[num]->reverse = reverse;
137 if (!asn1_end_tag(data)) {
146 if (!asn1_end_tag(data)) {
155 static bool decode_extended_dn_request(void *mem_ctx, DATA_BLOB in, void *_out)
157 void **out = (void **)_out;
158 struct asn1_data *data;
159 struct ldb_extended_dn_control *ledc;
161 /* The content of this control is optional */
162 if (in.length == 0) {
167 data = asn1_init(mem_ctx);
168 if (!data) return false;
170 if (!asn1_load(data, in)) {
174 ledc = talloc(mem_ctx, struct ldb_extended_dn_control);
179 if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) {
183 if (!asn1_read_Integer(data, &(ledc->type))) {
187 if (!asn1_end_tag(data)) {
196 static bool decode_sd_flags_request(void *mem_ctx, DATA_BLOB in, void *_out)
198 void **out = (void **)_out;
199 struct asn1_data *data = asn1_init(mem_ctx);
200 struct ldb_sd_flags_control *lsdfc;
202 if (!data) return false;
204 if (!asn1_load(data, in)) {
208 lsdfc = talloc(mem_ctx, struct ldb_sd_flags_control);
213 if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) {
217 if (!asn1_read_Integer(data, (int *) &(lsdfc->secinfo_flags))) {
221 if (!asn1_end_tag(data)) {
230 static bool decode_search_options_request(void *mem_ctx, DATA_BLOB in, void *_out)
232 void **out = (void **)_out;
233 struct asn1_data *data = asn1_init(mem_ctx);
234 struct ldb_search_options_control *lsoc;
236 if (!data) return false;
238 if (!asn1_load(data, in)) {
242 lsoc = talloc(mem_ctx, struct ldb_search_options_control);
247 if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) {
251 if (!asn1_read_Integer(data, (int *) &(lsoc->search_options))) {
255 if (!asn1_end_tag(data)) {
264 static bool decode_paged_results_request(void *mem_ctx, DATA_BLOB in, void *_out)
266 void **out = (void **)_out;
268 struct asn1_data *data = asn1_init(mem_ctx);
269 struct ldb_paged_control *lprc;
271 if (!data) return false;
273 if (!asn1_load(data, in)) {
277 lprc = talloc(mem_ctx, struct ldb_paged_control);
282 if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) {
286 if (!asn1_read_Integer(data, &(lprc->size))) {
290 if (!asn1_read_OctetString(data, mem_ctx, &cookie)) {
293 lprc->cookie_len = cookie.length;
294 if (lprc->cookie_len) {
295 lprc->cookie = talloc_memdup(lprc, cookie.data, cookie.length);
297 if (!(lprc->cookie)) {
304 if (!asn1_end_tag(data)) {
313 static bool decode_dirsync_request(void *mem_ctx, DATA_BLOB in, void *_out)
315 void **out = (void **)_out;
317 struct asn1_data *data = asn1_init(mem_ctx);
318 struct ldb_dirsync_control *ldc;
320 if (!data) return false;
322 if (!asn1_load(data, in)) {
326 ldc = talloc(mem_ctx, struct ldb_dirsync_control);
331 if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) {
335 if (!asn1_read_Integer(data, &(ldc->flags))) {
339 if (!asn1_read_Integer(data, &(ldc->max_attributes))) {
343 if (!asn1_read_OctetString(data, mem_ctx, &cookie)) {
346 ldc->cookie_len = cookie.length;
347 if (ldc->cookie_len) {
348 ldc->cookie = talloc_memdup(ldc, cookie.data, cookie.length);
350 if (!(ldc->cookie)) {
357 if (!asn1_end_tag(data)) {
366 /* seem that this controls has 2 forms one in case it is used with
367 * a Search Request and another when used ina Search Response
369 static bool decode_asq_control(void *mem_ctx, DATA_BLOB in, void *_out)
371 void **out = (void **)_out;
372 DATA_BLOB source_attribute;
373 struct asn1_data *data = asn1_init(mem_ctx);
374 struct ldb_asq_control *lac;
376 if (!data) return false;
378 if (!asn1_load(data, in)) {
382 lac = talloc(mem_ctx, struct ldb_asq_control);
387 if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) {
391 if (asn1_peek_tag(data, ASN1_OCTET_STRING)) {
393 if (!asn1_read_OctetString(data, mem_ctx, &source_attribute)) {
396 lac->src_attr_len = source_attribute.length;
397 if (lac->src_attr_len) {
398 lac->source_attribute = talloc_strndup(lac, (const char *)source_attribute.data, source_attribute.length);
400 if (!(lac->source_attribute)) {
404 lac->source_attribute = NULL;
409 } else if (asn1_peek_tag(data, ASN1_ENUMERATED)) {
411 if (!asn1_read_enumerated(data, &(lac->result))) {
421 if (!asn1_end_tag(data)) {
430 static bool decode_vlv_request(void *mem_ctx, DATA_BLOB in, void *_out)
432 void **out = (void **)_out;
433 DATA_BLOB assertion_value, context_id;
434 struct asn1_data *data = asn1_init(mem_ctx);
435 struct ldb_vlv_req_control *lvrc;
437 if (!data) return false;
439 if (!asn1_load(data, in)) {
443 lvrc = talloc(mem_ctx, struct ldb_vlv_req_control);
448 if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) {
452 if (!asn1_read_Integer(data, &(lvrc->beforeCount))) {
456 if (!asn1_read_Integer(data, &(lvrc->afterCount))) {
460 if (asn1_peek_tag(data, ASN1_CONTEXT(0))) {
464 if (!asn1_start_tag(data, ASN1_CONTEXT(0))) {
468 if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) {
472 if (!asn1_read_Integer(data, &(lvrc->match.byOffset.offset))) {
476 if (!asn1_read_Integer(data, &(lvrc->match.byOffset.contentCount))) {
480 if (!asn1_end_tag(data)) { /*SEQUENCE*/
484 if (!asn1_end_tag(data)) { /*CONTEXT*/
492 if (!asn1_start_tag(data, ASN1_CONTEXT(1))) {
496 if (!asn1_read_OctetString(data, mem_ctx, &assertion_value)) {
499 lvrc->match.gtOrEq.value_len = assertion_value.length;
500 if (lvrc->match.gtOrEq.value_len) {
501 lvrc->match.gtOrEq.value = talloc_memdup(lvrc, assertion_value.data, assertion_value.length);
503 if (!(lvrc->match.gtOrEq.value)) {
507 lvrc->match.gtOrEq.value = NULL;
510 if (!asn1_end_tag(data)) { /*CONTEXT*/
515 if (asn1_peek_tag(data, ASN1_OCTET_STRING)) {
516 if (!asn1_read_OctetString(data, mem_ctx, &context_id)) {
519 lvrc->ctxid_len = context_id.length;
520 if (lvrc->ctxid_len) {
521 lvrc->contextId = talloc_memdup(lvrc, context_id.data, context_id.length);
523 if (!(lvrc->contextId)) {
527 lvrc->contextId = NULL;
530 lvrc->contextId = NULL;
534 if (!asn1_end_tag(data)) {
543 static bool decode_vlv_response(void *mem_ctx, DATA_BLOB in, void *_out)
545 void **out = (void **)_out;
546 DATA_BLOB context_id;
547 struct asn1_data *data = asn1_init(mem_ctx);
548 struct ldb_vlv_resp_control *lvrc;
550 if (!data) return false;
552 if (!asn1_load(data, in)) {
556 lvrc = talloc(mem_ctx, struct ldb_vlv_resp_control);
561 if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) {
565 if (!asn1_read_Integer(data, &(lvrc->targetPosition))) {
569 if (!asn1_read_Integer(data, &(lvrc->contentCount))) {
573 if (!asn1_read_enumerated(data, &(lvrc->vlv_result))) {
577 if (asn1_peek_tag(data, ASN1_OCTET_STRING)) {
578 if (!asn1_read_OctetString(data, mem_ctx, &context_id)) {
581 lvrc->contextId = talloc_strndup(lvrc, (const char *)context_id.data, context_id.length);
582 if (!lvrc->contextId) {
585 lvrc->ctxid_len = context_id.length;
587 lvrc->contextId = NULL;
591 if (!asn1_end_tag(data)) {
600 static bool encode_server_sort_response(void *mem_ctx, void *in, DATA_BLOB *out)
602 struct ldb_sort_resp_control *lsrc = talloc_get_type(in, struct ldb_sort_resp_control);
603 struct asn1_data *data = asn1_init(mem_ctx);
605 if (!data) return false;
607 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) {
611 if (!asn1_write_enumerated(data, lsrc->result)) {
615 if (lsrc->attr_desc) {
616 if (!asn1_write_OctetString(data, lsrc->attr_desc, strlen(lsrc->attr_desc))) {
621 if (!asn1_pop_tag(data)) {
625 *out = data_blob_talloc(mem_ctx, data->data, data->length);
626 if (out->data == NULL) {
634 static bool encode_server_sort_request(void *mem_ctx, void *in, DATA_BLOB *out)
636 struct ldb_server_sort_control **lssc = talloc_get_type(in, struct ldb_server_sort_control *);
637 struct asn1_data *data = asn1_init(mem_ctx);
640 if (!data) return false;
642 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) {
648 SortKeyList ::= SEQUENCE OF SEQUENCE {
649 attributeType AttributeDescription,
650 orderingRule [0] MatchingRuleId OPTIONAL,
651 reverseOrder [1] BOOLEAN DEFAULT FALSE }
653 for (num = 0; lssc[num]; num++) {
654 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) {
658 if (!asn1_write_OctetString(data, lssc[num]->attributeName, strlen(lssc[num]->attributeName))) {
662 if (lssc[num]->orderingRule) {
663 if (!asn1_write_OctetString(data, lssc[num]->orderingRule, strlen(lssc[num]->orderingRule))) {
668 if (lssc[num]->reverse) {
669 if (!asn1_write_BOOLEAN_context(data, lssc[num]->reverse, 1)) {
674 if (!asn1_pop_tag(data)) {
679 if (!asn1_pop_tag(data)) {
683 *out = data_blob_talloc(mem_ctx, data->data, data->length);
684 if (out->data == NULL) {
692 static bool encode_extended_dn_request(void *mem_ctx, void *in, DATA_BLOB *out)
694 struct ldb_extended_dn_control *ledc = talloc_get_type(in, struct ldb_extended_dn_control);
695 struct asn1_data *data;
698 *out = data_blob(NULL, 0);
702 data = asn1_init(mem_ctx);
704 if (!data) return false;
706 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) {
710 if (!asn1_write_Integer(data, ledc->type)) {
714 if (!asn1_pop_tag(data)) {
718 *out = data_blob_talloc(mem_ctx, data->data, data->length);
719 if (out->data == NULL) {
727 static bool encode_sd_flags_request(void *mem_ctx, void *in, DATA_BLOB *out)
729 struct ldb_sd_flags_control *lsdfc = talloc_get_type(in, struct ldb_sd_flags_control);
730 struct asn1_data *data = asn1_init(mem_ctx);
732 if (!data) return false;
734 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) {
738 if (!asn1_write_Integer(data, lsdfc->secinfo_flags)) {
742 if (!asn1_pop_tag(data)) {
746 *out = data_blob_talloc(mem_ctx, data->data, data->length);
747 if (out->data == NULL) {
755 static bool encode_search_options_request(void *mem_ctx, void *in, DATA_BLOB *out)
757 struct ldb_search_options_control *lsoc = talloc_get_type(in, struct ldb_search_options_control);
758 struct asn1_data *data = asn1_init(mem_ctx);
760 if (!data) return false;
762 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) {
766 if (!asn1_write_Integer(data, lsoc->search_options)) {
770 if (!asn1_pop_tag(data)) {
774 *out = data_blob_talloc(mem_ctx, data->data, data->length);
775 if (out->data == NULL) {
783 static bool encode_paged_results_request(void *mem_ctx, void *in, DATA_BLOB *out)
785 struct ldb_paged_control *lprc = talloc_get_type(in, struct ldb_paged_control);
786 struct asn1_data *data = asn1_init(mem_ctx);
788 if (!data) return false;
790 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) {
794 if (!asn1_write_Integer(data, lprc->size)) {
798 if (!asn1_write_OctetString(data, lprc->cookie, lprc->cookie_len)) {
802 if (!asn1_pop_tag(data)) {
806 *out = data_blob_talloc(mem_ctx, data->data, data->length);
807 if (out->data == NULL) {
815 /* seem that this controls has 2 forms one in case it is used with
816 * a Search Request and another when used ina Search Response
818 static bool encode_asq_control(void *mem_ctx, void *in, DATA_BLOB *out)
820 struct ldb_asq_control *lac = talloc_get_type(in, struct ldb_asq_control);
821 struct asn1_data *data = asn1_init(mem_ctx);
823 if (!data) return false;
825 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) {
831 if (!asn1_write_OctetString(data, lac->source_attribute, lac->src_attr_len)) {
835 if (!asn1_write_enumerated(data, lac->result)) {
840 if (!asn1_pop_tag(data)) {
844 *out = data_blob_talloc(mem_ctx, data->data, data->length);
845 if (out->data == NULL) {
853 static bool encode_dirsync_request(void *mem_ctx, void *in, DATA_BLOB *out)
855 struct ldb_dirsync_control *ldc = talloc_get_type(in, struct ldb_dirsync_control);
856 struct asn1_data *data = asn1_init(mem_ctx);
858 if (!data) return false;
860 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) {
864 if (!asn1_write_Integer(data, ldc->flags)) {
868 if (!asn1_write_Integer(data, ldc->max_attributes)) {
872 if (!asn1_write_OctetString(data, ldc->cookie, ldc->cookie_len)) {
876 if (!asn1_pop_tag(data)) {
880 *out = data_blob_talloc(mem_ctx, data->data, data->length);
881 if (out->data == NULL) {
889 static bool encode_vlv_request(void *mem_ctx, void *in, DATA_BLOB *out)
891 struct ldb_vlv_req_control *lvrc = talloc_get_type(in, struct ldb_vlv_req_control);
892 struct asn1_data *data = asn1_init(mem_ctx);
894 if (!data) return false;
896 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) {
900 if (!asn1_write_Integer(data, lvrc->beforeCount)) {
904 if (!asn1_write_Integer(data, lvrc->afterCount)) {
908 if (lvrc->type == 0) {
909 if (!asn1_push_tag(data, ASN1_CONTEXT(0))) {
913 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) {
917 if (!asn1_write_Integer(data, lvrc->match.byOffset.offset)) {
921 if (!asn1_write_Integer(data, lvrc->match.byOffset.contentCount)) {
925 if (!asn1_pop_tag(data)) { /*SEQUENCE*/
929 if (!asn1_pop_tag(data)) { /*CONTEXT*/
933 if (!asn1_push_tag(data, ASN1_CONTEXT(1))) {
937 if (!asn1_write_OctetString(data, lvrc->match.gtOrEq.value, lvrc->match.gtOrEq.value_len)) {
941 if (!asn1_pop_tag(data)) { /*CONTEXT*/
946 if (lvrc->ctxid_len) {
947 if (!asn1_write_OctetString(data, lvrc->contextId, lvrc->ctxid_len)) {
952 if (!asn1_pop_tag(data)) {
956 *out = data_blob_talloc(mem_ctx, data->data, data->length);
957 if (out->data == NULL) {
965 static bool encode_vlv_response(void *mem_ctx, void *in, DATA_BLOB *out)
967 struct ldb_vlv_resp_control *lvrc = talloc_get_type(in, struct ldb_vlv_resp_control);
968 struct asn1_data *data = asn1_init(mem_ctx);
970 if (!data) return false;
972 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) {
976 if (!asn1_write_Integer(data, lvrc->targetPosition)) {
980 if (!asn1_write_Integer(data, lvrc->contentCount)) {
984 if (!asn1_write_enumerated(data, lvrc->vlv_result)) {
988 if (lvrc->ctxid_len) {
989 if (!asn1_write_OctetString(data, lvrc->contextId, lvrc->ctxid_len)) {
994 if (!asn1_pop_tag(data)) {
998 *out = data_blob_talloc(mem_ctx, data->data, data->length);
999 if (out->data == NULL) {
1007 static bool encode_openldap_dereference(void *mem_ctx, void *in, DATA_BLOB *out)
1009 struct dsdb_openldap_dereference_control *control = talloc_get_type(in, struct dsdb_openldap_dereference_control);
1011 struct asn1_data *data = asn1_init(mem_ctx);
1013 if (!data) return false;
1015 if (!control) return false;
1017 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) {
1021 for (i=0; control->dereference && control->dereference[i]; i++) {
1022 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) {
1025 if (!asn1_write_OctetString(data, control->dereference[i]->source_attribute, strlen(control->dereference[i]->source_attribute))) {
1028 if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) {
1031 for (j=0; control->dereference && control->dereference[i]->dereference_attribute[j]; j++) {
1032 if (!asn1_write_OctetString(data, control->dereference[i]->dereference_attribute[j],
1033 strlen(control->dereference[i]->dereference_attribute[j]))) {
1043 *out = data_blob_talloc(mem_ctx, data->data, data->length);
1044 if (out->data == NULL) {
1051 static bool decode_openldap_dereference(void *mem_ctx, DATA_BLOB in, void *_out)
1053 void **out = (void **)_out;
1054 struct asn1_data *data = asn1_init(mem_ctx);
1055 struct dsdb_openldap_dereference_result_control *control;
1056 struct dsdb_openldap_dereference_result **r = NULL;
1058 if (!data) return false;
1060 control = talloc(mem_ctx, struct dsdb_openldap_dereference_result_control);
1061 if (!control) return false;
1063 if (!asn1_load(data, in)) {
1067 control = talloc(mem_ctx, struct dsdb_openldap_dereference_result_control);
1072 if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) {
1076 while (asn1_tag_remaining(data) > 0) {
1077 r = talloc_realloc(control, r, struct dsdb_openldap_dereference_result *, i + 2);
1081 r[i] = talloc_zero(r, struct dsdb_openldap_dereference_result);
1086 if (!asn1_start_tag(data, ASN1_SEQUENCE(0))) {
1090 asn1_read_OctetString_talloc(r[i], data, &r[i]->source_attribute);
1091 asn1_read_OctetString_talloc(r[i], data, &r[i]->dereferenced_dn);
1092 if (asn1_peek_tag(data, ASN1_CONTEXT(0))) {
1093 if (!asn1_start_tag(data, ASN1_CONTEXT(0))) {
1097 ldap_decode_attribs_bare(r, data, &r[i]->attributes,
1098 &r[i]->num_attributes);
1100 if (!asn1_end_tag(data)) {
1104 if (!asn1_end_tag(data)) {
1111 if (!asn1_end_tag(data)) {
1115 control->attributes = r;
1121 static bool encode_flag_request(void *mem_ctx, void *in, DATA_BLOB *out)
1127 *out = data_blob(NULL, 0);
1131 static bool decode_flag_request(void *mem_ctx, DATA_BLOB in, void *_out)
1133 if (in.length != 0) {
1140 static const struct ldap_control_handler ldap_known_controls[] = {
1141 { "1.2.840.113556.1.4.319", decode_paged_results_request, encode_paged_results_request },
1142 { "1.2.840.113556.1.4.529", decode_extended_dn_request, encode_extended_dn_request },
1143 { "1.2.840.113556.1.4.473", decode_server_sort_request, encode_server_sort_request },
1144 { "1.2.840.113556.1.4.474", decode_server_sort_response, encode_server_sort_response },
1145 { "1.2.840.113556.1.4.1504", decode_asq_control, encode_asq_control },
1146 { "1.2.840.113556.1.4.841", decode_dirsync_request, encode_dirsync_request },
1147 { "1.2.840.113556.1.4.528", decode_flag_request, encode_flag_request },
1148 { "1.2.840.113556.1.4.805", decode_flag_request, encode_flag_request },
1149 { "1.2.840.113556.1.4.417", decode_flag_request, encode_flag_request },
1150 { "1.2.840.113556.1.4.2064", decode_flag_request, encode_flag_request },
1151 { "1.2.840.113556.1.4.2065", decode_flag_request, encode_flag_request },
1152 { "1.2.840.113556.1.4.1413", decode_flag_request, encode_flag_request },
1153 { "1.2.840.113556.1.4.801", decode_sd_flags_request, encode_sd_flags_request },
1154 { "1.2.840.113556.1.4.1339", decode_flag_request, encode_flag_request },
1155 { "1.2.840.113556.1.4.1340", decode_search_options_request, encode_search_options_request },
1156 { "2.16.840.1.113730.3.4.2", decode_flag_request, encode_flag_request },
1157 { "2.16.840.1.113730.3.4.9", decode_vlv_request, encode_vlv_request },
1158 { "2.16.840.1.113730.3.4.10", decode_vlv_response, encode_vlv_response },
1159 /* DSDB_CONTROL_CURRENT_PARTITION_OID is internal only, and has no network representation */
1160 { "1.3.6.1.4.1.7165.4.3.2", NULL, NULL },
1161 /* DSDB_CONTROL_DN_STORAGE_FORMAT_OID is internal only, and has no network representation */
1162 { "1.3.6.1.4.1.7165.4.3.4", NULL, NULL },
1163 /* LDB_CONTROL_REVEAL_INTERNALS is internal only, and has no network representation */
1164 { "1.3.6.1.4.1.7165.4.3.6", NULL, NULL },
1165 /* LDB_CONTROL_AS_SYSTEM_OID is internal only, and has no network representation */
1166 { "1.3.6.1.4.1.7165.4.3.7", NULL, NULL },
1167 /* DSDB_CONTROL_PASSWORD_CHANGE_STATUS_OID is internal only, and has no network representation */
1168 { "1.3.6.1.4.1.7165.4.3.8", NULL, NULL },
1169 /* DSDB_EXTENDED_REPLICATED_OBJECTS_OID is internal only, and has no network representation */
1170 { "1.3.6.1.4.1.7165.4.4.1", NULL, NULL },
1171 { DSDB_OPENLDAP_DEREFERENCE_CONTROL, decode_openldap_dereference, encode_openldap_dereference},
1172 { LDB_CONTROL_RELAX_OID, decode_flag_request, encode_flag_request },
1173 { NULL, NULL, NULL }
1176 const struct ldap_control_handler *samba_ldap_control_handlers(void)
1178 return ldap_known_controls;