From bf6c11fea3e28532bd8ebc503e9d4d8dfb68e0e0 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Jul 2008 20:40:27 +0200 Subject: [PATCH] Make the pipe_names[] array static to cli_pipe.c (This used to be commit ab7ab350591bf16717744a0c252d3a9d185bcb77) --- source3/rpc_client/cli_pipe.c | 79 ++++++++++++++++++++++++++++++++++++++++++- source3/rpc_parse/parse_rpc.c | 63 ---------------------------------- 2 files changed, 78 insertions(+), 64 deletions(-) diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index 5e8bff31162..169fe79406f 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -23,7 +23,84 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_CLI -extern struct pipe_id_info pipe_names[]; +/******************************************************************* +interface/version dce/rpc pipe identification +********************************************************************/ + +static const struct ndr_syntax_id syntax_spoolss = { + { + 0x12345678, 0x1234, 0xabcd, + { 0xef, 0x00 }, + { 0x01, 0x23, + 0x45, 0x67, 0x89, 0xab } + }, 0x01 +}; + +/* + * IMPORTANT!! If you update this structure, make sure to + * update the index #defines in smb.h. + */ + +static const struct pipe_id_info pipe_names [] = +{ + { PIPE_LSARPC, &ndr_table_lsarpc.syntax_id, + PIPE_LSASS, &ndr_transfer_syntax }, + { PIPE_LSARPC, &ndr_table_dssetup.syntax_id, + PIPE_LSASS, &ndr_transfer_syntax }, + { PIPE_SAMR, &ndr_table_samr.syntax_id, + PIPE_LSASS, &ndr_transfer_syntax }, + { PIPE_NETLOGON, &ndr_table_netlogon.syntax_id, + PIPE_LSASS, &ndr_transfer_syntax }, + { PIPE_SRVSVC, &ndr_table_srvsvc.syntax_id, + PIPE_NTSVCS, &ndr_transfer_syntax }, + { PIPE_WKSSVC, &ndr_table_wkssvc.syntax_id, + PIPE_NTSVCS, &ndr_transfer_syntax }, + { PIPE_WINREG, &ndr_table_winreg.syntax_id, + PIPE_WINREG, &ndr_transfer_syntax }, + { PIPE_SPOOLSS, &syntax_spoolss, + PIPE_SPOOLSS, &ndr_transfer_syntax }, + { PIPE_NETDFS, &ndr_table_netdfs.syntax_id, + PIPE_NETDFS, &ndr_transfer_syntax }, + { PIPE_ECHO, &ndr_table_rpcecho.syntax_id, + PIPE_ECHO, &ndr_transfer_syntax }, + { PIPE_SHUTDOWN, &ndr_table_initshutdown.syntax_id, + PIPE_SHUTDOWN, &ndr_transfer_syntax }, + { PIPE_SVCCTL, &ndr_table_svcctl.syntax_id, + PIPE_NTSVCS, &ndr_transfer_syntax }, + { PIPE_EVENTLOG, &ndr_table_eventlog.syntax_id, + PIPE_EVENTLOG, &ndr_transfer_syntax }, + { PIPE_NTSVCS, &ndr_table_ntsvcs.syntax_id, + PIPE_NTSVCS, &ndr_transfer_syntax }, + { PIPE_EPMAPPER, &ndr_table_epmapper.syntax_id, + PIPE_EPMAPPER, &ndr_transfer_syntax }, + { PIPE_DRSUAPI, &ndr_table_drsuapi.syntax_id, + PIPE_DRSUAPI, &ndr_transfer_syntax }, + { NULL, NULL, NULL, NULL } +}; + +/**************************************************************************** + Return the pipe name from the index. + ****************************************************************************/ + +const char *cli_get_pipe_name(int pipe_idx) +{ + return &pipe_names[pipe_idx].client_pipe[5]; +} + +/**************************************************************************** + Return the pipe idx from the syntax. + ****************************************************************************/ +int cli_get_pipe_idx(const RPC_IFACE *syntax) +{ + int i; + for (i = 0; pipe_names[i].client_pipe; i++) { + if (ndr_syntax_id_equal(pipe_names[i].abstr_syntax, syntax)) { + return i; + } + } + + return -1; +} /******************************************************************** Map internal value to wire value. diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index ac5483dfd1a..14a4effbf03 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -26,69 +26,6 @@ #define DBGC_CLASS DBGC_RPC_PARSE /******************************************************************* -interface/version dce/rpc pipe identification -********************************************************************/ - -const struct ndr_syntax_id syntax_spoolss = { - { - 0x12345678, 0x1234, 0xabcd, - { 0xef, 0x00 }, - { 0x01, 0x23, - 0x45, 0x67, 0x89, 0xab } - }, 0x01 -}; - -/* - * IMPORTANT!! If you update this structure, make sure to - * update the index #defines in smb.h. - */ - -const struct pipe_id_info pipe_names [] = -{ - { PIPE_LSARPC , &ndr_table_lsarpc.syntax_id, PIPE_LSASS , &ndr_transfer_syntax }, - { PIPE_LSARPC , &ndr_table_dssetup.syntax_id, PIPE_LSASS , &ndr_transfer_syntax }, - { PIPE_SAMR , &ndr_table_samr.syntax_id, PIPE_LSASS , &ndr_transfer_syntax }, - { PIPE_NETLOGON, &ndr_table_netlogon.syntax_id, PIPE_LSASS , &ndr_transfer_syntax }, - { PIPE_SRVSVC , &ndr_table_srvsvc.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, - { PIPE_WKSSVC , &ndr_table_wkssvc.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, - { PIPE_WINREG , &ndr_table_winreg.syntax_id, PIPE_WINREG , &ndr_transfer_syntax }, - { PIPE_SPOOLSS , &syntax_spoolss , PIPE_SPOOLSS , &ndr_transfer_syntax }, - { PIPE_NETDFS , &ndr_table_netdfs.syntax_id, PIPE_NETDFS , &ndr_transfer_syntax }, - { PIPE_ECHO , &ndr_table_rpcecho.syntax_id, PIPE_ECHO , &ndr_transfer_syntax }, - { PIPE_SHUTDOWN, &ndr_table_initshutdown.syntax_id, PIPE_SHUTDOWN , &ndr_transfer_syntax }, - { PIPE_SVCCTL , &ndr_table_svcctl.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, - { PIPE_EVENTLOG, &ndr_table_eventlog.syntax_id, PIPE_EVENTLOG , &ndr_transfer_syntax }, - { PIPE_NTSVCS , &ndr_table_ntsvcs.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, - { PIPE_EPMAPPER , &ndr_table_epmapper.syntax_id, PIPE_EPMAPPER , &ndr_transfer_syntax }, - { PIPE_DRSUAPI , &ndr_table_drsuapi.syntax_id, PIPE_DRSUAPI , &ndr_transfer_syntax }, - { NULL , NULL , NULL , NULL } -}; - -/**************************************************************************** - Return the pipe name from the index. - ****************************************************************************/ - -const char *cli_get_pipe_name(int pipe_idx) -{ - return &pipe_names[pipe_idx].client_pipe[5]; -} - -/**************************************************************************** - Return the pipe idx from the syntax. - ****************************************************************************/ -int cli_get_pipe_idx(const RPC_IFACE *syntax) -{ - int i; - for (i = 0; pipe_names[i].client_pipe; i++) { - if (ndr_syntax_id_equal(pipe_names[i].abstr_syntax, syntax)) { - return i; - } - } - - return -1; -} - -/******************************************************************* Inits an RPC_HDR structure. ********************************************************************/ -- 2.11.4.GIT