diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2003-04-28 17:48:48 +0000 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2003-04-28 17:48:48 +0000 |
commit | 17a3acafa89bfc6090b0767d05a00a7505003fcc (patch) | |
tree | 8c1ddf10d38ef69a9e72a009d6dc890e5bbe901c /source3/rpc_server/srv_pipe.c | |
parent | cff01c538f3647f5169a8e5a3ab4b77ad0cebce5 (diff) | |
download | samba-17a3acafa89bfc6090b0767d05a00a7505003fcc.tar.gz samba-17a3acafa89bfc6090b0767d05a00a7505003fcc.tar.bz2 samba-17a3acafa89bfc6090b0767d05a00a7505003fcc.zip |
Use NTSTATUS as return value for smb_register_*() functions and init_module()
function. Patch by metze with some minor modifications.
(This used to be commit bc4b51bcb2daa7271c884cb83bf8bdba6d3a9b6d)
Diffstat (limited to 'source3/rpc_server/srv_pipe.c')
-rw-r--r-- | source3/rpc_server/srv_pipe.c | 26 |
1 files changed, 22 insertions, 4 deletions
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)) |