diff options
author | Andreas Schneider <asn@samba.org> | 2018-01-11 09:06:31 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-01-15 22:16:13 +0100 |
commit | 05ebafd91ee2dd511372ce63d656e9fc6735ee28 (patch) | |
tree | e90bdf6bf852e979f4d3d5243cb574af439a714c /source3/auth/server_info.c | |
parent | bfc727f0b2d837a97fc9eb94a8811f23a656c4e4 (diff) | |
download | samba-05ebafd91ee2dd511372ce63d656e9fc6735ee28.tar.gz |
s3:rpc_client: Clenup copy_netr_SamInfo3() code
This gets rid of some strange macro and makes sure we clenaup at the
end.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13209
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Jan 15 22:16:13 CET 2018 on sn-devel-144
Diffstat (limited to 'source3/auth/server_info.c')
-rw-r--r-- | source3/auth/server_info.c | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/source3/auth/server_info.c b/source3/auth/server_info.c index 20d43d237fa..78981751286 100644 --- a/source3/auth/server_info.c +++ b/source3/auth/server_info.c @@ -63,11 +63,14 @@ struct auth_serversupplied_info *make_server_info(TALLOC_CTX *mem_ctx) NTSTATUS serverinfo_to_SamInfo2(struct auth_serversupplied_info *server_info, struct netr_SamInfo2 *sam2) { - struct netr_SamInfo3 *info3; + struct netr_SamInfo3 *info3 = NULL; + NTSTATUS status; - info3 = copy_netr_SamInfo3(sam2, server_info->info3); - if (!info3) { - return NT_STATUS_NO_MEMORY; + status = copy_netr_SamInfo3(sam2, + server_info->info3, + &info3); + if (!NT_STATUS_IS_OK(status)) { + return status; } if (server_info->session_key.length) { @@ -96,11 +99,14 @@ NTSTATUS serverinfo_to_SamInfo2(struct auth_serversupplied_info *server_info, NTSTATUS serverinfo_to_SamInfo3(const struct auth_serversupplied_info *server_info, struct netr_SamInfo3 *sam3) { - struct netr_SamInfo3 *info3; + struct netr_SamInfo3 *info3 = NULL; + NTSTATUS status; - info3 = copy_netr_SamInfo3(sam3, server_info->info3); - if (!info3) { - return NT_STATUS_NO_MEMORY; + status = copy_netr_SamInfo3(sam3, + server_info->info3, + &info3); + if (!NT_STATUS_IS_OK(status)) { + return status; } if (server_info->session_key.length) { @@ -133,7 +139,8 @@ NTSTATUS serverinfo_to_SamInfo6(struct auth_serversupplied_info *server_info, struct netr_SamInfo6 *sam6) { struct pdb_domain_info *dominfo; - struct netr_SamInfo3 *info3; + struct netr_SamInfo3 *info3 = NULL; + NTSTATUS status; if ((pdb_capabilities() & PDB_CAP_ADS) == 0) { DEBUG(10,("Not adding validation info level 6 " @@ -146,9 +153,11 @@ NTSTATUS serverinfo_to_SamInfo6(struct auth_serversupplied_info *server_info, return NT_STATUS_NO_MEMORY; } - info3 = copy_netr_SamInfo3(sam6, server_info->info3); - if (!info3) { - return NT_STATUS_NO_MEMORY; + status = copy_netr_SamInfo3(sam6, + server_info->info3, + &info3); + if (!NT_STATUS_IS_OK(status)) { + return status; } if (server_info->session_key.length) { @@ -335,11 +344,15 @@ NTSTATUS create_info3_from_pac_logon_info(TALLOC_CTX *mem_ctx, struct netr_SamInfo3 **pp_info3) { NTSTATUS status; - struct netr_SamInfo3 *info3 = copy_netr_SamInfo3(mem_ctx, - &logon_info->info3); - if (info3 == NULL) { - return NT_STATUS_NO_MEMORY; + struct netr_SamInfo3 *info3 = NULL; + + status = copy_netr_SamInfo3(mem_ctx, + &logon_info->info3, + &info3); + if (!NT_STATUS_IS_OK(status)) { + return status; } + status = merge_resource_sids(logon_info, info3); if (!NT_STATUS_IS_OK(status)) { TALLOC_FREE(info3); |