mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
s3-netapi: use libnetapi_get_binding_handle().
Guenther
This commit is contained in:
parent
0eece6202c
commit
3acd6bde58
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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:
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user