diff options
author | Günther Deschner <gd@samba.org> | 2006-01-11 19:18:40 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:06:04 -0500 |
commit | 54b1c585bbe2e60e9251fcaaf4d95b68b31e2618 (patch) | |
tree | deda0b2ede52bf531a474ab6ce881955427140ed /source3/include | |
parent | 673c3564885fdb57e8f99d64401ee81152134e54 (diff) | |
download | samba-54b1c585bbe2e60e9251fcaaf4d95b68b31e2618.tar.gz samba-54b1c585bbe2e60e9251fcaaf4d95b68b31e2618.tar.bz2 samba-54b1c585bbe2e60e9251fcaaf4d95b68b31e2618.zip |
r12853: Fix segfault in "net rpc vampire|samdump" (Bugzilla #3390).
The session key, after beeing set, was zeroed later on by the prs_init
in the CLI_DO_RPC macro.
Guenther
(This used to be commit eaaeaa767e86151886964dcdd9f3186f0b31ed53)
Diffstat (limited to 'source3/include')
-rw-r--r-- | source3/include/rpc_client.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/source3/include/rpc_client.h b/source3/include/rpc_client.h index 8a83c0f8ae..0524f037e2 100644 --- a/source3/include/rpc_client.h +++ b/source3/include/rpc_client.h @@ -23,8 +23,8 @@ /* macro to expand cookie-cutter code in cli_xxx() using rpc_api_pipe_req() */ -#define CLI_DO_RPC( pcli, ctx, p_idx, opnum, q_in, r_out, \ - q_ps, r_ps, q_io_fn, r_io_fn, default_error ) \ +#define CLI_DO_RPC_INTERNAL( pcli, ctx, p_idx, opnum, q_in, r_out, \ + q_ps, r_ps, q_io_fn, r_io_fn, default_error, copy_sess_key ) \ {\ SMB_ASSERT(pcli->pipe_idx == p_idx); \ if (!prs_init( &q_ps, RPC_MAX_PDU_FRAG_LEN, ctx, MARSHALL )) { \ @@ -34,6 +34,7 @@ prs_mem_free( &q_ps );\ return NT_STATUS_NO_MEMORY;\ }\ + if ( copy_sess_key) prs_set_session_key(&q_ps, (const char *)pcli->dc->sess_key);\ if ( q_io_fn("", &q_in, &q_ps, 0) ) {\ NTSTATUS _smb_pipe_stat_ = rpc_api_pipe_req(pcli, opnum, &q_ps, &r_ps); \ if (!NT_STATUS_IS_OK(_smb_pipe_stat_)) {\ @@ -41,6 +42,7 @@ prs_mem_free( &r_ps );\ return _smb_pipe_stat_;\ }\ + if ( copy_sess_key ) prs_set_session_key(&r_ps, (const char *)pcli->dc->sess_key);\ if (!r_io_fn("", &r_out, &r_ps, 0)) {\ prs_mem_free( &q_ps );\ prs_mem_free( &r_ps );\ @@ -55,6 +57,21 @@ prs_mem_free( &r_ps );\ } +#define CLI_DO_RPC_COPY_SESS_KEY( pcli, ctx, p_idx, opnum, q_in, r_out, \ + q_ps, r_ps, q_io_fn, r_io_fn, default_error ) \ +{\ + CLI_DO_RPC_INTERNAL( pcli, ctx, p_idx, opnum, q_in, r_out, \ + q_ps, r_ps, q_io_fn, r_io_fn, default_error, True ); \ +} + +#define CLI_DO_RPC( pcli, ctx, p_idx, opnum, q_in, r_out, \ + q_ps, r_ps, q_io_fn, r_io_fn, default_error ) \ +{\ + CLI_DO_RPC_INTERNAL( pcli, ctx, p_idx, opnum, q_in, r_out, \ + q_ps, r_ps, q_io_fn, r_io_fn, default_error, False ); \ +} + + /* Arrrgg. Same but with WERRORS. Needed for registry code. */ #define CLI_DO_RPC_WERR( pcli, ctx, p_idx, opnum, q_in, r_out, \ |