1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

r17420: add client support for the LDAP_SERVER_DOMAIN_SCOPE control

metze
(This used to be commit 84e74a759cfa49ebc8b4ba1b8e729d6d920fc55a)
This commit is contained in:
Stefan Metzmacher 2006-08-05 11:38:50 +00:00 committed by Gerald (Jerry) Carter
parent 817610f385
commit 8ac0237eba
3 changed files with 50 additions and 2 deletions

View File

@ -429,6 +429,13 @@ typedef int (*ldb_qsort_cmp_fn_t) (void *v1, void *v2, void *opaque);
*/
#define LDB_CONTROL_SD_FLAGS_OID "1.2.840.113556.1.4.801"
/**
OID for specifying an advanced scope for the search (one partition)
\sa <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ldap/ldap/ldap_server_domain_scope_oid.asp">Microsoft documentation of this OID</a>
*/
#define LDB_CONTROL_DOMAIN_SCOPE_OID "1.2.840.113556.1.4.1339"
/**
OID for specifying an advanced scope for a search

View File

@ -414,8 +414,8 @@ struct ldb_control **parse_controls(void *mem_ctx, char **control_strings)
p = &(control_strings[i][15]);
ret = sscanf(p, "%d:%u", &crit, &search_options);
if ((ret != 2) || (crit < 0) || (crit > 1) || (search_options < 0) || (search_options > 0x0FFFFFFFF)) {
fprintf(stderr, "invalid sd_flags control syntax\n");
if ((ret != 2) || (crit < 0) || (crit > 1) || (search_options < 0) || (search_options > 0xF)) {
fprintf(stderr, "invalid search_options control syntax\n");
fprintf(stderr, " syntax: crit(b):search_options(n)\n");
fprintf(stderr, " note: b = boolean, n = number\n");
return NULL;
@ -431,6 +431,27 @@ struct ldb_control **parse_controls(void *mem_ctx, char **control_strings)
continue;
}
if (strncmp(control_strings[i], "domain_scope:", 13) == 0) {
const char *p;
int crit, ret;
p = &(control_strings[i][13]);
ret = sscanf(p, "%d", &crit);
if ((ret != 1) || (crit < 0) || (crit > 1)) {
fprintf(stderr, "invalid domain_scope control syntax\n");
fprintf(stderr, " syntax: crit(b)\n");
fprintf(stderr, " note: b = boolean\n");
return NULL;
}
ctrl[i] = talloc(ctrl, struct ldb_control);
ctrl[i]->oid = LDB_CONTROL_DOMAIN_SCOPE_OID;
ctrl[i]->critical = crit;
ctrl[i]->data = NULL;
continue;
}
if (strncmp(control_strings[i], "paged_results:", 14) == 0) {
struct ldb_paged_control *control;
const char *p;

View File

@ -401,6 +401,15 @@ static BOOL decode_asq_control(void *mem_ctx, DATA_BLOB in, void **out)
return True;
}
static BOOL decode_domain_scope_request(void *mem_ctx, DATA_BLOB in, void **out)
{
if (in.length != 0) {
return False;
}
return True;
}
static BOOL decode_notification_request(void *mem_ctx, DATA_BLOB in, void **out)
{
if (in.length != 0) {
@ -850,6 +859,16 @@ static BOOL encode_dirsync_request(void *mem_ctx, void *in, DATA_BLOB *out)
return True;
}
static BOOL encode_domain_scope_request(void *mem_ctx, void *in, DATA_BLOB *out)
{
if (in) {
return False;
}
*out = data_blob(NULL, 0);
return True;
}
static BOOL encode_notification_request(void *mem_ctx, void *in, DATA_BLOB *out)
{
if (in) {
@ -995,6 +1014,7 @@ struct control_handler ldap_known_controls[] = {
{ "1.2.840.113556.1.4.841", decode_dirsync_request, encode_dirsync_request },
{ "1.2.840.113556.1.4.528", decode_notification_request, encode_notification_request },
{ "1.2.840.113556.1.4.801", decode_sd_flags_request, encode_sd_flags_request },
{ "1.2.840.113556.1.4.1339", decode_domain_scope_request, encode_domain_scope_request },
{ "1.2.840.113556.1.4.1340", decode_search_options_request, encode_search_options_request },
{ "2.16.840.1.113730.3.4.2", decode_manageDSAIT_request, encode_manageDSAIT_request },
{ "2.16.840.1.113730.3.4.9", decode_vlv_request, encode_vlv_request },