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 | |
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')
-rw-r--r-- | source3/auth/auth_util.c | 14 | ||||
-rw-r--r-- | source3/auth/server_info.c | 45 |
2 files changed, 38 insertions, 21 deletions
diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c index 5bb5a69dfa7..f543b33eead 100644 --- a/source3/auth/auth_util.c +++ b/source3/auth/auth_util.c @@ -1008,6 +1008,7 @@ static struct auth_serversupplied_info *copy_session_info_serverinfo_guest(TALLO struct auth_serversupplied_info *server_info) { struct auth_serversupplied_info *dst; + NTSTATUS status; dst = make_server_info(mem_ctx); if (dst == NULL) { @@ -1055,8 +1056,10 @@ static struct auth_serversupplied_info *copy_session_info_serverinfo_guest(TALLO dst->lm_session_key = data_blob_talloc(dst, src->session_key.data, src->session_key.length); - dst->info3 = copy_netr_SamInfo3(dst, server_info->info3); - if (!dst->info3) { + status = copy_netr_SamInfo3(dst, + server_info->info3, + &dst->info3); + if (!NT_STATUS_IS_OK(status)) { TALLOC_FREE(dst); return NULL; } @@ -1433,9 +1436,10 @@ NTSTATUS make_server_info_info3(TALLOC_CTX *mem_ctx, result->unix_name = talloc_strdup(result, found_username); /* copy in the info3 */ - result->info3 = copy_netr_SamInfo3(result, info3); - if (result->info3 == NULL) { - nt_status = NT_STATUS_NO_MEMORY; + nt_status = copy_netr_SamInfo3(result, + info3, + &result->info3); + if (!NT_STATUS_IS_OK(nt_status)) { goto out; } 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); |