1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s3-wkssvc: prefer dcerpc_wkssvc_X functions.

Guenther
This commit is contained in:
Günther Deschner 2011-01-11 16:03:24 +01:00
parent 4f305f438b
commit 4920390913
2 changed files with 32 additions and 12 deletions

View File

@ -26,7 +26,7 @@
#include "lib/netapi/libnetapi.h"
#include "librpc/gen_ndr/libnet_join.h"
#include "libnet/libnet_join.h"
#include "../librpc/gen_ndr/cli_wkssvc.h"
#include "../librpc/gen_ndr/ndr_wkssvc_c.h"
#include "secrets.h"
/****************************************************************
@ -111,6 +111,7 @@ WERROR NetJoinDomain_r(struct libnetapi_ctx *ctx,
NTSTATUS status;
WERROR werr;
unsigned int old_timeout = 0;
struct dcerpc_binding_handle *b;
werr = libnetapi_open_pipe(ctx, r->in.server,
&ndr_table_wkssvc.syntax_id,
@ -119,6 +120,8 @@ WERROR NetJoinDomain_r(struct libnetapi_ctx *ctx,
goto done;
}
b = pipe_cli->binding_handle;
if (r->in.password) {
encode_wkssvc_join_password_buffer(ctx,
r->in.password,
@ -128,7 +131,7 @@ WERROR NetJoinDomain_r(struct libnetapi_ctx *ctx,
old_timeout = rpccli_set_timeout(pipe_cli, 600000);
status = rpccli_wkssvc_NetrJoinDomain2(pipe_cli, talloc_tos(),
status = dcerpc_wkssvc_NetrJoinDomain2(b, talloc_tos(),
r->in.server,
r->in.domain,
r->in.account_ou,
@ -241,6 +244,7 @@ WERROR NetUnjoinDomain_r(struct libnetapi_ctx *ctx,
NTSTATUS status;
WERROR werr;
unsigned int old_timeout = 0;
struct dcerpc_binding_handle *b;
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_wkssvc.syntax_id,
@ -249,6 +253,8 @@ WERROR NetUnjoinDomain_r(struct libnetapi_ctx *ctx,
goto done;
}
b = pipe_cli->binding_handle;
if (r->in.password) {
encode_wkssvc_join_password_buffer(ctx,
r->in.password,
@ -258,7 +264,7 @@ WERROR NetUnjoinDomain_r(struct libnetapi_ctx *ctx,
old_timeout = rpccli_set_timeout(pipe_cli, 60000);
status = rpccli_wkssvc_NetrUnjoinDomain2(pipe_cli, talloc_tos(),
status = dcerpc_wkssvc_NetrUnjoinDomain2(b, talloc_tos(),
r->in.server_name,
r->in.account,
encrypted_password,
@ -287,6 +293,7 @@ WERROR NetGetJoinInformation_r(struct libnetapi_ctx *ctx,
NTSTATUS status;
WERROR werr;
const char *buffer = NULL;
struct dcerpc_binding_handle *b;
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_wkssvc.syntax_id,
@ -295,7 +302,9 @@ WERROR NetGetJoinInformation_r(struct libnetapi_ctx *ctx,
goto done;
}
status = rpccli_wkssvc_NetrGetJoinInformation(pipe_cli, talloc_tos(),
b = pipe_cli->binding_handle;
status = dcerpc_wkssvc_NetrGetJoinInformation(b, talloc_tos(),
r->in.server_name,
&buffer,
(enum wkssvc_NetJoinStatus *)r->out.name_type,
@ -421,6 +430,7 @@ WERROR NetGetJoinableOUs_r(struct libnetapi_ctx *ctx,
struct wkssvc_PasswordBuffer *encrypted_password = NULL;
NTSTATUS status;
WERROR werr;
struct dcerpc_binding_handle *b;
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_wkssvc.syntax_id,
@ -429,6 +439,8 @@ WERROR NetGetJoinableOUs_r(struct libnetapi_ctx *ctx,
goto done;
}
b = pipe_cli->binding_handle;
if (r->in.password) {
encode_wkssvc_join_password_buffer(ctx,
r->in.password,
@ -436,7 +448,7 @@ WERROR NetGetJoinableOUs_r(struct libnetapi_ctx *ctx,
&encrypted_password);
}
status = rpccli_wkssvc_NetrGetJoinableOus2(pipe_cli, talloc_tos(),
status = dcerpc_wkssvc_NetrGetJoinableOus2(b, talloc_tos(),
r->in.server_name,
r->in.domain,
r->in.account,
@ -463,6 +475,7 @@ WERROR NetRenameMachineInDomain_r(struct libnetapi_ctx *ctx,
struct wkssvc_PasswordBuffer *encrypted_password = NULL;
NTSTATUS status;
WERROR werr;
struct dcerpc_binding_handle *b;
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_wkssvc.syntax_id,
@ -471,6 +484,8 @@ WERROR NetRenameMachineInDomain_r(struct libnetapi_ctx *ctx,
goto done;
}
b = pipe_cli->binding_handle;
if (r->in.password) {
encode_wkssvc_join_password_buffer(ctx,
r->in.password,
@ -478,7 +493,7 @@ WERROR NetRenameMachineInDomain_r(struct libnetapi_ctx *ctx,
&encrypted_password);
}
status = rpccli_wkssvc_NetrRenameMachineInDomain2(pipe_cli, talloc_tos(),
status = dcerpc_wkssvc_NetrRenameMachineInDomain2(b, talloc_tos(),
r->in.server_name,
r->in.new_machine_name,
r->in.account,

View File

@ -20,7 +20,7 @@
#include "includes.h"
#include "rpcclient.h"
#include "../librpc/gen_ndr/cli_wkssvc.h"
#include "../librpc/gen_ndr/ndr_wkssvc_c.h"
static WERROR cmd_wkssvc_wkstagetinfo(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
@ -32,6 +32,7 @@ static WERROR cmd_wkssvc_wkstagetinfo(struct rpc_pipe_client *cli,
uint32_t level = 100;
union wkssvc_NetWkstaInfo info;
const char *server_name;
struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc > 2) {
printf("usage: %s <level>\n", argv[0]);
@ -44,7 +45,7 @@ static WERROR cmd_wkssvc_wkstagetinfo(struct rpc_pipe_client *cli,
server_name = cli->desthost;
status = rpccli_wkssvc_NetWkstaGetInfo(cli, mem_ctx,
status = dcerpc_wkssvc_NetWkstaGetInfo(b, mem_ctx,
server_name,
level,
&info,
@ -66,11 +67,12 @@ static WERROR cmd_wkssvc_getjoininformation(struct rpc_pipe_client *cli,
enum wkssvc_NetJoinStatus name_type;
NTSTATUS status;
WERROR werr;
struct dcerpc_binding_handle *b = cli->binding_handle;
server_name = cli->desthost;
name_buffer = "";
status = rpccli_wkssvc_NetrGetJoinInformation(cli, mem_ctx,
status = dcerpc_wkssvc_NetrGetJoinInformation(b, mem_ctx,
server_name,
&name_buffer,
&name_type,
@ -99,6 +101,7 @@ static WERROR cmd_wkssvc_messagebuffersend(struct rpc_pipe_client *cli,
const char *message = "my message";
NTSTATUS status;
WERROR werr;
struct dcerpc_binding_handle *b = cli->binding_handle;
if (argc > 1) {
message = argv[1];
@ -110,7 +113,7 @@ static WERROR cmd_wkssvc_messagebuffersend(struct rpc_pipe_client *cli,
return WERR_NOMEM;
}
status = rpccli_wkssvc_NetrMessageBufferSend(cli, mem_ctx,
status = dcerpc_wkssvc_NetrMessageBufferSend(b, mem_ctx,
server_name,
message_name,
message_sender_name,
@ -134,6 +137,7 @@ static WERROR cmd_wkssvc_enumeratecomputernames(struct rpc_pipe_client *cli,
NTSTATUS status;
struct wkssvc_ComputerNamesCtr *ctr = NULL;
WERROR werr;
struct dcerpc_binding_handle *b = cli->binding_handle;
server_name = cli->desthost;
@ -141,7 +145,7 @@ static WERROR cmd_wkssvc_enumeratecomputernames(struct rpc_pipe_client *cli,
name_type = atoi(argv[1]);
}
status = rpccli_wkssvc_NetrEnumerateComputerNames(cli, mem_ctx,
status = dcerpc_wkssvc_NetrEnumerateComputerNames(b, mem_ctx,
server_name,
name_type, 0,
&ctr,
@ -170,6 +174,7 @@ static WERROR cmd_wkssvc_enumerateusers(struct rpc_pipe_client *cli,
struct wkssvc_NetWkstaEnumUsersInfo info;
WERROR werr;
uint32_t i, num_entries, resume_handle;
struct dcerpc_binding_handle *b = cli->binding_handle;
server_name = cli->desthost;
@ -179,7 +184,7 @@ static WERROR cmd_wkssvc_enumerateusers(struct rpc_pipe_client *cli,
info.level = atoi(argv[1]);
}
status = rpccli_wkssvc_NetWkstaEnumUsers(cli, mem_ctx, server_name,
status = dcerpc_wkssvc_NetWkstaEnumUsers(b, mem_ctx, server_name,
&info, 1000, &num_entries,
&resume_handle, &werr);
if (!NT_STATUS_IS_OK(status)) {