s3:rpc_server: Remove dead code
authorSamuel Cabrero <scabrero@suse.de>
Tue, 28 May 2019 15:15:19 +0000 (17:15 +0200)
committerSamuel Cabrero <scabrero@sn-devel-184>
Fri, 20 Mar 2020 17:11:28 +0000 (17:11 +0000)
Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Samuel Cabrero <scabrero@samba.org>
Autobuild-Date(master): Fri Mar 20 17:11:28 UTC 2020 on sn-devel-184

source3/include/ntdomain.h
source3/librpc/rpc/dcerpc.h
source3/rpc_server/rpc_ncacn_np.c
source3/rpc_server/rpc_pipes.h
source3/rpc_server/srv_pipe_internal.h [deleted file]
source3/rpc_server/srv_pipe_register.c [deleted file]
source3/rpc_server/srv_pipe_register.h [deleted file]
source3/rpc_server/wscript_build

index 6f457f8c4c1b4a92cc8e01d5fc7274a9ab72490c..9076c1172648a4a18e917df45f70b2cac5f71e20 100644 (file)
@@ -32,6 +32,4 @@ struct gse_context;
 
 #include "rpc_server/rpc_pipes.h"
 
-#include "rpc_server/srv_pipe_register.h"
-
 #endif /* _NT_DOMAIN_H */
index e032a7479e644a71374e08ce114f13714508339c..4b76c5c6d554abf902c3887e2bc0ab1d5f2f7920 100644 (file)
@@ -30,8 +30,6 @@
 #include "../librpc/ndr/libndr.h"
 #include "../librpc/rpc/rpc_common.h"
 
-#define SMB_RPC_INTERFACE_VERSION 1
-
 struct NL_AUTH_MESSAGE;
 struct gensec_security;
 
index 703036ae7f1e1566c70f51d22a45e08584ae6618..850dd6b90a1326fc9090089c0e82d5b68944c8d6 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "includes.h"
 #include "rpc_client/cli_pipe.h"
-#include "rpc_server/srv_pipe_internal.h"
 #include "rpc_dce.h"
 #include "../libcli/named_pipe_auth/npa_tstream.h"
 #include "rpc_server/rpc_ncacn_np.h"
index d80b35d6024d4b2d60dd84d0c9443dda4ffd2a73..e9a0ca6589d890d80f1a4308ee3986e1a56060f3 100644 (file)
 
 #include "librpc/rpc/dcerpc.h"
 
-typedef struct _output_data {
-       /*
-        * Raw RPC output data. This does not include RPC headers or footers.
-        */
-       DATA_BLOB rdata;
-
-       /* The amount of data sent from the current rdata struct. */
-       uint32_t data_sent_length;
-
-       /*
-        * The current fragment being returned. This inclues
-        * headers, data and authentication footer.
-        */
-       DATA_BLOB frag;
-
-       /* The amount of data sent from the current PDU. */
-       uint32_t current_pdu_sent;
-} output_data;
-
-typedef struct _input_data {
-       /*
-        * This is the current incoming pdu. The data here
-        * is collected via multiple writes until a complete
-        * pdu is seen, then the data is copied into the in_data
-        * structure. The maximum size of this is 0x1630 (RPC_MAX_PDU_FRAG_LEN).
-        * If length is zero, then we are at the start of a new
-        * pdu.
-        */
-       DATA_BLOB pdu;
-
-       /*
-        * The amount of data needed to complete the in_pdu.
-        * If this is zero, then we are at the start of a new
-        * pdu.
-        */
-       uint32_t pdu_needed_len;
-
-       /*
-        * This is the collection of input data with all
-        * the rpc headers and auth footers removed.
-        * The maximum length of this (1Mb) is strictly enforced.
-        */
-       DATA_BLOB data;
-
-} input_data;
-
 struct dcesrv_ep_entry_list;
 struct tsocket_address;
 struct handle_list;
 struct pipes_struct;
 
-struct api_struct {
-       const char *name;
-       uint8_t opnum;
-       bool (*fn) (struct pipes_struct *);
-};
-
 struct pipe_rpc_fns {
 
        struct pipe_rpc_fns *next, *prev;
@@ -142,18 +90,6 @@ struct pipes_struct {
         */
        bool endian;
 
-       /*
-        * Struct to deal with multiple pdu inputs.
-        */
-
-       input_data in_data;
-
-       /*
-        * Struct to deal with multiple pdu outputs.
-        */
-
-       output_data out_data;
-
        /* This context is used for PDU data and is freed between each pdu.
                Don't use for pipe state storage. */
        TALLOC_CTX *mem_ctx;
diff --git a/source3/rpc_server/srv_pipe_internal.h b/source3/rpc_server/srv_pipe_internal.h
deleted file mode 100644 (file)
index f84c6aa..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *  Unix SMB/CIFS implementation.
- *  RPC Pipe client / server routines
- *  Almost completely rewritten by (C) Jeremy Allison 2005 - 2010
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _RPC_PIPE_INTERNAL_H_
-#define _RPC_PIPE_INTERNAL_H_
-
-#include "includes.h"
-
-bool rpc_srv_pipe_exists_by_id(const struct ndr_syntax_id *id);
-
-bool rpc_srv_pipe_exists_by_cli_name(const char *cli_name);
-
-bool rpc_srv_pipe_exists_by_srv_name(const char *srv_name);
-
-const char *rpc_srv_get_pipe_cli_name(const struct ndr_syntax_id *id);
-
-const char *rpc_srv_get_pipe_srv_name(const struct ndr_syntax_id *id);
-
-uint32_t rpc_srv_get_pipe_num_cmds(const struct ndr_syntax_id *id);
-
-const struct api_struct *rpc_srv_get_pipe_cmds(const struct ndr_syntax_id *id);
-
-bool rpc_srv_get_pipe_interface_by_cli_name(const char *cli_name,
-                                           struct ndr_syntax_id *id);
-
-#endif /* _RPC_PIPE_INTERNAL_H_ */
diff --git a/source3/rpc_server/srv_pipe_register.c b/source3/rpc_server/srv_pipe_register.c
deleted file mode 100644 (file)
index c3500c9..0000000
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- *  Unix SMB/CIFS implementation.
- *  RPC Pipe client / server routines
- *  Almost completely rewritten by (C) Jeremy Allison 2005 - 2010
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "includes.h"
-#include "librpc/rpc/dcerpc.h"
-#include "srv_pipe_internal.h"
-#include "rpc_server/srv_pipe_register.h"
-
-#undef DBGC_CLASS
-#define DBGC_CLASS DBGC_RPC_SRV
-
-struct rpc_table {
-       struct {
-               const char *clnt;
-               const char *srv;
-       } pipe;
-       struct ndr_syntax_id rpc_interface;
-       const struct api_struct *cmds;
-       uint32_t n_cmds;
-       bool (*shutdown_fn)(void *private_data);
-       void *shutdown_data;
-};
-
-static struct rpc_table *rpc_lookup;
-static uint32_t rpc_lookup_size;
-
-static struct rpc_table *rpc_srv_get_pipe_by_id(const struct ndr_syntax_id *id)
-{
-       uint32_t i;
-
-       for (i = 0; i < rpc_lookup_size; i++) {
-               if (ndr_syntax_id_equal(&rpc_lookup[i].rpc_interface, id)) {
-                       return &rpc_lookup[i];
-               }
-       }
-
-       return NULL;
-}
-
-bool rpc_srv_pipe_exists_by_id(const struct ndr_syntax_id *id)
-{
-       uint32_t i;
-
-       for (i = 0; i < rpc_lookup_size; i++) {
-               if (ndr_syntax_id_equal(&rpc_lookup[i].rpc_interface, id)) {
-                       return true;
-               }
-       }
-
-       return false;
-}
-
-bool rpc_srv_pipe_exists_by_cli_name(const char *cli_name)
-{
-       uint32_t i;
-
-       for (i = 0; i < rpc_lookup_size; i++) {
-               if (strequal(rpc_lookup[i].pipe.clnt, cli_name)) {
-                       return true;
-               }
-       }
-
-       return false;
-}
-
-bool rpc_srv_pipe_exists_by_srv_name(const char *srv_name)
-{
-       uint32_t i;
-
-       for (i = 0; i < rpc_lookup_size; i++) {
-               if (strequal(rpc_lookup[i].pipe.srv, srv_name)) {
-                       return true;
-               }
-       }
-
-       return false;
-}
-
-const char *rpc_srv_get_pipe_cli_name(const struct ndr_syntax_id *id)
-{
-       uint32_t i;
-
-       for (i = 0; i < rpc_lookup_size; i++) {
-               if (ndr_syntax_id_equal(&rpc_lookup[i].rpc_interface, id)) {
-                       return rpc_lookup[i].pipe.clnt;
-               }
-       }
-
-       return NULL;
-}
-
-const char *rpc_srv_get_pipe_srv_name(const struct ndr_syntax_id *id)
-{
-       uint32_t i;
-
-       for (i = 0; i < rpc_lookup_size; i++) {
-               if (ndr_syntax_id_equal(&rpc_lookup[i].rpc_interface, id)) {
-                       return rpc_lookup[i].pipe.srv;
-               }
-       }
-
-       return NULL;
-}
-
-uint32_t rpc_srv_get_pipe_num_cmds(const struct ndr_syntax_id *id)
-{
-       uint32_t i;
-
-       for (i = 0; i < rpc_lookup_size; i++) {
-               if (ndr_syntax_id_equal(&rpc_lookup[i].rpc_interface, id)) {
-                       return rpc_lookup[i].n_cmds;
-               }
-       }
-
-       return 0;
-}
-
-const struct api_struct *rpc_srv_get_pipe_cmds(const struct ndr_syntax_id *id)
-{
-       uint32_t i;
-
-       for (i = 0; i < rpc_lookup_size; i++) {
-               if (ndr_syntax_id_equal(&rpc_lookup[i].rpc_interface, id)) {
-                       return rpc_lookup[i].cmds;
-               }
-       }
-
-       return NULL;
-}
-
-bool rpc_srv_get_pipe_interface_by_cli_name(const char *cli_name,
-                                           struct ndr_syntax_id *id)
-{
-       uint32_t i;
-
-       for (i = 0; i < rpc_lookup_size; i++) {
-               if (strequal(rpc_lookup[i].pipe.clnt, cli_name)) {
-                       if (id) {
-                               *id = rpc_lookup[i].rpc_interface;
-                       }
-                       return true;
-               }
-       }
-
-       return false;
-}
-
-/*******************************************************************
- Register commands to an RPC pipe
-*******************************************************************/
-
-NTSTATUS rpc_srv_register(int version, const char *clnt, const char *srv,
-                         const struct ndr_interface_table *iface,
-                         const struct api_struct *cmds, int size,
-                         const struct rpc_srv_callbacks *rpc_srv_cb)
-{
-       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;
-       }
-
-       /* Don't register the same command twice */
-       if (rpc_srv_pipe_exists_by_id(&iface->syntax_id)) {
-               return NT_STATUS_OK;
-       }
-
-       /*
-        * We use a temporary variable because this call can fail and
-        * rpc_lookup will still be valid afterwards.  It could then succeed if
-        * called again later
-        */
-       rpc_lookup_size++;
-       rpc_entry = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(rpc_lookup, struct rpc_table, rpc_lookup_size);
-       if (NULL == rpc_entry) {
-               rpc_lookup_size--;
-               DEBUG(0, ("rpc_srv_register: memory allocation failed\n"));
-               return NT_STATUS_NO_MEMORY;
-       } else {
-               rpc_lookup = rpc_entry;
-       }
-
-       rpc_entry = rpc_lookup + (rpc_lookup_size - 1);
-       ZERO_STRUCTP(rpc_entry);
-       rpc_entry->pipe.clnt = SMB_STRDUP(clnt);
-       rpc_entry->pipe.srv = SMB_STRDUP(srv);
-       rpc_entry->rpc_interface = iface->syntax_id;
-       rpc_entry->cmds = cmds;
-       rpc_entry->n_cmds = size;
-
-       if (rpc_srv_cb != NULL) {
-               rpc_entry->shutdown_fn = rpc_srv_cb->shutdown;
-               rpc_entry->shutdown_data = rpc_srv_cb->private_data;
-
-               if (rpc_srv_cb->init != NULL &&
-                   !rpc_srv_cb->init(rpc_srv_cb->private_data)) {
-                       DEBUG(0, ("rpc_srv_register: Failed to call the %s "
-                                 "init function!\n", srv));
-                       return NT_STATUS_UNSUCCESSFUL;
-               }
-       }
-
-       return NT_STATUS_OK;
-}
-
-NTSTATUS rpc_srv_unregister(const struct ndr_interface_table *iface)
-{
-       struct rpc_table *rpc_entry = rpc_srv_get_pipe_by_id(&iface->syntax_id);
-
-       if (rpc_entry != NULL && rpc_entry->shutdown_fn != NULL) {
-               if (!rpc_entry->shutdown_fn(rpc_entry->shutdown_data)) {
-                       DEBUG(0, ("rpc_srv_unregister: Failed to call the %s "
-                                 "init function!\n", rpc_entry->pipe.srv));
-                       return NT_STATUS_UNSUCCESSFUL;
-               }
-       }
-
-       return NT_STATUS_OK;
-}
diff --git a/source3/rpc_server/srv_pipe_register.h b/source3/rpc_server/srv_pipe_register.h
deleted file mode 100644 (file)
index b1b454e..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Unix SMB/CIFS implementation.
- *  RPC Pipe client / server routines
- *  Almost completely rewritten by (C) Jeremy Allison 2005 - 2010
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _RPC_SERVER_SRV_PIPE_REGISTER_H_
-#define _RPC_SERVER_SRV_PIPE_REGISTER_H_
-
-struct rpc_srv_callbacks {
-       bool (*init)(void *private_data);
-       bool (*shutdown)(void *private_data);
-       void *private_data;
-};
-
-/* The following definitions come from rpc_server/srv_rpc_register.c  */
-
-NTSTATUS rpc_srv_register(int version, const char *clnt,
-                         const char *srv,
-                         const struct ndr_interface_table *iface,
-                         const struct api_struct *cmds, int size,
-                         const struct rpc_srv_callbacks *rpc_srv_cb);
-
-NTSTATUS rpc_srv_unregister(const struct ndr_interface_table *iface);
-
-#endif /* _RPC_SERVER_SRV_PIPE_REGISTER_H_ */
index 20693623f9e2a42c7e040a32a4eefe3e3cf1b2c9..791907fdc93801f5caa2a8b842dfefa10fa1dfa7 100644 (file)
@@ -3,7 +3,7 @@
 ### RPC_SERVER
 bld.SAMBA3_SUBSYSTEM('rpc',
                     source='',
-                    deps='RPC_PIPE_REGISTER')
+                    deps='dcerpc-server-core')
 
 bld.SAMBA3_SUBSYSTEM('RPC_CONFIG',
                     source='rpc_config.c',
@@ -11,16 +11,12 @@ bld.SAMBA3_SUBSYSTEM('RPC_CONFIG',
 
 bld.SAMBA3_SUBSYSTEM('RPC_NCACN_NP',
                     source='rpc_ncacn_np.c rpc_handles.c rpc_contexts.c',
-                    deps='RPC_CONFIG auth common_auth RPC_PIPE_REGISTER npa_tstream')
+                    deps='RPC_CONFIG auth common_auth npa_tstream')
 
 bld.SAMBA3_SUBSYSTEM('RPC_SERVER_LOOP',
                     source='rpc_server.c',
                     deps='samba-util')
 
-bld.SAMBA3_SUBSYSTEM('RPC_PIPE_REGISTER',
-                    source='srv_pipe_register.c',
-                    deps='samba-util')
-
 bld.SAMBA3_SUBSYSTEM('SRV_ACCESS_CHECK',
                     source='srv_access_check.c',
                     deps='samba-util')