diff options
-rw-r--r-- | source4/lib/ldb/common/ldb_controls.c | 27 | ||||
-rw-r--r-- | source4/lib/ldb/include/ldb.h | 10 | ||||
-rw-r--r-- | source4/lib/ldb/tools/cmdline.c | 7 |
3 files changed, 43 insertions, 1 deletions
diff --git a/source4/lib/ldb/common/ldb_controls.c b/source4/lib/ldb/common/ldb_controls.c index f2ab61bde6..8da43ab9b1 100644 --- a/source4/lib/ldb/common/ldb_controls.c +++ b/source4/lib/ldb/common/ldb_controls.c @@ -775,6 +775,33 @@ struct ldb_control **ldb_parse_control_strings(struct ldb_context *ldb, void *me continue; } + if (strncmp(control_strings[i], "reveal_internals:", 17) == 0) { + const char *p; + int crit, ret; + + p = &(control_strings[i][17]); + ret = sscanf(p, "%d", &crit); + if ((ret != 1) || (crit < 0) || (crit > 1)) { + error_string = talloc_asprintf(mem_ctx, "invalid reveal_internals control syntax\n"); + error_string = talloc_asprintf_append(error_string, " syntax: crit(b)\n"); + error_string = talloc_asprintf_append(error_string, " note: b = boolean"); + ldb_set_errstring(ldb, error_string); + talloc_free(error_string); + return NULL; + } + + ctrl[i] = talloc(ctrl, struct ldb_control); + if (!ctrl[i]) { + ldb_oom(ldb); + return NULL; + } + ctrl[i]->oid = LDB_CONTROL_REVEAL_INTERNALS; + ctrl[i]->critical = crit; + ctrl[i]->data = NULL; + + continue; + } + /* no controls matched, throw an error */ ldb_asprintf_errstring(ldb, "Invalid control name: '%s'", control_strings[i]); return NULL; diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h index 88ac29d943..2b80e42cb3 100644 --- a/source4/lib/ldb/include/ldb.h +++ b/source4/lib/ldb/include/ldb.h @@ -470,6 +470,14 @@ typedef int (*ldb_qsort_cmp_fn_t) (void *v1, void *v2, void *opaque); */ #define LDB_CONTROL_RECALCULATE_SD_OID "1.3.6.1.4.1.7165.4.3.5" + +/** + REVEAL_INTERNALS is used to reveal internal attributes and DN + components which are not normally shown to the user +*/ +#define LDB_CONTROL_REVEAL_INTERNALS "1.3.6.1.4.1.7165.4.3.6" + + /** OID for the paged results control. This control is included in the searchRequest and searchResultDone messages as part of the controls @@ -1617,7 +1625,7 @@ char *ldb_dn_alloc_linearized(TALLOC_CTX *mem_ctx, struct ldb_dn *dn); char *ldb_dn_get_extended_linearized(void *mem_ctx, struct ldb_dn *dn, int mode); const struct ldb_val *ldb_dn_get_extended_component(struct ldb_dn *dn, const char *name); int ldb_dn_set_extended_component(struct ldb_dn *dn, const char *name, const struct ldb_val *val); - +void ldb_dn_extended_filter(struct ldb_dn *dn, const char * const *accept); void ldb_dn_remove_extended_components(struct ldb_dn *dn); bool ldb_dn_has_extended(struct ldb_dn *dn); diff --git a/source4/lib/ldb/tools/cmdline.c b/source4/lib/ldb/tools/cmdline.c index e27ca5b6a6..5204215778 100644 --- a/source4/lib/ldb/tools/cmdline.c +++ b/source4/lib/ldb/tools/cmdline.c @@ -61,6 +61,7 @@ static struct poptOption popt_options[] = { { "paged", 0, POPT_ARG_NONE, NULL, 'P', "use a paged search", NULL }, { "show-deleted", 0, POPT_ARG_NONE, NULL, 'D', "show deleted objects", NULL }, { "show-recycled", 0, POPT_ARG_NONE, NULL, 'R', "show recycled objects", NULL }, + { "reveal", 0, POPT_ARG_NONE, NULL, 'r', "reveal ldb internals", NULL }, { "cross-ncs", 0, POPT_ARG_NONE, NULL, 'N', "search across NC boundaries", NULL }, { "extended-dn", 0, POPT_ARG_NONE, NULL, 'E', "show extended DNs", NULL }, #if (_SAMBA_BUILD_ >= 4) @@ -225,6 +226,12 @@ struct ldb_cmdline *ldb_cmdline_process(struct ldb_context *ldb, goto failed; } break; + case 'r': + if (!add_control(ret, "reveal_internals:0")) { + fprintf(stderr, __location__ ": out of memory\n"); + goto failed; + } + break; case 'N': if (!add_control(ret, "search_options:1:2")) { fprintf(stderr, __location__ ": out of memory\n"); |