mirror of
https://github.com/samba-team/samba.git
synced 2025-11-08 16:23:49 +03:00
ldap: Make use of LDB_OID_COMPARATOR constants
These constants allow one to tell at a glance what search operation is being performed. Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
committed by
Andrew Bartlett
parent
618d95822e
commit
c17e46a231
@@ -1717,7 +1717,7 @@ static NTSTATUS pdb_samba_dsdb_enum_alias_memberships(struct pdb_methods *m,
|
|||||||
* either the SAM or BUILTIN
|
* either the SAM or BUILTIN
|
||||||
*/
|
*/
|
||||||
|
|
||||||
filter = talloc_asprintf(tmp_ctx, "(&(objectClass=group)(groupType:1.2.840.113556.1.4.803:=%u))",
|
filter = talloc_asprintf(tmp_ctx, "(&(objectClass=group)(groupType:"LDB_OID_COMPARATOR_AND":=%u))",
|
||||||
GROUP_TYPE_BUILTIN_LOCAL_GROUP);
|
GROUP_TYPE_BUILTIN_LOCAL_GROUP);
|
||||||
if (filter == NULL) {
|
if (filter == NULL) {
|
||||||
return NT_STATUS_NO_MEMORY;
|
return NT_STATUS_NO_MEMORY;
|
||||||
|
|||||||
@@ -315,13 +315,13 @@ static NTSTATUS authsam_domain_group_filter(TALLOC_CTX *mem_ctx,
|
|||||||
* Skip all builtin groups, they're added later.
|
* Skip all builtin groups, they're added later.
|
||||||
*/
|
*/
|
||||||
talloc_asprintf_addbuf(&filter,
|
talloc_asprintf_addbuf(&filter,
|
||||||
"(!(groupType:1.2.840.113556.1.4.803:=%u))",
|
"(!(groupType:"LDB_OID_COMPARATOR_AND":=%u))",
|
||||||
GROUP_TYPE_BUILTIN_LOCAL_GROUP);
|
GROUP_TYPE_BUILTIN_LOCAL_GROUP);
|
||||||
/*
|
/*
|
||||||
* Only include security groups.
|
* Only include security groups.
|
||||||
*/
|
*/
|
||||||
talloc_asprintf_addbuf(&filter,
|
talloc_asprintf_addbuf(&filter,
|
||||||
"(groupType:1.2.840.113556.1.4.803:=%u))",
|
"(groupType:"LDB_OID_COMPARATOR_AND":=%u))",
|
||||||
GROUP_TYPE_SECURITY_ENABLED);
|
GROUP_TYPE_SECURITY_ENABLED);
|
||||||
if (filter == NULL) {
|
if (filter == NULL) {
|
||||||
return NT_STATUS_NO_MEMORY;
|
return NT_STATUS_NO_MEMORY;
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ _PUBLIC_ NTSTATUS auth_generate_session_info(TALLOC_CTX *mem_ctx,
|
|||||||
} else if (num_sids > PRIMARY_USER_SID_INDEX && dom_sid_equal(system_sid, &sids[PRIMARY_USER_SID_INDEX].sid)) {
|
} else if (num_sids > PRIMARY_USER_SID_INDEX && dom_sid_equal(system_sid, &sids[PRIMARY_USER_SID_INDEX].sid)) {
|
||||||
/* Don't expand nested groups of system, anonymous etc*/
|
/* Don't expand nested groups of system, anonymous etc*/
|
||||||
} else if (sam_ctx) {
|
} else if (sam_ctx) {
|
||||||
filter = talloc_asprintf(tmp_ctx, "(&(objectClass=group)(groupType:1.2.840.113556.1.4.803:=%u))",
|
filter = talloc_asprintf(tmp_ctx, "(&(objectClass=group)(groupType:"LDB_OID_COMPARATOR_AND":=%u))",
|
||||||
GROUP_TYPE_BUILTIN_LOCAL_GROUP);
|
GROUP_TYPE_BUILTIN_LOCAL_GROUP);
|
||||||
|
|
||||||
/* Search for each group in the token */
|
/* Search for each group in the token */
|
||||||
|
|||||||
@@ -194,18 +194,29 @@ static int get_group_sids(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
|
|||||||
/* only return security groups */
|
/* only return security groups */
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case TOKEN_GROUPS_GLOBAL_AND_UNIVERSAL:
|
case TOKEN_GROUPS_GLOBAL_AND_UNIVERSAL:
|
||||||
filter = talloc_asprintf(mem_ctx, "(&(objectClass=group)(groupType:1.2.840.113556.1.4.803:=%u)(|(groupType:1.2.840.113556.1.4.803:=%u)(groupType:1.2.840.113556.1.4.803:=%u)))",
|
filter = talloc_asprintf(mem_ctx,
|
||||||
GROUP_TYPE_SECURITY_ENABLED, GROUP_TYPE_ACCOUNT_GROUP, GROUP_TYPE_UNIVERSAL_GROUP);
|
"(&(objectClass=group)"
|
||||||
|
"(groupType:"LDB_OID_COMPARATOR_AND":=%u)"
|
||||||
|
"(|(groupType:"LDB_OID_COMPARATOR_AND":=%u)"
|
||||||
|
"(groupType:"LDB_OID_COMPARATOR_AND":=%u)))",
|
||||||
|
GROUP_TYPE_SECURITY_ENABLED,
|
||||||
|
GROUP_TYPE_ACCOUNT_GROUP,
|
||||||
|
GROUP_TYPE_UNIVERSAL_GROUP);
|
||||||
break;
|
break;
|
||||||
case TOKEN_GROUPS_NO_GC_ACCEPTABLE:
|
case TOKEN_GROUPS_NO_GC_ACCEPTABLE:
|
||||||
case TOKEN_GROUPS:
|
case TOKEN_GROUPS:
|
||||||
filter = talloc_asprintf(mem_ctx, "(&(objectClass=group)(groupType:1.2.840.113556.1.4.803:=%u))",
|
filter = talloc_asprintf(mem_ctx,
|
||||||
|
"(&(objectClass=group)"
|
||||||
|
"(groupType:"LDB_OID_COMPARATOR_AND":=%u))",
|
||||||
GROUP_TYPE_SECURITY_ENABLED);
|
GROUP_TYPE_SECURITY_ENABLED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* for RevMembGetAccountGroups, exclude built-in groups */
|
/* for RevMembGetAccountGroups, exclude built-in groups */
|
||||||
case ACCOUNT_GROUPS:
|
case ACCOUNT_GROUPS:
|
||||||
filter = talloc_asprintf(mem_ctx, "(&(objectClass=group)(!(groupType:1.2.840.113556.1.4.803:=%u))(groupType:1.2.840.113556.1.4.803:=%u))",
|
filter = talloc_asprintf(mem_ctx,
|
||||||
|
"(&(objectClass=group)"
|
||||||
|
"(!(groupType:"LDB_OID_COMPARATOR_AND":=%u))"
|
||||||
|
"(groupType:"LDB_OID_COMPARATOR_AND":=%u))",
|
||||||
GROUP_TYPE_BUILTIN_LOCAL_GROUP, GROUP_TYPE_SECURITY_ENABLED);
|
GROUP_TYPE_BUILTIN_LOCAL_GROUP, GROUP_TYPE_SECURITY_ENABLED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -682,7 +682,7 @@ static WERROR dcesrv_drsuapi_DsGetDomainControllerInfo_1(struct drsuapi_bind_sta
|
|||||||
|
|
||||||
ret = ldb_search(b_state->sam_ctx, mem_ctx, &res_account, ref_dn,
|
ret = ldb_search(b_state->sam_ctx, mem_ctx, &res_account, ref_dn,
|
||||||
LDB_SCOPE_BASE, attrs_account_1,
|
LDB_SCOPE_BASE, attrs_account_1,
|
||||||
"(&(objectClass=computer)(userAccountControl:1.2.840.113556.1.4.803:=%u))",
|
"(&(objectClass=computer)(userAccountControl:"LDB_OID_COMPARATOR_AND":=%u))",
|
||||||
UF_SERVER_TRUST_ACCOUNT);
|
UF_SERVER_TRUST_ACCOUNT);
|
||||||
if (ret == LDB_SUCCESS && res_account->count == 1) {
|
if (ret == LDB_SUCCESS && res_account->count == 1) {
|
||||||
const char *errstr;
|
const char *errstr;
|
||||||
|
|||||||
Reference in New Issue
Block a user