diff options
author | Stefan Metzmacher <metze@samba.org> | 2018-01-23 21:32:25 +0100 |
---|---|---|
committer | Ralph Boehme <slow@samba.org> | 2018-02-10 08:35:17 +0100 |
commit | d4ba23fd353ad387a374a5d7f6f6d085a0699d2c (patch) | |
tree | 035c8a10f4d416f2a7d04a9dbb74c37a2e78f599 /source3/auth | |
parent | e1ba81996033e7c2cfeba13124ee7f404ded2031 (diff) | |
download | samba-d4ba23fd353ad387a374a5d7f6f6d085a0699d2c.tar.gz |
s3/auth: add create_info6_from_pac()
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13261
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'source3/auth')
-rw-r--r-- | source3/auth/proto.h | 4 | ||||
-rw-r--r-- | source3/auth/server_info.c | 56 |
2 files changed, 60 insertions, 0 deletions
diff --git a/source3/auth/proto.h b/source3/auth/proto.h index e7746701022..ca851c21d4b 100644 --- a/source3/auth/proto.h +++ b/source3/auth/proto.h @@ -312,6 +312,10 @@ NTSTATUS serverinfo_to_SamInfo6(struct auth_serversupplied_info *server_info, NTSTATUS create_info3_from_pac_logon_info(TALLOC_CTX *mem_ctx, const struct PAC_LOGON_INFO *logon_info, struct netr_SamInfo3 **pp_info3); +NTSTATUS create_info6_from_pac(TALLOC_CTX *mem_ctx, + const struct PAC_LOGON_INFO *logon_info, + const struct PAC_UPN_DNS_INFO *upn_dns_info, + struct netr_SamInfo6 **pp_info6); NTSTATUS samu_to_SamInfo3(TALLOC_CTX *mem_ctx, struct samu *samu, const char *login_server, diff --git a/source3/auth/server_info.c b/source3/auth/server_info.c index 78981751286..339cce6c4ec 100644 --- a/source3/auth/server_info.c +++ b/source3/auth/server_info.c @@ -363,6 +363,62 @@ NTSTATUS create_info3_from_pac_logon_info(TALLOC_CTX *mem_ctx, } /* + * Create a copy of an info6 struct from the PAC_UPN_DNS_INFO and PAC_LOGON_INFO + * then merge resource SIDs, if any, into it. If successful return the created + * info6 struct. + */ +NTSTATUS create_info6_from_pac(TALLOC_CTX *mem_ctx, + const struct PAC_LOGON_INFO *logon_info, + const struct PAC_UPN_DNS_INFO *upn_dns_info, + struct netr_SamInfo6 **pp_info6) +{ + NTSTATUS status; + struct netr_SamInfo6 *info6 = NULL; + struct netr_SamInfo3 *info3 = NULL; + + info6 = talloc_zero(mem_ctx, struct netr_SamInfo6); + if (info6 == NULL) { + return NT_STATUS_NO_MEMORY; + } + + status = copy_netr_SamInfo3(info6, + &logon_info->info3, + &info3); + if (!NT_STATUS_IS_OK(status)) { + TALLOC_FREE(info6); + return status; + } + + status = merge_resource_sids(logon_info, info3); + if (!NT_STATUS_IS_OK(status)) { + TALLOC_FREE(info6); + return status; + } + + info6->base = info3->base; + info6->sids = info3->sids; + info6->sidcount = info3->sidcount; + + if (upn_dns_info != NULL) { + info6->dns_domainname.string = talloc_strdup(info6, + upn_dns_info->dns_domain_name); + if (info6->dns_domainname.string == NULL) { + TALLOC_FREE(info6); + return NT_STATUS_NO_MEMORY; + } + info6->principal_name.string = talloc_strdup(info6, + upn_dns_info->upn_name); + if (info6->principal_name.string == NULL) { + TALLOC_FREE(info6); + return NT_STATUS_NO_MEMORY; + } + } + + *pp_info6 = info6; + return NT_STATUS_OK; +} + +/* * Check if this is a "Unix Users" domain user, or a * "Unix Groups" domain group, we need to handle it * in a special way if that's the case. |