summaryrefslogtreecommitdiff
path: root/auth/auth_sam_reply.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2016-01-07 15:23:56 +0100
committerAndrew Bartlett <abartlet@samba.org>2016-06-30 03:30:26 +0200
commita872670fd6ccbd375f40ccacf29c74c8c9be9206 (patch)
tree783e3cef9b72cba32462d0012dbcb009bf3b1363 /auth/auth_sam_reply.c
parentaee33fc38ab496af621df770c91b5d05e17ff617 (diff)
downloadsamba-a872670fd6ccbd375f40ccacf29c74c8c9be9206.tar.gz
auth/auth_sam_reply: add auth_convert_user_info_dc_saminfo2() helper function
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'auth/auth_sam_reply.c')
-rw-r--r--auth/auth_sam_reply.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/auth/auth_sam_reply.c b/auth/auth_sam_reply.c
index 5602daf62de..b3255864047 100644
--- a/auth/auth_sam_reply.c
+++ b/auth/auth_sam_reply.c
@@ -202,6 +202,32 @@ NTSTATUS auth_convert_user_info_dc_saminfo6(TALLOC_CTX *mem_ctx,
return NT_STATUS_OK;
}
+/* Note that the validity of the _sam2 structure is only as long as
+ * the user_info_dc it was generated from */
+NTSTATUS auth_convert_user_info_dc_saminfo2(TALLOC_CTX *mem_ctx,
+ const struct auth_user_info_dc *user_info_dc,
+ struct netr_SamInfo2 **_sam2)
+{
+ NTSTATUS status;
+ struct netr_SamInfo6 *sam6 = NULL;
+ struct netr_SamInfo2 *sam2 = NULL;
+
+ sam2 = talloc_zero(mem_ctx, struct netr_SamInfo2);
+ if (sam2 == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ status = auth_convert_user_info_dc_saminfo6(sam2, user_info_dc, &sam6);
+ if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(sam2);
+ return status;
+ }
+ sam2->base = sam6->base;
+
+ *_sam2 = sam2;
+ return NT_STATUS_OK;
+}
+
/* Note that the validity of the _sam3 structure is only as long as
* the user_info_dc it was generated from */
NTSTATUS auth_convert_user_info_dc_saminfo3(TALLOC_CTX *mem_ctx,