summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-02-17 02:04:52 +0100
committerGünther Deschner <gd@samba.org>2008-02-17 02:12:00 +0100
commitc6f82f1cc4a08138e5b78d1504ac4f9ea44f81ee (patch)
tree4fc1b5bfcec8e7da9e86c146ac86d4e266fafe6d
parent965774fa8f78a6b0f3306d356fd0d17a2a8943df (diff)
downloadsamba-c6f82f1cc4a08138e5b78d1504ac4f9ea44f81ee.tar.gz
samba-c6f82f1cc4a08138e5b78d1504ac4f9ea44f81ee.tar.bz2
samba-c6f82f1cc4a08138e5b78d1504ac4f9ea44f81ee.zip
Getting rid of net_io_user_info3() when sending an NDR encoded netr_SamInfo3.
Guenther (This used to be commit f22ba8aee2ff90e9e34db066d506fec24c52379f)
-rw-r--r--source3/winbindd/winbindd_pam.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/source3/winbindd/winbindd_pam.c b/source3/winbindd/winbindd_pam.c
index e3574bbcd6..ad87fd2c67 100644
--- a/source3/winbindd/winbindd_pam.c
+++ b/source3/winbindd/winbindd_pam.c
@@ -128,29 +128,31 @@ static NTSTATUS append_info3_as_txt(TALLOC_CTX *mem_ctx,
static NTSTATUS append_info3_as_ndr(TALLOC_CTX *mem_ctx,
struct winbindd_cli_state *state,
- NET_USER_INFO_3 *info3)
+ struct netr_SamInfo3 *info3)
{
- prs_struct ps;
- uint32 size;
- if (!prs_init(&ps, 256 /* Random, non-zero number */, mem_ctx, MARSHALL)) {
- return NT_STATUS_NO_MEMORY;
- }
- if (!net_io_user_info3("", info3, &ps, 1, 3, False)) {
- prs_mem_free(&ps);
- return NT_STATUS_UNSUCCESSFUL;
+ DATA_BLOB blob;
+ enum ndr_err_code ndr_err;
+
+ ndr_err = ndr_push_struct_blob(&blob, mem_ctx, info3,
+ (ndr_push_flags_fn_t)ndr_push_netr_SamInfo3);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ DEBUG(0,("append_info3_as_ndr: failed to append\n"));
+ return ndr_map_error2ntstatus(ndr_err);
}
- size = prs_data_size(&ps);
SAFE_FREE(state->response.extra_data.data);
- state->response.extra_data.data = SMB_MALLOC(size);
+ state->response.extra_data.data = SMB_MALLOC(blob.length);
if (!state->response.extra_data.data) {
- prs_mem_free(&ps);
+ data_blob_free(&blob);
return NT_STATUS_NO_MEMORY;
}
- memset( state->response.extra_data.data, '\0', size );
- prs_copy_all_data_out((char *)state->response.extra_data.data, &ps);
- state->response.length += size;
- prs_mem_free(&ps);
+
+ memset(state->response.extra_data.data, '\0', blob.length);
+ memcpy(state->response.extra_data.data, blob.data, blob.length);
+ state->response.length += blob.length;
+
+ data_blob_free(&blob);
+
return NT_STATUS_OK;
}