1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-13 13:18:06 +03:00

s3: Make libnetapi_open_pipe take strings instead of a ndr_interface_table

This commit is contained in:
Volker Lendecke 2009-11-08 12:31:38 +01:00
parent 53f2a1595e
commit 5fc9d93408
12 changed files with 61 additions and 54 deletions

View File

@ -179,10 +179,11 @@ static NTSTATUS pipe_cm_open(TALLOC_CTX *ctx,
WERROR libnetapi_open_pipe(struct libnetapi_ctx *ctx,
const char *server_name,
const struct ndr_syntax_id *interface,
const char *interface, uint32_t interface_version,
struct rpc_pipe_client **presult)
{
struct rpc_pipe_client *result = NULL;
struct ndr_syntax_id syntax;
NTSTATUS status;
WERROR werr;
struct cli_state *cli = NULL;
@ -191,15 +192,19 @@ WERROR libnetapi_open_pipe(struct libnetapi_ctx *ctx,
return WERR_INVALID_PARAM;
}
if (!ndr_syntax_from_string(interface, interface_version, &syntax)) {
return WERR_INVALID_PARAM;
}
werr = libnetapi_open_ipc_connection(ctx, server_name, &cli);
if (!W_ERROR_IS_OK(werr)) {
return werr;
}
status = pipe_cm_open(ctx, cli, interface, &result);
status = pipe_cm_open(ctx, cli, &syntax, &result);
if (!NT_STATUS_IS_OK(status)) {
libnetapi_set_error_string(ctx, "failed to open PIPE %s: %s",
get_pipe_name_from_syntax(talloc_tos(), interface),
get_pipe_name_from_syntax(talloc_tos(), &syntax),
get_friendly_nt_error_msg(status));
return WERR_DEST_NOT_FOUND;
}

View File

@ -35,7 +35,7 @@ WERROR NetFileClose_r(struct libnetapi_ctx *ctx,
struct rpc_pipe_client *pipe_cli = NULL;
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_srvsvc.syntax_id,
NDR_SRVSVC_UUID, NDR_SRVSVC_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -129,7 +129,7 @@ WERROR NetFileGetInfo_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_srvsvc.syntax_id,
NDR_SRVSVC_UUID, NDR_SRVSVC_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -195,7 +195,7 @@ WERROR NetFileEnum_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_srvsvc.syntax_id,
NDR_SRVSVC_UUID, NDR_SRVSVC_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;

View File

@ -45,7 +45,7 @@ WERROR NetGetDCName_r(struct libnetapi_ctx *ctx,
WERROR werr;
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_netlogon.syntax_id,
NDR_NETLOGON_UUID, NDR_NETLOGON_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -85,7 +85,7 @@ WERROR NetGetAnyDCName_r(struct libnetapi_ctx *ctx,
WERROR werr;
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_netlogon.syntax_id,
NDR_NETLOGON_UUID, NDR_NETLOGON_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -140,7 +140,7 @@ WERROR DsGetDcName_r(struct libnetapi_ctx *ctx,
struct rpc_pipe_client *pipe_cli = NULL;
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_netlogon.syntax_id,
NDR_NETLOGON_UUID, NDR_NETLOGON_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;

View File

@ -71,7 +71,7 @@ WERROR NetGroupAdd_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -242,7 +242,7 @@ WERROR NetGroupDel_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -407,7 +407,7 @@ WERROR NetGroupSetInfo_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -642,7 +642,7 @@ WERROR NetGroupGetInfo_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -758,7 +758,7 @@ WERROR NetGroupAddUser_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -879,7 +879,7 @@ WERROR NetGroupDelUser_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -1157,7 +1157,7 @@ WERROR NetGroupEnum_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -1288,7 +1288,7 @@ WERROR NetGroupGetUsers_r(struct libnetapi_ctx *ctx,
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -1440,7 +1440,7 @@ WERROR NetGroupSetUsers_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;

View File

@ -106,7 +106,7 @@ WERROR NetJoinDomain_r(struct libnetapi_ctx *ctx,
unsigned int old_timeout = 0;
werr = libnetapi_open_pipe(ctx, r->in.server,
&ndr_table_wkssvc.syntax_id,
NDR_WKSSVC_UUID, NDR_WKSSVC_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -232,7 +232,7 @@ WERROR NetUnjoinDomain_r(struct libnetapi_ctx *ctx,
unsigned int old_timeout = 0;
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_wkssvc.syntax_id,
NDR_WKSSVC_UUID, NDR_WKSSVC_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -278,7 +278,7 @@ WERROR NetGetJoinInformation_r(struct libnetapi_ctx *ctx,
const char *buffer = NULL;
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_wkssvc.syntax_id,
NDR_WKSSVC_UUID, NDR_WKSSVC_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -408,7 +408,7 @@ WERROR NetGetJoinableOUs_r(struct libnetapi_ctx *ctx,
WERROR werr;
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_wkssvc.syntax_id,
NDR_WKSSVC_UUID, NDR_WKSSVC_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -450,7 +450,7 @@ WERROR NetRenameMachineInDomain_r(struct libnetapi_ctx *ctx,
WERROR werr;
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_wkssvc.syntax_id,
NDR_WKSSVC_UUID, NDR_WKSSVC_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;

View File

@ -150,7 +150,7 @@ WERROR NetLocalGroupAdd_r(struct libnetapi_ctx *ctx,
ZERO_STRUCT(alias_handle);
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -270,7 +270,7 @@ WERROR NetLocalGroupDel_r(struct libnetapi_ctx *ctx,
ZERO_STRUCT(alias_handle);
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -442,7 +442,7 @@ WERROR NetLocalGroupGetInfo_r(struct libnetapi_ctx *ctx,
ZERO_STRUCT(alias_handle);
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -613,7 +613,7 @@ WERROR NetLocalGroupSetInfo_r(struct libnetapi_ctx *ctx,
ZERO_STRUCT(alias_handle);
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -755,7 +755,7 @@ WERROR NetLocalGroupEnum_r(struct libnetapi_ctx *ctx,
ZERO_STRUCT(alias_handle);
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -1042,7 +1042,7 @@ static WERROR NetLocalGroupModifyMembers_r(struct libnetapi_ctx *ctx,
if (r->in.level == 3) {
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_lsarpc.syntax_id,
NDR_LSARPC_UUID, NDR_LSARPC_VERSION,
&lsa_pipe);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -1061,7 +1061,7 @@ static WERROR NetLocalGroupModifyMembers_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;

View File

@ -53,7 +53,7 @@ NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, char **debugl
WERROR libnetapi_shutdown_cm(struct libnetapi_ctx *ctx);
WERROR libnetapi_open_pipe(struct libnetapi_ctx *ctx,
const char *server_name,
const struct ndr_syntax_id *interface,
const char *interface, uint32_t interface_version,
struct rpc_pipe_client **presult);
WERROR libnetapi_samr_open_domain(struct libnetapi_ctx *mem_ctx,
struct rpc_pipe_client *pipe_cli,

View File

@ -129,7 +129,7 @@ WERROR I_NetLogonControl_r(struct libnetapi_ctx *ctx,
union netr_CONTROL_QUERY_INFORMATION query;
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_netlogon.syntax_id,
NDR_NETLOGON_UUID, NDR_NETLOGON_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -183,7 +183,7 @@ WERROR I_NetLogonControl2_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_netlogon.syntax_id,
NDR_NETLOGON_UUID, NDR_NETLOGON_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;

View File

@ -501,7 +501,7 @@ WERROR NetServerGetInfo_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_srvsvc.syntax_id,
NDR_SRVSVC_UUID, NDR_SRVSVC_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -598,7 +598,7 @@ WERROR NetServerSetInfo_r(struct libnetapi_ctx *ctx,
union srvsvc_NetSrvInfo info;
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_srvsvc.syntax_id,
NDR_SRVSVC_UUID, NDR_SRVSVC_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -640,7 +640,7 @@ WERROR NetRemoteTOD_r(struct libnetapi_ctx *ctx,
struct srvsvc_NetRemoteTODInfo *info = NULL;
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_srvsvc.syntax_id,
NDR_SRVSVC_UUID, NDR_SRVSVC_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;

View File

@ -199,7 +199,7 @@ WERROR NetShareAdd_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_srvsvc.syntax_id,
NDR_SRVSVC_UUID, NDR_SRVSVC_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -252,7 +252,7 @@ WERROR NetShareDel_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_srvsvc.syntax_id,
NDR_SRVSVC_UUID, NDR_SRVSVC_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -315,7 +315,7 @@ 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,
NDR_SRVSVC_UUID, NDR_SRVSVC_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -416,7 +416,7 @@ WERROR NetShareGetInfo_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_srvsvc.syntax_id,
NDR_SRVSVC_UUID, NDR_SRVSVC_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -486,7 +486,7 @@ WERROR NetShareSetInfo_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_srvsvc.syntax_id,
NDR_SRVSVC_UUID, NDR_SRVSVC_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;

View File

@ -36,7 +36,8 @@ WERROR NetShutdownInit_r(struct libnetapi_ctx *ctx,
struct lsa_StringLarge message;
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_initshutdown.syntax_id,
NDR_INITSHUTDOWN_UUID,
NDR_INITSHUTDOWN_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -80,7 +81,8 @@ WERROR NetShutdownAbort_r(struct libnetapi_ctx *ctx,
struct rpc_pipe_client *pipe_cli = NULL;
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_initshutdown.syntax_id,
NDR_INITSHUTDOWN_UUID,
NDR_INITSHUTDOWN_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;

View File

@ -381,7 +381,7 @@ WERROR NetUserAdd_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -508,7 +508,7 @@ WERROR NetUserDel_r(struct libnetapi_ctx *ctx,
ZERO_STRUCT(user_handle);
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
@ -1215,7 +1215,7 @@ WERROR NetUserEnum_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -1514,7 +1514,7 @@ WERROR NetQueryDisplayInformation_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -1640,7 +1640,7 @@ WERROR NetUserGetInfo_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -1794,7 +1794,7 @@ WERROR NetUserSetInfo_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -2214,7 +2214,7 @@ WERROR NetUserModalsGet_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -2692,7 +2692,7 @@ WERROR NetUserModalsSet_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -2825,7 +2825,7 @@ WERROR NetUserGetGroups_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -2976,7 +2976,7 @@ WERROR NetUserSetGroups_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;
@ -3258,7 +3258,7 @@ WERROR NetUserGetLocalGroups_r(struct libnetapi_ctx *ctx,
}
werr = libnetapi_open_pipe(ctx, r->in.server_name,
&ndr_table_samr.syntax_id,
NDR_SAMR_UUID, NDR_SAMR_VERSION,
&pipe_cli);
if (!W_ERROR_IS_OK(werr)) {
goto done;