summaryrefslogtreecommitdiff
path: root/source3/include/rpc_client.h
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2005-09-30 17:13:37 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:04:48 -0500
commit54abd2aa66069e6baf7769c496f46d9dba18db39 (patch)
tree9cf8e88168011797319ba9e9866749201b1eac1e /source3/include/rpc_client.h
parent4a2cc231d22a82ed21771a72508f15d21ed63227 (diff)
downloadsamba-54abd2aa66069e6baf7769c496f46d9dba18db39.tar.gz
samba-54abd2aa66069e6baf7769c496f46d9dba18db39.tar.bz2
samba-54abd2aa66069e6baf7769c496f46d9dba18db39.zip
r10656: BIG merge from trunk. Features not copied over
* \PIPE\unixinfo * winbindd's {group,alias}membership new functions * winbindd's lookupsids() functionality * swat (trunk changes to be reverted as per discussion with Deryck) (This used to be commit 939c3cb5d78e3a2236209b296aa8aba8bdce32d3)
Diffstat (limited to 'source3/include/rpc_client.h')
-rw-r--r--source3/include/rpc_client.h68
1 files changed, 50 insertions, 18 deletions
diff --git a/source3/include/rpc_client.h b/source3/include/rpc_client.h
index 9ca2d5aa8c..8a83c0f8ae 100644
--- a/source3/include/rpc_client.h
+++ b/source3/include/rpc_client.h
@@ -22,36 +22,68 @@
#define _RPC_CLIENT_H
/* macro to expand cookie-cutter code in cli_xxx() using rpc_api_pipe_req() */
-
-#define CLI_DO_RPC( pcli, ctx, pipe_num, opnum, q_in, r_out, \
+
+#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 ) \
-{ r_out.status = default_error;\
- prs_init( &q_ps, MAX_PDU_FRAG_LEN, ctx, MARSHALL ); \
- prs_init( &r_ps, 0, ctx, UNMARSHALL );\
+{\
+ SMB_ASSERT(pcli->pipe_idx == p_idx); \
+ if (!prs_init( &q_ps, RPC_MAX_PDU_FRAG_LEN, ctx, MARSHALL )) { \
+ return NT_STATUS_NO_MEMORY;\
+ }\
+ if (!prs_init( &r_ps, 0, ctx, UNMARSHALL )) {\
+ prs_mem_free( &q_ps );\
+ return NT_STATUS_NO_MEMORY;\
+ }\
if ( q_io_fn("", &q_in, &q_ps, 0) ) {\
- if ( rpc_api_pipe_req(pcli, pipe_num, opnum, &q_ps, &r_ps) ) {\
- if (!r_io_fn("", &r_out, &r_ps, 0)) {\
- r_out.status = default_error;\
- }\
+ NTSTATUS _smb_pipe_stat_ = rpc_api_pipe_req(pcli, opnum, &q_ps, &r_ps); \
+ if (!NT_STATUS_IS_OK(_smb_pipe_stat_)) {\
+ prs_mem_free( &q_ps );\
+ prs_mem_free( &r_ps );\
+ return _smb_pipe_stat_;\
+ }\
+ if (!r_io_fn("", &r_out, &r_ps, 0)) {\
+ prs_mem_free( &q_ps );\
+ prs_mem_free( &r_ps );\
+ return default_error;\
}\
+ } else {\
+ prs_mem_free( &q_ps );\
+ prs_mem_free( &r_ps );\
+ return default_error;\
}\
prs_mem_free( &q_ps );\
prs_mem_free( &r_ps );\
}
-/* macro to expand cookie-cutter code in cli_xxx() using rpc_api_pipe_req_int() */
+/* Arrrgg. Same but with WERRORS. Needed for registry code. */
-#define CLI_DO_RPC_EX( pcli, ctx, pipe_num, opnum, q_in, r_out, \
+#define CLI_DO_RPC_WERR( pcli, ctx, p_idx, opnum, q_in, r_out, \
q_ps, r_ps, q_io_fn, r_io_fn, default_error ) \
-{ r_out.status = default_error;\
- prs_init( &q_ps, MAX_PDU_FRAG_LEN, ctx, MARSHALL ); \
- prs_init( &r_ps, 0, ctx, UNMARSHALL );\
+{\
+ SMB_ASSERT(pcli->pipe_idx == p_idx); \
+ if (!prs_init( &q_ps, RPC_MAX_PDU_FRAG_LEN, ctx, MARSHALL )) { \
+ return WERR_NOMEM;\
+ }\
+ if (!prs_init( &r_ps, 0, ctx, UNMARSHALL )) {\
+ prs_mem_free( &q_ps );\
+ return WERR_NOMEM;\
+ }\
if ( q_io_fn("", &q_in, &q_ps, 0) ) {\
- if ( rpc_api_pipe_req_int(pcli, opnum, &q_ps, &r_ps) ) {\
- if (!r_io_fn("", &r_out, &r_ps, 0)) {\
- r_out.status = default_error;\
- }\
+ NTSTATUS _smb_pipe_stat_ = rpc_api_pipe_req(pcli, opnum, &q_ps, &r_ps); \
+ if (!NT_STATUS_IS_OK(_smb_pipe_stat_)) {\
+ prs_mem_free( &q_ps );\
+ prs_mem_free( &r_ps );\
+ return ntstatus_to_werror(_smb_pipe_stat_);\
+ }\
+ if (!r_io_fn("", &r_out, &r_ps, 0)) {\
+ prs_mem_free( &q_ps );\
+ prs_mem_free( &r_ps );\
+ return default_error;\
}\
+ } else {\
+ prs_mem_free( &q_ps );\
+ prs_mem_free( &r_ps );\
+ return default_error;\
}\
prs_mem_free( &q_ps );\
prs_mem_free( &r_ps );\