From a9e58a2ef220bbbd868a7c5851a882ec774a4971 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 13 Jan 2015 13:45:16 -0800 Subject: [PATCH] s3: auth: Plumb in the SamInfo3_handle_sids() utility function into passwd_to_SamInfo3(). Core fix for: https://bugzilla.samba.org/show_bug.cgi?id=11044 Based on code from Michael Zeis Signed-off-by: Jeremy Allison Reviewed-by: Volker Lendecke (cherry picked from commit 60895e62fe21e41cf4a09ec8a92239b8f015b450) --- source3/auth/auth_util.c | 3 ++- source3/auth/proto.h | 3 ++- source3/auth/server_info.c | 16 +++++++++++++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c index 2986fb4372f..1c2cf80ed8b 100644 --- a/source3/auth/auth_util.c +++ b/source3/auth/auth_util.c @@ -671,7 +671,8 @@ NTSTATUS make_server_info_pw(TALLOC_CTX *mem_ctx, status = passwd_to_SamInfo3(result, unix_username, pwd, - &result->info3); + &result->info3, + &result->extra); if (!NT_STATUS_IS_OK(status)) { goto done; } diff --git a/source3/auth/proto.h b/source3/auth/proto.h index 1da0c445e78..6a5508b2a14 100644 --- a/source3/auth/proto.h +++ b/source3/auth/proto.h @@ -305,7 +305,8 @@ NTSTATUS samu_to_SamInfo3(TALLOC_CTX *mem_ctx, NTSTATUS passwd_to_SamInfo3(TALLOC_CTX *mem_ctx, const char *unix_username, const struct passwd *pwd, - struct netr_SamInfo3 **pinfo3); + struct netr_SamInfo3 **pinfo3, + struct extra_auth_info *extra); struct netr_SamInfo3 *copy_netr_SamInfo3(TALLOC_CTX *mem_ctx, const struct netr_SamInfo3 *orig); diff --git a/source3/auth/server_info.c b/source3/auth/server_info.c index 9f992ffa103..7b1cdd574b4 100644 --- a/source3/auth/server_info.c +++ b/source3/auth/server_info.c @@ -539,7 +539,8 @@ NTSTATUS samu_to_SamInfo3(TALLOC_CTX *mem_ctx, NTSTATUS passwd_to_SamInfo3(TALLOC_CTX *mem_ctx, const char *unix_username, const struct passwd *pwd, - struct netr_SamInfo3 **pinfo3) + struct netr_SamInfo3 **pinfo3, + struct extra_auth_info *extra) { struct netr_SamInfo3 *info3; NTSTATUS status; @@ -635,8 +636,17 @@ NTSTATUS passwd_to_SamInfo3(TALLOC_CTX *mem_ctx, ZERO_STRUCT(domain_sid); - sid_copy(&domain_sid, &user_sid); - sid_split_rid(&domain_sid, &info3->base.rid); + status = SamInfo3_handle_sids(unix_username, + &user_sid, + &group_sid, + info3, + &domain_sid, + extra); + + if (!NT_STATUS_IS_OK(status)) { + goto done; + } + info3->base.domain_sid = dom_sid_dup(info3, &domain_sid); ok = sid_peek_check_rid(&domain_sid, &group_sid, -- 2.11.4.GIT