diff options
Diffstat (limited to 'source3/rpc_server')
-rw-r--r-- | source3/rpc_server/srv_dfs.c | 4 | ||||
-rw-r--r-- | source3/rpc_server/srv_echo.c | 4 | ||||
-rw-r--r-- | source3/rpc_server/srv_lsa.c | 4 | ||||
-rw-r--r-- | source3/rpc_server/srv_netlog.c | 4 | ||||
-rw-r--r-- | source3/rpc_server/srv_pipe.c | 26 | ||||
-rw-r--r-- | source3/rpc_server/srv_reg.c | 4 | ||||
-rw-r--r-- | source3/rpc_server/srv_samr.c | 4 | ||||
-rwxr-xr-x | source3/rpc_server/srv_spoolss.c | 4 | ||||
-rw-r--r-- | source3/rpc_server/srv_srvsvc.c | 4 | ||||
-rw-r--r-- | source3/rpc_server/srv_wkssvc.c | 4 |
10 files changed, 40 insertions, 22 deletions
diff --git a/source3/rpc_server/srv_dfs.c b/source3/rpc_server/srv_dfs.c index 0807efd550..75a24174ea 100644 --- a/source3/rpc_server/srv_dfs.c +++ b/source3/rpc_server/srv_dfs.c @@ -158,7 +158,7 @@ static BOOL api_dfs_enum(pipes_struct *p) \pipe\netdfs commands ********************************************************************/ -int rpc_dfs_init(void) +NTSTATUS rpc_dfs_init(void) { struct api_struct api_netdfs_cmds[] = { @@ -168,6 +168,6 @@ int rpc_dfs_init(void) {"DFS_GET_INFO", DFS_GET_INFO, api_dfs_get_info }, {"DFS_ENUM", DFS_ENUM, api_dfs_enum } }; - return rpc_pipe_register_commands("netdfs", "netdfs", api_netdfs_cmds, + return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "netdfs", "netdfs", api_netdfs_cmds, sizeof(api_netdfs_cmds) / sizeof(struct api_struct)); } diff --git a/source3/rpc_server/srv_echo.c b/source3/rpc_server/srv_echo.c index dcd8dd0c53..166b6e939d 100644 --- a/source3/rpc_server/srv_echo.c +++ b/source3/rpc_server/srv_echo.c @@ -120,7 +120,7 @@ static BOOL api_sink_data(pipes_struct *p) \pipe\rpcecho commands ********************************************************************/ -int rpc_echo_init(void) +NTSTATUS rpc_echo_init(void) { struct api_struct api_echo_cmds[] = { {"ADD_ONE", ECHO_ADD_ONE, api_add_one }, @@ -129,7 +129,7 @@ int rpc_echo_init(void) {"SINK_DATA", ECHO_SINK_DATA, api_sink_data }, }; - return rpc_pipe_register_commands( + return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "rpcecho", "rpcecho", api_echo_cmds, sizeof(api_echo_cmds) / sizeof(struct api_struct)); } diff --git a/source3/rpc_server/srv_lsa.c b/source3/rpc_server/srv_lsa.c index bfa706acf2..7bd300dc7c 100644 --- a/source3/rpc_server/srv_lsa.c +++ b/source3/rpc_server/srv_lsa.c @@ -771,7 +771,7 @@ static BOOL api_lsa_remove_acct_rights(pipes_struct *p) \PIPE\ntlsa commands ***************************************************************************/ -int rpc_lsa_init(void) +NTSTATUS rpc_lsa_init(void) { static const struct api_struct api_lsa_cmds[] = { @@ -801,6 +801,6 @@ int rpc_lsa_init(void) { "LSA_REMOVEACCTRIGHTS", LSA_REMOVEACCTRIGHTS, api_lsa_remove_acct_rights}, }; - return rpc_pipe_register_commands("lsarpc", "lsass", api_lsa_cmds, + return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "lsarpc", "lsass", api_lsa_cmds, sizeof(api_lsa_cmds) / sizeof(struct api_struct)); } diff --git a/source3/rpc_server/srv_netlog.c b/source3/rpc_server/srv_netlog.c index 7dc0f57f34..0cd4073177 100644 --- a/source3/rpc_server/srv_netlog.c +++ b/source3/rpc_server/srv_netlog.c @@ -321,7 +321,7 @@ static BOOL api_net_logon_ctrl(pipes_struct *p) array of \PIPE\NETLOGON operations ********************************************************************/ -int rpc_net_init(void) +NTSTATUS rpc_net_init(void) { static struct api_struct api_net_cmds [] = { @@ -336,6 +336,6 @@ int rpc_net_init(void) { "NET_LOGON_CTRL" , NET_LOGON_CTRL , api_net_logon_ctrl } }; - return rpc_pipe_register_commands("NETLOGON", "lsass", api_net_cmds, + return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "NETLOGON", "lsass", api_net_cmds, sizeof(api_net_cmds) / sizeof(struct api_struct)); } diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index b09058629a..5b9d39ddc7 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -781,10 +781,28 @@ BOOL check_bind_req(char* pipe_name, RPC_IFACE* abstract, /******************************************************************* Register commands to an RPC pipe *******************************************************************/ -int rpc_pipe_register_commands(const char *clnt, const char *srv, const struct api_struct *cmds, int size) +NTSTATUS rpc_pipe_register_commands(int version, const char *clnt, const char *srv, const struct api_struct *cmds, int size) { struct rpc_table *rpc_entry; + if (!clnt || !srv || !cmds) { + return NT_STATUS_INVALID_PARAMETER; + } + + if (version != SMB_RPC_INTERFACE_VERSION) { + DEBUG(0,("Can't register rpc commands!\n" + "You tried to register a rpc module with SMB_RPC_INTERFACE_VERSION %d" + ", while this version of samba uses version %d!\n", + version,SMB_RPC_INTERFACE_VERSION)); + return NT_STATUS_OBJECT_TYPE_MISMATCH; + } + + /* TODO: + * + * we still need to make sure that don't register the same commands twice!!! + * + * --metze + */ /* We use a temporary variable because this call can fail and rpc_lookup will still be valid afterwards. It could then succeed if @@ -794,7 +812,7 @@ int rpc_pipe_register_commands(const char *clnt, const char *srv, const struct a if (NULL == rpc_entry) { rpc_lookup_size--; DEBUG(0, ("rpc_pipe_register_commands: memory allocation failed\n")); - return 0; + return NT_STATUS_NO_MEMORY; } else { rpc_lookup = rpc_entry; } @@ -810,7 +828,7 @@ int rpc_pipe_register_commands(const char *clnt, const char *srv, const struct a size * sizeof(struct api_struct)); rpc_entry->n_cmds += size; - return size; + return NT_STATUS_OK; } /******************************************************************* @@ -852,7 +870,7 @@ BOOL api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p) } if (i == rpc_lookup_size) { - if (!smb_probe_module("rpc", p->name)) { + if (NT_STATUS_IS_ERR(smb_probe_module("rpc", p->name))) { DEBUG(3,("api_pipe_bind_req: Unknown pipe name %s in bind request.\n", p->name )); if(!setup_bind_nak(p)) diff --git a/source3/rpc_server/srv_reg.c b/source3/rpc_server/srv_reg.c index f72d8e4f29..43bb1ad86a 100644 --- a/source3/rpc_server/srv_reg.c +++ b/source3/rpc_server/srv_reg.c @@ -373,7 +373,7 @@ static BOOL api_reg_save_key(pipes_struct *p) array of \PIPE\reg operations ********************************************************************/ -int rpc_reg_init(void) +NTSTATUS rpc_reg_init(void) { static struct api_struct api_reg_cmds[] = { @@ -391,6 +391,6 @@ int rpc_reg_init(void) { "REG_UNKNOWN_1A" , REG_UNKNOWN_1A , api_reg_unknown_1a }, { "REG_SAVE_KEY" , REG_SAVE_KEY , api_reg_save_key } }; - return rpc_pipe_register_commands("winreg", "winreg", api_reg_cmds, + return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "winreg", "winreg", api_reg_cmds, sizeof(api_reg_cmds) / sizeof(struct api_struct)); } diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c index 67c092775b..9250b023d3 100644 --- a/source3/rpc_server/srv_samr.c +++ b/source3/rpc_server/srv_samr.c @@ -1443,7 +1443,7 @@ static BOOL api_samr_set_dom_info(pipes_struct *p) array of \PIPE\samr operations ********************************************************************/ -int rpc_samr_init(void) +NTSTATUS rpc_samr_init(void) { static struct api_struct api_samr_cmds [] = { @@ -1501,6 +1501,6 @@ int rpc_samr_init(void) {"SAMR_SET_DOMAIN_INFO" , SAMR_SET_DOMAIN_INFO , api_samr_set_dom_info }, {"SAMR_CONNECT4" , SAMR_CONNECT4 , api_samr_connect4 } }; - return rpc_pipe_register_commands("samr", "lsass", api_samr_cmds, + return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "samr", "lsass", api_samr_cmds, sizeof(api_samr_cmds) / sizeof(struct api_struct)); } diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c index a7dd7a6cef..3e9ed9e39f 100755 --- a/source3/rpc_server/srv_spoolss.c +++ b/source3/rpc_server/srv_spoolss.c @@ -1580,7 +1580,7 @@ static BOOL api_spoolss_replycloseprinter(pipes_struct *p) \pipe\spoolss commands ********************************************************************/ -int rpc_spoolss_init(void) +NTSTATUS rpc_spoolss_init(void) { struct api_struct api_spoolss_cmds[] = { @@ -1640,6 +1640,6 @@ int rpc_spoolss_init(void) {"SPOOLSS_REPLYCLOSEPRINTER", SPOOLSS_REPLYCLOSEPRINTER, api_spoolss_replycloseprinter } #endif }; - return rpc_pipe_register_commands("spoolss", "spoolss", api_spoolss_cmds, + return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "spoolss", "spoolss", api_spoolss_cmds, sizeof(api_spoolss_cmds) / sizeof(struct api_struct)); } diff --git a/source3/rpc_server/srv_srvsvc.c b/source3/rpc_server/srv_srvsvc.c index 96820ae74b..deba122421 100644 --- a/source3/rpc_server/srv_srvsvc.c +++ b/source3/rpc_server/srv_srvsvc.c @@ -526,7 +526,7 @@ static BOOL api_srv_net_file_set_secdesc(pipes_struct *p) \PIPE\srvsvc commands ********************************************************************/ -int rpc_srv_init(void) +NTSTATUS rpc_srv_init(void) { static const struct api_struct api_srv_cmds[] = { @@ -548,6 +548,6 @@ int rpc_srv_init(void) { "SRV_NET_FILE_QUERY_SECDESC", SRV_NET_FILE_QUERY_SECDESC, api_srv_net_file_query_secdesc }, { "SRV_NET_FILE_SET_SECDESC" , SRV_NET_FILE_SET_SECDESC , api_srv_net_file_set_secdesc } }; - return rpc_pipe_register_commands("srvsvc", "ntsvcs", api_srv_cmds, + return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "srvsvc", "ntsvcs", api_srv_cmds, sizeof(api_srv_cmds) / sizeof(struct api_struct)); } diff --git a/source3/rpc_server/srv_wkssvc.c b/source3/rpc_server/srv_wkssvc.c index ddcbadd1d4..8efa29fd0b 100644 --- a/source3/rpc_server/srv_wkssvc.c +++ b/source3/rpc_server/srv_wkssvc.c @@ -60,12 +60,12 @@ static BOOL api_wks_query_info(pipes_struct *p) \PIPE\wkssvc commands ********************************************************************/ -int rpc_wks_init(void) +NTSTATUS rpc_wks_init(void) { static struct api_struct api_wks_cmds[] = { { "WKS_Q_QUERY_INFO", WKS_QUERY_INFO, api_wks_query_info } }; - return rpc_pipe_register_commands("wkssvc", "ntsvcs", api_wks_cmds, + return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "wkssvc", "ntsvcs", api_wks_cmds, sizeof(api_wks_cmds) / sizeof(struct api_struct)); } |