diff options
author | Günther Deschner <gd@samba.org> | 2008-02-17 02:04:52 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-02-17 02:12:00 +0100 |
commit | f22ba8aee2ff90e9e34db066d506fec24c52379f (patch) | |
tree | 125f706d06b58afe9d527a95360bc5fc20ee3a9f /source/winbindd/winbindd_pam.c | |
parent | ea609d1b0e82d7c366dd73013228003136264b64 (diff) | |
download | samba-f22ba8aee2ff90e9e34db066d506fec24c52379f.tar.gz |
Getting rid of net_io_user_info3() when sending an NDR encoded netr_SamInfo3.
Guenther
Diffstat (limited to 'source/winbindd/winbindd_pam.c')
-rw-r--r-- | source/winbindd/winbindd_pam.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/source/winbindd/winbindd_pam.c b/source/winbindd/winbindd_pam.c index e3574bbcd6d..ad87fd2c672 100644 --- a/source/winbindd/winbindd_pam.c +++ b/source/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; } |