mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
s4-ldb: added a new "reveal" control
This control will allow inspection of internal ldb values, which would normally be stripped before being presented to users. The first use will be stripping linked attribute meta data extended components.
This commit is contained in:
parent
56b90acbf6
commit
725e25a206
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user