1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

dsdb: Add dsdb_search_scope_as_string() and use in ldap_backend.c

This will be useful when adding debugging to other routines.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Andrew Bartlett 2023-07-31 16:02:25 +12:00 committed by Stefan Metzmacher
parent 5cc861603a
commit acf6d89c3e
2 changed files with 23 additions and 3 deletions

View File

@ -5277,6 +5277,27 @@ int dsdb_replace(struct ldb_context *ldb, struct ldb_message *msg, uint32_t dsdb
return dsdb_modify(ldb, msg, dsdb_flags);
}
const char *dsdb_search_scope_as_string(enum ldb_scope scope)
{
const char *scope_str;
switch (scope) {
case LDB_SCOPE_BASE:
scope_str = "BASE";
break;
case LDB_SCOPE_ONELEVEL:
scope_str = "ONE";
break;
case LDB_SCOPE_SUBTREE:
scope_str = "SUB";
break;
default:
scope_str = "<Invalid scope>";
break;
}
return scope_str;
}
/*
search for attrs on one DN, allowing for dsdb_flags controls

View File

@ -770,15 +770,12 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call)
switch (req->scope) {
case LDAP_SEARCH_SCOPE_BASE:
scope_str = "BASE";
scope = LDB_SCOPE_BASE;
break;
case LDAP_SEARCH_SCOPE_SINGLE:
scope_str = "ONE";
scope = LDB_SCOPE_ONELEVEL;
break;
case LDAP_SEARCH_SCOPE_SUB:
scope_str = "SUB";
scope = LDB_SCOPE_SUBTREE;
break;
default:
@ -790,6 +787,8 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call)
"%s. Invalid scope", errstr);
goto reply;
}
scope_str = dsdb_search_scope_as_string(scope);
DEBUG(10,("SearchRequest: scope: [%s]\n", scope_str));
if (req->num_attributes >= 1) {