From 5147f011d9b2b37dd46939d4b50d71d50a6776c1 Mon Sep 17 00:00:00 2001 From: Joseph Sutton Date: Thu, 15 Dec 2022 11:58:11 +1300 Subject: auth: Shorten long SID flags combinations The combination MANDATORY | ENABLED_BY_DEFAULT | ENABLED is very commonly used, and introducing a shorter alias for it makes the code clearer. Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett --- auth/auth_sam_reply.c | 6 ++---- auth/wbc_auth_util.c | 8 ++------ 2 files changed, 4 insertions(+), 10 deletions(-) (limited to 'auth') diff --git a/auth/auth_sam_reply.c b/auth/auth_sam_reply.c index 850ccae980b..72edf0eed15 100644 --- a/auth/auth_sam_reply.c +++ b/auth/auth_sam_reply.c @@ -677,8 +677,7 @@ NTSTATUS make_user_info_dc_netlogon_validation(TALLOC_CTX *mem_ctx, if (!sid_append_rid(&user_info_dc->sids[PRIMARY_USER_SID_INDEX].sid, base->rid)) { return NT_STATUS_INVALID_PARAMETER; } - user_info_dc->sids[PRIMARY_USER_SID_INDEX].attrs - = SE_GROUP_MANDATORY | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_ENABLED; + user_info_dc->sids[PRIMARY_USER_SID_INDEX].attrs = SE_GROUP_DEFAULT_FLAGS; user_info_dc->sids[PRIMARY_GROUP_SID_INDEX].sid = *base->domain_sid; if (!sid_append_rid(&user_info_dc->sids[PRIMARY_GROUP_SID_INDEX].sid, base->primary_gid)) { @@ -690,8 +689,7 @@ NTSTATUS make_user_info_dc_netlogon_validation(TALLOC_CTX *mem_ctx, * group in the first place, and besides, these attributes will never * make their way into a PAC. */ - user_info_dc->sids[PRIMARY_GROUP_SID_INDEX].attrs - = SE_GROUP_MANDATORY | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_ENABLED; + user_info_dc->sids[PRIMARY_GROUP_SID_INDEX].attrs = SE_GROUP_DEFAULT_FLAGS; for (i = 0; i < base->groups.count; i++) { /* Skip primary group, already added above */ diff --git a/auth/wbc_auth_util.c b/auth/wbc_auth_util.c index 52573e2a773..311052c9108 100644 --- a/auth/wbc_auth_util.c +++ b/auth/wbc_auth_util.c @@ -50,9 +50,7 @@ static NTSTATUS wbcsids_to_samr_RidWithAttributeArray( &groups->rids[j].rid); if (!ok) continue; - groups->rids[j].attributes = SE_GROUP_MANDATORY | - SE_GROUP_ENABLED_BY_DEFAULT | - SE_GROUP_ENABLED; + groups->rids[j].attributes = SE_GROUP_DEFAULT_FLAGS; j++; } @@ -91,9 +89,7 @@ static NTSTATUS wbcsids_to_netr_SidAttrArray( talloc_free(info3_sids); return NT_STATUS_NO_MEMORY; } - info3_sids[j].attributes = SE_GROUP_MANDATORY | - SE_GROUP_ENABLED_BY_DEFAULT | - SE_GROUP_ENABLED; + info3_sids[j].attributes = SE_GROUP_DEFAULT_FLAGS; j++; } -- cgit v1.2.1