diff options
author | Günther Deschner <gd@samba.org> | 2011-04-06 14:35:24 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2011-04-12 12:20:43 +0200 |
commit | 3acd6bde58ecd68faf8200268cc674a71c57778d (patch) | |
tree | acde763cb36c218c256c4f7a4462f6c80b6fdcab /source3 | |
parent | 0eece6202c94fdd180f266049e1a3712b9477dc6 (diff) | |
download | samba-3acd6bde58ecd68faf8200268cc674a71c57778d.tar.gz samba-3acd6bde58ecd68faf8200268cc674a71c57778d.tar.bz2 samba-3acd6bde58ecd68faf8200268cc674a71c57778d.zip |
s3-netapi: use libnetapi_get_binding_handle().
Guenther
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/netapi/file.c | 27 | ||||
-rw-r--r-- | source3/lib/netapi/getdc.c | 27 | ||||
-rw-r--r-- | source3/lib/netapi/netlogon.c | 18 | ||||
-rw-r--r-- | source3/lib/netapi/serverinfo.c | 27 | ||||
-rw-r--r-- | source3/lib/netapi/share.c | 45 | ||||
-rw-r--r-- | source3/lib/netapi/shutdown.c | 18 |
6 files changed, 54 insertions, 108 deletions
diff --git a/source3/lib/netapi/file.c b/source3/lib/netapi/file.c index a8342ac1e4..1e406d2884 100644 --- a/source3/lib/netapi/file.c +++ b/source3/lib/netapi/file.c @@ -33,18 +33,15 @@ WERROR NetFileClose_r(struct libnetapi_ctx *ctx, { WERROR werr; NTSTATUS status; - struct rpc_pipe_client *pipe_cli = NULL; struct dcerpc_binding_handle *b; - werr = libnetapi_open_pipe(ctx, r->in.server_name, - &ndr_table_srvsvc.syntax_id, - &pipe_cli); + werr = libnetapi_get_binding_handle(ctx, r->in.server_name, + &ndr_table_srvsvc.syntax_id, + &b); if (!W_ERROR_IS_OK(werr)) { goto done; } - b = pipe_cli->binding_handle; - status = dcerpc_srvsvc_NetFileClose(b, talloc_tos(), r->in.server_name, r->in.fileid, @@ -116,7 +113,6 @@ WERROR NetFileGetInfo_r(struct libnetapi_ctx *ctx, { WERROR werr; NTSTATUS status; - struct rpc_pipe_client *pipe_cli = NULL; union srvsvc_NetFileInfo info; uint32_t num_entries = 0; struct dcerpc_binding_handle *b; @@ -133,15 +129,13 @@ WERROR NetFileGetInfo_r(struct libnetapi_ctx *ctx, return WERR_UNKNOWN_LEVEL; } - werr = libnetapi_open_pipe(ctx, r->in.server_name, - &ndr_table_srvsvc.syntax_id, - &pipe_cli); + werr = libnetapi_get_binding_handle(ctx, r->in.server_name, + &ndr_table_srvsvc.syntax_id, + &b); if (!W_ERROR_IS_OK(werr)) { goto done; } - b = pipe_cli->binding_handle; - status = dcerpc_srvsvc_NetFileGetInfo(b, talloc_tos(), r->in.server_name, r->in.fileid, @@ -187,7 +181,6 @@ WERROR NetFileEnum_r(struct libnetapi_ctx *ctx, { WERROR werr; NTSTATUS status; - struct rpc_pipe_client *pipe_cli = NULL; struct srvsvc_NetFileInfoCtr info_ctr; struct srvsvc_NetFileCtr2 ctr2; struct srvsvc_NetFileCtr3 ctr3; @@ -207,15 +200,13 @@ WERROR NetFileEnum_r(struct libnetapi_ctx *ctx, return WERR_UNKNOWN_LEVEL; } - werr = libnetapi_open_pipe(ctx, r->in.server_name, - &ndr_table_srvsvc.syntax_id, - &pipe_cli); + werr = libnetapi_get_binding_handle(ctx, r->in.server_name, + &ndr_table_srvsvc.syntax_id, + &b); if (!W_ERROR_IS_OK(werr)) { goto done; } - b = pipe_cli->binding_handle; - ZERO_STRUCT(info_ctr); info_ctr.level = r->in.level; diff --git a/source3/lib/netapi/getdc.c b/source3/lib/netapi/getdc.c index fd5cdc220d..e753deacb0 100644 --- a/source3/lib/netapi/getdc.c +++ b/source3/lib/netapi/getdc.c @@ -40,20 +40,17 @@ WERROR NetGetDCName_l(struct libnetapi_ctx *ctx, WERROR NetGetDCName_r(struct libnetapi_ctx *ctx, struct NetGetDCName *r) { - struct rpc_pipe_client *pipe_cli = NULL; NTSTATUS status; WERROR werr; struct dcerpc_binding_handle *b; - werr = libnetapi_open_pipe(ctx, r->in.server_name, - &ndr_table_netlogon.syntax_id, - &pipe_cli); + werr = libnetapi_get_binding_handle(ctx, r->in.server_name, + &ndr_table_netlogon.syntax_id, + &b); if (!W_ERROR_IS_OK(werr)) { goto done; } - b = pipe_cli->binding_handle; - status = dcerpc_netr_GetDcName(b, talloc_tos(), r->in.server_name, r->in.domain_name, @@ -83,20 +80,17 @@ WERROR NetGetAnyDCName_l(struct libnetapi_ctx *ctx, WERROR NetGetAnyDCName_r(struct libnetapi_ctx *ctx, struct NetGetAnyDCName *r) { - struct rpc_pipe_client *pipe_cli = NULL; NTSTATUS status; WERROR werr; struct dcerpc_binding_handle *b; - werr = libnetapi_open_pipe(ctx, r->in.server_name, - &ndr_table_netlogon.syntax_id, - &pipe_cli); + werr = libnetapi_get_binding_handle(ctx, r->in.server_name, + &ndr_table_netlogon.syntax_id, + &b); if (!W_ERROR_IS_OK(werr)) { goto done; } - b = pipe_cli->binding_handle; - status = dcerpc_netr_GetAnyDCName(b, talloc_tos(), r->in.server_name, r->in.domain_name, @@ -148,18 +142,15 @@ WERROR DsGetDcName_r(struct libnetapi_ctx *ctx, { WERROR werr; NTSTATUS status = NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND; - struct rpc_pipe_client *pipe_cli = NULL; struct dcerpc_binding_handle *b; - werr = libnetapi_open_pipe(ctx, r->in.server_name, - &ndr_table_netlogon.syntax_id, - &pipe_cli); + werr = libnetapi_get_binding_handle(ctx, r->in.server_name, + &ndr_table_netlogon.syntax_id, + &b); if (!W_ERROR_IS_OK(werr)) { goto done; } - b = pipe_cli->binding_handle; - status = dcerpc_netr_DsRGetDCNameEx(b, ctx, r->in.server_name, diff --git a/source3/lib/netapi/netlogon.c b/source3/lib/netapi/netlogon.c index 0a15063ba4..a046fb77e9 100644 --- a/source3/lib/netapi/netlogon.c +++ b/source3/lib/netapi/netlogon.c @@ -129,19 +129,16 @@ WERROR I_NetLogonControl_r(struct libnetapi_ctx *ctx, { WERROR werr; NTSTATUS status; - struct rpc_pipe_client *pipe_cli = NULL; union netr_CONTROL_QUERY_INFORMATION query; struct dcerpc_binding_handle *b; - werr = libnetapi_open_pipe(ctx, r->in.server_name, - &ndr_table_netlogon.syntax_id, - &pipe_cli); + werr = libnetapi_get_binding_handle(ctx, r->in.server_name, + &ndr_table_netlogon.syntax_id, + &b); if (!W_ERROR_IS_OK(werr)) { goto done; } - b = pipe_cli->binding_handle; - status = dcerpc_netr_LogonControl(b, talloc_tos(), r->in.server_name, r->in.function_code, @@ -183,7 +180,6 @@ WERROR I_NetLogonControl2_r(struct libnetapi_ctx *ctx, { WERROR werr; NTSTATUS status; - struct rpc_pipe_client *pipe_cli = NULL; union netr_CONTROL_DATA_INFORMATION data; union netr_CONTROL_QUERY_INFORMATION query; struct dcerpc_binding_handle *b; @@ -193,15 +189,13 @@ WERROR I_NetLogonControl2_r(struct libnetapi_ctx *ctx, goto done; } - werr = libnetapi_open_pipe(ctx, r->in.server_name, - &ndr_table_netlogon.syntax_id, - &pipe_cli); + werr = libnetapi_get_binding_handle(ctx, r->in.server_name, + &ndr_table_netlogon.syntax_id, + &b); if (!W_ERROR_IS_OK(werr)) { goto done; } - b = pipe_cli->binding_handle; - switch (r->in.function_code) { case NETLOGON_CONTROL_TC_VERIFY: case NETLOGON_CONTROL_SET_DBFLAG: diff --git a/source3/lib/netapi/serverinfo.c b/source3/lib/netapi/serverinfo.c index 6de97b9de4..22c7df69d1 100644 --- a/source3/lib/netapi/serverinfo.c +++ b/source3/lib/netapi/serverinfo.c @@ -480,7 +480,6 @@ static NTSTATUS map_server_info_to_SERVER_INFO_buffer(TALLOC_CTX *mem_ctx, WERROR NetServerGetInfo_r(struct libnetapi_ctx *ctx, struct NetServerGetInfo *r) { - struct rpc_pipe_client *pipe_cli = NULL; NTSTATUS status; WERROR werr; union srvsvc_NetSrvInfo info; @@ -503,15 +502,13 @@ WERROR NetServerGetInfo_r(struct libnetapi_ctx *ctx, return WERR_UNKNOWN_LEVEL; } - werr = libnetapi_open_pipe(ctx, r->in.server_name, - &ndr_table_srvsvc.syntax_id, - &pipe_cli); + werr = libnetapi_get_binding_handle(ctx, r->in.server_name, + &ndr_table_srvsvc.syntax_id, + &b); if (!W_ERROR_IS_OK(werr)) { goto done; } - b = pipe_cli->binding_handle; - status = dcerpc_srvsvc_NetSrvGetInfo(b, talloc_tos(), r->in.server_name, r->in.level, @@ -601,21 +598,18 @@ WERROR NetServerSetInfo_l(struct libnetapi_ctx *ctx, WERROR NetServerSetInfo_r(struct libnetapi_ctx *ctx, struct NetServerSetInfo *r) { - struct rpc_pipe_client *pipe_cli = NULL; NTSTATUS status; WERROR werr; union srvsvc_NetSrvInfo info; struct dcerpc_binding_handle *b; - werr = libnetapi_open_pipe(ctx, r->in.server_name, - &ndr_table_srvsvc.syntax_id, - &pipe_cli); + werr = libnetapi_get_binding_handle(ctx, r->in.server_name, + &ndr_table_srvsvc.syntax_id, + &b); if (!W_ERROR_IS_OK(werr)) { goto done; } - b = pipe_cli->binding_handle; - switch (r->in.level) { case 1005: info.info1005 = (struct srvsvc_NetSrvInfo1005 *)r->in.buffer; @@ -646,21 +640,18 @@ WERROR NetServerSetInfo_r(struct libnetapi_ctx *ctx, WERROR NetRemoteTOD_r(struct libnetapi_ctx *ctx, struct NetRemoteTOD *r) { - struct rpc_pipe_client *pipe_cli = NULL; NTSTATUS status; WERROR werr; struct srvsvc_NetRemoteTODInfo *info = NULL; struct dcerpc_binding_handle *b; - werr = libnetapi_open_pipe(ctx, r->in.server_name, - &ndr_table_srvsvc.syntax_id, - &pipe_cli); + werr = libnetapi_get_binding_handle(ctx, r->in.server_name, + &ndr_table_srvsvc.syntax_id, + &b); if (!W_ERROR_IS_OK(werr)) { goto done; } - b = pipe_cli->binding_handle; - status = dcerpc_srvsvc_NetRemoteTOD(b, talloc_tos(), r->in.server_name, &info, diff --git a/source3/lib/netapi/share.c b/source3/lib/netapi/share.c index f2cd92ef08..c4ed1549ce 100644 --- a/source3/lib/netapi/share.c +++ b/source3/lib/netapi/share.c @@ -182,7 +182,6 @@ WERROR NetShareAdd_r(struct libnetapi_ctx *ctx, { WERROR werr; NTSTATUS status; - struct rpc_pipe_client *pipe_cli = NULL; union srvsvc_NetShareInfo info; struct dcerpc_binding_handle *b; @@ -200,15 +199,13 @@ WERROR NetShareAdd_r(struct libnetapi_ctx *ctx, return WERR_UNKNOWN_LEVEL; } - werr = libnetapi_open_pipe(ctx, r->in.server_name, - &ndr_table_srvsvc.syntax_id, - &pipe_cli); + werr = libnetapi_get_binding_handle(ctx, r->in.server_name, + &ndr_table_srvsvc.syntax_id, + &b); if (!W_ERROR_IS_OK(werr)) { goto done; } - b = pipe_cli->binding_handle; - status = map_SHARE_INFO_buffer_to_srvsvc_share_info(ctx, r->in.buffer, r->in.level, @@ -254,22 +251,19 @@ WERROR NetShareDel_r(struct libnetapi_ctx *ctx, { WERROR werr; NTSTATUS status; - struct rpc_pipe_client *pipe_cli = NULL; struct dcerpc_binding_handle *b; if (!r->in.net_name) { return WERR_INVALID_PARAM; } - werr = libnetapi_open_pipe(ctx, r->in.server_name, - &ndr_table_srvsvc.syntax_id, - &pipe_cli); + werr = libnetapi_get_binding_handle(ctx, r->in.server_name, + &ndr_table_srvsvc.syntax_id, + &b); if (!W_ERROR_IS_OK(werr)) { goto done; } - b = pipe_cli->binding_handle; - status = dcerpc_srvsvc_NetShareDel(b, talloc_tos(), r->in.server_name, r->in.net_name, @@ -301,7 +295,6 @@ WERROR NetShareEnum_r(struct libnetapi_ctx *ctx, { WERROR werr; NTSTATUS status; - struct rpc_pipe_client *pipe_cli = NULL; struct srvsvc_NetShareInfoCtr info_ctr; struct srvsvc_NetShareCtr0 ctr0; struct srvsvc_NetShareCtr1 ctr1; @@ -327,15 +320,13 @@ WERROR NetShareEnum_r(struct libnetapi_ctx *ctx, ZERO_STRUCT(info_ctr); - werr = libnetapi_open_pipe(ctx, r->in.server_name, - &ndr_table_srvsvc.syntax_id, - &pipe_cli); + werr = libnetapi_get_binding_handle(ctx, r->in.server_name, + &ndr_table_srvsvc.syntax_id, + &b); if (!W_ERROR_IS_OK(werr)) { goto done; } - b = pipe_cli->binding_handle; - info_ctr.level = r->in.level; switch (r->in.level) { case 0: @@ -414,7 +405,6 @@ WERROR NetShareGetInfo_r(struct libnetapi_ctx *ctx, { WERROR werr; NTSTATUS status; - struct rpc_pipe_client *pipe_cli = NULL; union srvsvc_NetShareInfo info; uint32_t num_entries = 0; struct dcerpc_binding_handle *b; @@ -437,15 +427,13 @@ WERROR NetShareGetInfo_r(struct libnetapi_ctx *ctx, return WERR_UNKNOWN_LEVEL; } - werr = libnetapi_open_pipe(ctx, r->in.server_name, - &ndr_table_srvsvc.syntax_id, - &pipe_cli); + werr = libnetapi_get_binding_handle(ctx, r->in.server_name, + &ndr_table_srvsvc.syntax_id, + &b); if (!W_ERROR_IS_OK(werr)) { goto done; } - b = pipe_cli->binding_handle; - status = dcerpc_srvsvc_NetShareGetInfo(b, talloc_tos(), r->in.server_name, r->in.net_name, @@ -491,7 +479,6 @@ WERROR NetShareSetInfo_r(struct libnetapi_ctx *ctx, { WERROR werr; NTSTATUS status; - struct rpc_pipe_client *pipe_cli = NULL; union srvsvc_NetShareInfo info; struct dcerpc_binding_handle *b; @@ -514,15 +501,13 @@ WERROR NetShareSetInfo_r(struct libnetapi_ctx *ctx, return WERR_UNKNOWN_LEVEL; } - werr = libnetapi_open_pipe(ctx, r->in.server_name, - &ndr_table_srvsvc.syntax_id, - &pipe_cli); + werr = libnetapi_get_binding_handle(ctx, r->in.server_name, + &ndr_table_srvsvc.syntax_id, + &b); if (!W_ERROR_IS_OK(werr)) { goto done; } - b = pipe_cli->binding_handle; - status = map_SHARE_INFO_buffer_to_srvsvc_share_info(ctx, r->in.buffer, r->in.level, diff --git a/source3/lib/netapi/shutdown.c b/source3/lib/netapi/shutdown.c index 199325b170..78bc2fce6b 100644 --- a/source3/lib/netapi/shutdown.c +++ b/source3/lib/netapi/shutdown.c @@ -34,19 +34,16 @@ WERROR NetShutdownInit_r(struct libnetapi_ctx *ctx, { WERROR werr; NTSTATUS status; - struct rpc_pipe_client *pipe_cli = NULL; struct lsa_StringLarge message; struct dcerpc_binding_handle *b; - werr = libnetapi_open_pipe(ctx, r->in.server_name, - &ndr_table_initshutdown.syntax_id, - &pipe_cli); + werr = libnetapi_get_binding_handle(ctx, r->in.server_name, + &ndr_table_initshutdown.syntax_id, + &b); if (!W_ERROR_IS_OK(werr)) { goto done; } - b = pipe_cli->binding_handle; - init_lsa_StringLarge(&message, r->in.message); status = dcerpc_initshutdown_Init(b, talloc_tos(), @@ -82,18 +79,15 @@ WERROR NetShutdownAbort_r(struct libnetapi_ctx *ctx, { WERROR werr; NTSTATUS status; - struct rpc_pipe_client *pipe_cli = NULL; struct dcerpc_binding_handle *b; - werr = libnetapi_open_pipe(ctx, r->in.server_name, - &ndr_table_initshutdown.syntax_id, - &pipe_cli); + werr = libnetapi_get_binding_handle(ctx, r->in.server_name, + &ndr_table_initshutdown.syntax_id, + &b); if (!W_ERROR_IS_OK(werr)) { goto done; } - b = pipe_cli->binding_handle; - status = dcerpc_initshutdown_Abort(b, talloc_tos(), NULL, &werr); |