1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

s3: rpc_server: Remove dead code

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Samuel Cabrero 2019-11-04 19:01:28 +01:00 committed by Andrew Bartlett
parent 70fa7e817e
commit 10cea64e4c
9 changed files with 2 additions and 189 deletions

View File

@ -227,48 +227,10 @@ sub boilerplate_iface($)
$self->pidl("{");
$self->indent();
$self->pidl("struct pipes_struct *p = NULL;");
$self->pidl("struct pipe_rpc_fns *context_fns = NULL;");
$self->pidl("bool ok = false;");
$self->pidl("");
$self->pidl("/* Retrieve pipes struct */");
$self->pidl("p = dcesrv_get_pipes_struct(context->conn);");
$self->pidl("");
$self->pidl("/* TODO check loop */");
$self->pidl("/* Init pipe context */");
$self->pidl("p->pipe_bound = true;");
$self->pidl("for (context_fns = p->contexts; context_fns != NULL; context_fns = context_fns->next) {");
$self->indent();
$self->pidl("if (context_fns->context_id != context->context_id) {");
$self->indent();
$self->pidl("continue;");
$self->deindent();
$self->pidl("}");
$self->pidl("ok = ndr_syntax_id_equal(&context_fns->syntax, &iface->syntax_id);");
$self->pidl("if (ok) {");
$self->indent();
$self->pidl("break;");
$self->deindent();
$self->pidl("}");
$self->pidl("return NT_STATUS_UNSUCCESSFUL;");
$self->deindent();
$self->pidl("}");
$self->pidl("if (context_fns == NULL) {");
$self->indent();
$self->pidl("context_fns = talloc_zero(p, struct pipe_rpc_fns);");
$self->pidl("if (context_fns == NULL) {");
$self->indent();
$self->pidl("return NT_STATUS_NO_MEMORY;");
$self->deindent();
$self->pidl("}");
$self->pidl("");
$self->pidl("context_fns->next = context_fns->prev = NULL;");
$self->pidl("context_fns->context_id = context->context_id;");
$self->pidl("context_fns->syntax = iface->syntax_id;");
$self->pidl("DLIST_ADD( p->contexts, context_fns);");
$self->deindent();
$self->pidl("}");
$self->pidlnoindent("#ifdef DCESRV_INTERFACE_$uname\_BIND");
$self->pidl("return DCESRV_INTERFACE_$uname\_BIND(context,iface);");
$self->pidlnoindent("#else");

View File

@ -1,43 +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 "ntdomain.h"
#include "rpc_contexts.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_SRV
struct pipe_rpc_fns *find_pipe_fns_by_context(struct pipe_rpc_fns *list,
uint32_t context_id)
{
struct pipe_rpc_fns *fns = NULL;
if ( !list ) {
DEBUG(0,("find_pipe_fns_by_context: ERROR! No context list for pipe!\n"));
return NULL;
}
for (fns=list; fns; fns=fns->next ) {
if ( fns->context_id == context_id )
return fns;
}
return NULL;
}

View File

@ -1,28 +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_RPC_CONTEXTS_H_
#define _RPC_SERVER_RPC_CONTEXTS_H_
struct pipe_rpc_fns;
struct pipe_rpc_fns *find_pipe_fns_by_context(struct pipe_rpc_fns *list,
uint32_t context_id);
#endif /* _RPC_SERVER_RPC_CONTEXTS_H_*/

View File

@ -49,7 +49,6 @@ int make_base_pipes_struct(TALLOC_CTX *mem_ctx,
struct messaging_context *msg_ctx,
const char *pipe_name,
enum dcerpc_transport_t transport,
bool endian,
const struct tsocket_address *remote_address,
const struct tsocket_address *local_address,
struct pipes_struct **_p)
@ -69,7 +68,6 @@ int make_base_pipes_struct(TALLOC_CTX *mem_ctx,
p->msg_ctx = msg_ctx;
p->transport = transport;
p->endian = endian;
p->remote_address = tsocket_address_copy(remote_address, p);
if (p->remote_address == NULL) {

View File

@ -34,7 +34,6 @@
#include "rpc_server/rpc_pipes.h"
#include "../lib/tsocket/tsocket.h"
#include "../lib/util/tevent_ntstatus.h"
#include "rpc_contexts.h"
#include "rpc_server/rpc_config.h"
#include "librpc/ndr/ndr_table.h"
#include "rpc_server/rpc_server.h"
@ -249,7 +248,6 @@ static NTSTATUS make_internal_ncacn_conn(TALLOC_CTX *mem_ctx,
struct messaging_context *msg_ctx,
struct dcerpc_ncacn_conn **_out)
{
struct pipe_rpc_fns *context_fns;
struct dcerpc_ncacn_conn *ncacn_conn = NULL;
const char *pipe_name = NULL;
NTSTATUS status;
@ -296,7 +294,6 @@ static NTSTATUS make_internal_ncacn_conn(TALLOC_CTX *mem_ctx,
msg_ctx,
pipe_name,
NCALRPC,
RPC_LITTLE_ENDIAN,
ncacn_conn->remote_client_addr,
ncacn_conn->local_server_addr,
&ncacn_conn->p);
@ -306,20 +303,6 @@ static NTSTATUS make_internal_ncacn_conn(TALLOC_CTX *mem_ctx,
goto fail;
}
context_fns = talloc_zero(ncacn_conn->p, struct pipe_rpc_fns);
if (context_fns == NULL) {
DBG_ERR("No memory");
status = NT_STATUS_NO_MEMORY;
goto fail;
}
context_fns->next = context_fns->prev = NULL;
context_fns->context_id = 0;
context_fns->syntax = table->syntax_id;
/* add to the list of open contexts */
DLIST_ADD(ncacn_conn->p->contexts, context_fns);
DEBUG(4,("Created internal pipe %s\n", pipe_name));
*_out = ncacn_conn;

View File

@ -28,30 +28,9 @@
struct dcesrv_ep_entry_list;
struct tsocket_address;
struct handle_list;
struct pipes_struct;
struct dcesrv_context;
struct pipe_rpc_fns {
struct pipe_rpc_fns *next, *prev;
/* RPC function table associated with the current rpc_bind (associated by context) */
uint32_t context_id;
struct ndr_syntax_id syntax;
/*
* shall we allow "connect" auth level for this interface ?
*/
bool allow_connect;
/*
* minimal required auth level
*/
enum dcerpc_AuthLevel min_auth_level;
};
/*
* DCE/RPC-specific samba-internal-specific handling of data on
* NamedPipes.
@ -69,11 +48,6 @@ struct pipes_struct {
struct dcesrv_ep_entry_list *ep_entries;
/* linked list of rpc dispatch tables associated
with the open rpc contexts */
struct pipe_rpc_fns *contexts;
struct pipe_auth_data auth;
/*
@ -86,17 +60,11 @@ struct pipes_struct {
*/
int fault_state;
/*
* Set to RPC_BIG_ENDIAN when dealing with big-endian PDU's
*/
bool endian;
/* This context is used for PDU data and is freed between each pdu.
Don't use for pipe state storage. */
TALLOC_CTX *mem_ctx;
/* handle database to use on this pipe. */
struct handle_list *pipe_handles;
struct dcesrv_call_state *dce_call;
/* call id retrieved from the pdu header */
@ -114,7 +82,6 @@ int make_base_pipes_struct(TALLOC_CTX *mem_ctx,
struct messaging_context *msg_ctx,
const char *pipe_name,
enum dcerpc_transport_t transport,
bool endian,
const struct tsocket_address *remote_address,
const struct tsocket_address *local_address,
struct pipes_struct **_p);

View File

@ -53,7 +53,7 @@ int make_server_pipes_struct(TALLOC_CTX *mem_ctx,
int ret;
ret = make_base_pipes_struct(mem_ctx, msg_ctx, pipe_name,
transport, RPC_LITTLE_ENDIAN,
transport,
remote_address, local_address, &p);
if (ret) {
*perrno = ret;

View File

@ -34,36 +34,10 @@ static bool forward_opnum_to_spoolss(uint16_t opnum) {
static NTSTATUS iremotewinspool__op_bind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
{
struct pipes_struct *p = NULL;
struct pipe_rpc_fns *context_fns = NULL;
bool ok = false;
/* Retrieve pipes struct */
p = dcesrv_get_pipes_struct(context->conn);
/* TODO check loop */
/* Init pipe context */
p->pipe_bound = true;
for (context_fns = p->contexts; context_fns != NULL; context_fns = context_fns->next) {
if (context_fns->context_id != context->context_id) {
continue;
}
ok = ndr_syntax_id_equal(&context_fns->syntax, &iface->syntax_id);
if (ok) {
break;
}
return NT_STATUS_UNSUCCESSFUL;
}
if (context_fns == NULL) {
context_fns = talloc_zero(p, struct pipe_rpc_fns);
if (context_fns == NULL) {
return NT_STATUS_NO_MEMORY;
}
context_fns->next = context_fns->prev = NULL;
context_fns->context_id = context->context_id;
context_fns->syntax = iface->syntax_id;
DLIST_ADD( p->contexts, context_fns);
}
#ifdef DCESRV_INTERFACE_IREMOTEWINSPOOL_BIND
return DCESRV_INTERFACE_IREMOTEWINSPOOL_BIND(context,iface);
#else

View File

@ -10,7 +10,7 @@ bld.SAMBA3_SUBSYSTEM('RPC_CONFIG',
deps='talloc')
bld.SAMBA3_SUBSYSTEM('RPC_NCACN_NP',
source='rpc_ncacn_np.c rpc_handles.c rpc_contexts.c',
source='rpc_ncacn_np.c rpc_handles.c',
deps='RPC_CONFIG auth common_auth npa_tstream')
bld.SAMBA3_SUBSYSTEM('RPC_SERVER_LOOP',