diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-04-17 17:44:40 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-04-17 17:54:32 +0200 |
commit | a4c60b2696962c7f83e033e00d97e4b1dacc05c9 (patch) | |
tree | dc0375309ccd1081e1b1576fc39ccecc66f3ece9 | |
parent | 1c8553783515fa29b3af8499d9a36f92bdcf32cd (diff) | |
download | samba-a4c60b2696962c7f83e033e00d97e4b1dacc05c9.tar.gz samba-a4c60b2696962c7f83e033e00d97e4b1dacc05c9.tar.bz2 samba-a4c60b2696962c7f83e033e00d97e4b1dacc05c9.zip |
rpc_parse: Use UUIDs from librpc/gen_ndr/ when possible to reduce
duplication.
(This used to be commit 428654b473ba44b2f5340eefef0d4fcd51aff558)
-rw-r--r-- | source3/include/rpc_dce.h | 4 | ||||
-rw-r--r-- | source3/rpc_client/cli_pipe.c | 4 | ||||
-rw-r--r-- | source3/rpc_parse/parse_rpc.c | 213 | ||||
-rw-r--r-- | source3/rpc_server/srv_pipe.c | 8 |
4 files changed, 33 insertions, 196 deletions
diff --git a/source3/include/rpc_dce.h b/source3/include/rpc_dce.h index 2793421734..9b2044fa20 100644 --- a/source3/include/rpc_dce.h +++ b/source3/include/rpc_dce.h @@ -165,10 +165,10 @@ struct pipe_id_info { /* the names appear not to matter: the syntaxes _do_ matter */ const char *client_pipe; - RPC_IFACE abstr_syntax; /* this one is the abstract syntax id */ + const RPC_IFACE *abstr_syntax; /* this one is the abstract syntax id */ const char *server_pipe; /* this one is the secondary syntax name */ - RPC_IFACE trans_syntax; /* this one is the primary syntax id */ + const RPC_IFACE *trans_syntax; /* this one is the primary syntax id */ }; /* RPC_HDR - dce rpc header */ diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index ba59a41793..2a2b547b5e 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -1656,8 +1656,8 @@ static bool valid_pipe_name(const int pipe_idx, RPC_IFACE *abstract, RPC_IFACE * /* copy the required syntaxes out so we can do the right bind */ - *transfer = pipe_names[pipe_idx].trans_syntax; - *abstract = pipe_names[pipe_idx].abstr_syntax; + *transfer = *pipe_names[pipe_idx].trans_syntax; + *abstract = *pipe_names[pipe_idx].abstr_syntax; return True; } diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 7de6998c9d..6b6e1424e0 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -29,176 +29,14 @@ interface/version dce/rpc pipe identification ********************************************************************/ -#define TRANS_SYNT_V2 \ -{ \ - { \ - 0x8a885d04, 0x1ceb, 0x11c9, \ - { 0x9f, 0xe8 }, \ - { 0x08, 0x00, \ - 0x2b, 0x10, 0x48, 0x60 } \ - }, 0x02 \ -} - -#define SYNT_NETLOGON_V2 \ -{ \ - { \ - 0x8a885d04, 0x1ceb, 0x11c9, \ - { 0x9f, 0xe8 }, \ - { 0x08, 0x00, \ - 0x2b, 0x10, 0x48, 0x60 } \ - }, 0x02 \ -} - -#define SYNT_WKSSVC_V1 \ -{ \ - { \ - 0x6bffd098, 0xa112, 0x3610, \ - { 0x98, 0x33 }, \ - { 0x46, 0xc3, \ - 0xf8, 0x7e, 0x34, 0x5a } \ - }, 0x01 \ -} - -#define SYNT_SRVSVC_V3 \ -{ \ - { \ - 0x4b324fc8, 0x1670, 0x01d3, \ - { 0x12, 0x78 }, \ - { 0x5a, 0x47, \ - 0xbf, 0x6e, 0xe1, 0x88 } \ - }, 0x03 \ -} - -#define SYNT_LSARPC_V0 \ -{ \ - { \ - 0x12345778, 0x1234, 0xabcd, \ - { 0xef, 0x00 }, \ - { 0x01, 0x23, \ - 0x45, 0x67, 0x89, 0xab } \ - }, 0x00 \ -} - -#define SYNT_LSARPC_V0_DS \ -{ \ - { \ - 0x3919286a, 0xb10c, 0x11d0, \ - { 0x9b, 0xa8 }, \ - { 0x00, 0xc0, \ - 0x4f, 0xd9, 0x2e, 0xf5 } \ - }, 0x00 \ -} - -#define SYNT_SAMR_V1 \ -{ \ - { \ - 0x12345778, 0x1234, 0xabcd, \ - { 0xef, 0x00 }, \ - { 0x01, 0x23, \ - 0x45, 0x67, 0x89, 0xac } \ - }, 0x01 \ -} - -#define SYNT_NETLOGON_V1 \ -{ \ - { \ - 0x12345678, 0x1234, 0xabcd, \ - { 0xef, 0x00 }, \ - { 0x01, 0x23, \ - 0x45, 0x67, 0xcf, 0xfb } \ - }, 0x01 \ -} - -#define SYNT_WINREG_V1 \ -{ \ - { \ - 0x338cd001, 0x2244, 0x31f1, \ - { 0xaa, 0xaa }, \ - { 0x90, 0x00, \ - 0x38, 0x00, 0x10, 0x03 } \ - }, 0x01 \ -} - -#define SYNT_SPOOLSS_V1 \ -{ \ - { \ - 0x12345678, 0x1234, 0xabcd, \ - { 0xef, 0x00 }, \ - { 0x01, 0x23, \ - 0x45, 0x67, 0x89, 0xab } \ - }, 0x01 \ -} - -#define SYNT_NONE_V0 \ -{ \ - { \ - 0x0, 0x0, 0x0, \ - { 0x00, 0x00 }, \ - { 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00 } \ - }, 0x00 \ -} - -#define SYNT_NETDFS_V3 \ -{ \ - { \ - 0x4fc742e0, 0x4a10, 0x11cf, \ - { 0x82, 0x73 }, \ - { 0x00, 0xaa, \ - 0x00, 0x4a, 0xe6, 0x73 } \ - }, 0x03 \ -} - -#define SYNT_ECHO_V1 \ -{ \ - { \ - 0x60a15ec5, 0x4de8, 0x11d7, \ - { 0xa6, 0x37 }, \ - { 0x00, 0x50, \ - 0x56, 0xa2, 0x01, 0x82 } \ - }, 0x01 \ -} - -#define SYNT_SHUTDOWN_V1 \ -{ \ - { \ - 0x894de0c0, 0x0d55, 0x11d3, \ - { 0xa3, 0x22 }, \ - { 0x00, 0xc0, \ - 0x4f, 0xa3, 0x21, 0xa1 } \ - }, 0x01 \ -} - -#define SYNT_SVCCTL_V2 \ -{ \ - { \ - 0x367abb81, 0x9844, 0x35f1, \ - { 0xad, 0x32 }, \ - { 0x98, 0xf0, \ - 0x38, 0x00, 0x10, 0x03 } \ - }, 0x02 \ -} - - -#define SYNT_EVENTLOG_V0 \ -{ \ - { \ - 0x82273fdc, 0xe32a, 0x18c3, \ - { 0x3f, 0x78 }, \ - { 0x82, 0x79, \ - 0x29, 0xdc, 0x23, 0xea } \ - }, 0x00 \ -} - -#define SYNT_NTSVCS_V1 \ -{ \ - { \ - 0x8d9f4e40, 0xa03d, 0x11ce, \ - { 0x8f, 0x69}, \ - { 0x08, 0x00, \ - 0x3e, 0x30, 0x05, 0x1b } \ - }, 0x01 \ -} +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 @@ -207,22 +45,21 @@ interface/version dce/rpc pipe identification const struct pipe_id_info pipe_names [] = { - /* client pipe , abstract syntax , server pipe , transfer syntax */ - { PIPE_LSARPC , SYNT_LSARPC_V0 , PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_LSARPC , SYNT_LSARPC_V0_DS , PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_SAMR , SYNT_SAMR_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_NETLOGON, SYNT_NETLOGON_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 }, - { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, - { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, - { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, - { PIPE_NETDFS , SYNT_NETDFS_V3 , PIPE_NETDFS , TRANS_SYNT_V2 }, - { PIPE_ECHO , SYNT_ECHO_V1 , PIPE_ECHO , TRANS_SYNT_V2 }, - { PIPE_SHUTDOWN, SYNT_SHUTDOWN_V1 , PIPE_SHUTDOWN , TRANS_SYNT_V2 }, - { PIPE_SVCCTL , SYNT_SVCCTL_V2 , PIPE_NTSVCS , TRANS_SYNT_V2 }, - { PIPE_EVENTLOG, SYNT_EVENTLOG_V0 , PIPE_EVENTLOG , TRANS_SYNT_V2 }, - { PIPE_NTSVCS , SYNT_NTSVCS_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, - { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } + { 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 }, + { NULL , NULL , NULL , NULL } }; /**************************************************************************** @@ -241,8 +78,8 @@ int cli_get_pipe_idx(const RPC_IFACE *syntax) { int i; for (i = 0; pipe_names[i].client_pipe; i++) { - if (GUID_equal(&pipe_names[i].abstr_syntax.uuid, &syntax->uuid) && - pipe_names[i].abstr_syntax.if_version == syntax->if_version) + if (GUID_equal(&pipe_names[i].abstr_syntax->uuid, &syntax->uuid) && + pipe_names[i].abstr_syntax->if_version == syntax->if_version) return i; } diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index 3fe9c7f2ec..52e4fdfd5b 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -986,10 +986,10 @@ bool check_bind_req(struct pipes_struct *p, RPC_IFACE* abstract, for ( i=0; pipe_names[i].client_pipe; i++ ) { DEBUGADD(10,("checking %s\n", pipe_names[i].client_pipe)); if ( strequal(pipe_names[i].client_pipe, pname) - && (abstract->if_version == pipe_names[i].abstr_syntax.if_version) - && (memcmp(&abstract->uuid, &pipe_names[i].abstr_syntax.uuid, sizeof(struct GUID)) == 0) - && (transfer->if_version == pipe_names[i].trans_syntax.if_version) - && (memcmp(&transfer->uuid, &pipe_names[i].trans_syntax.uuid, sizeof(struct GUID)) == 0) ) { + && (abstract->if_version == pipe_names[i].abstr_syntax->if_version) + && (memcmp(&abstract->uuid, &pipe_names[i].abstr_syntax->uuid, sizeof(struct GUID)) == 0) + && (transfer->if_version == pipe_names[i].trans_syntax->if_version) + && (memcmp(&transfer->uuid, &pipe_names[i].trans_syntax->uuid, sizeof(struct GUID)) == 0) ) { struct api_struct *fns = NULL; int n_fns = 0; PIPE_RPC_FNS *context_fns; |