mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
s3-rpc_server: Move config helpers in one place.
Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Simo Sorce <idra@samba.org>
This commit is contained in:
parent
5a4e0dd853
commit
11cbe24ac8
@ -738,6 +738,8 @@ RPC_NCACN_NP = rpc_server/srv_pipe_register.o rpc_server/rpc_ncacn_np.o \
|
||||
rpc_server/rpc_handles.o rpc_server/rpc_contexts.o \
|
||||
rpc_server/srv_access_check.o
|
||||
|
||||
RPC_CONFIG = rpc_server/rpc_config.o
|
||||
|
||||
RPC_SERVICE = rpc_server/rpc_server.o
|
||||
|
||||
RPC_CRYPTO = rpc_server/dcesrv_ntlmssp.o \
|
||||
@ -745,7 +747,7 @@ RPC_CRYPTO = rpc_server/dcesrv_ntlmssp.o \
|
||||
rpc_server/dcesrv_spnego.o
|
||||
|
||||
RPC_PIPE_OBJ = rpc_server/srv_pipe.o rpc_server/srv_pipe_hnd.o \
|
||||
$(RPC_NCACN_NP) $(RPC_SERVICE) $(RPC_CRYPTO)
|
||||
$(RPC_CONFIG) $(RPC_NCACN_NP) $(RPC_SERVICE) $(RPC_CRYPTO)
|
||||
|
||||
RPC_RPCECHO_OBJ = rpc_server/echo/srv_echo_nt.o librpc/gen_ndr/srv_echo.o
|
||||
|
||||
@ -1465,7 +1467,8 @@ WINBINDD_OBJ = \
|
||||
$(PROFILE_OBJ) $(SLCACHE_OBJ) $(SMBLDAP_OBJ) \
|
||||
$(LIBADS_OBJ) $(KRBCLIENT_OBJ) $(POPT_LIB_OBJ) \
|
||||
$(DCUTIL_OBJ) $(IDMAP_OBJ) $(NSS_INFO_OBJ) \
|
||||
$(RPC_NCACN_NP) $(RPC_SAMR_OBJ) $(RPC_LSARPC_OBJ) \
|
||||
$(RPC_CONFIG) $(RPC_NCACN_NP) \
|
||||
$(RPC_SAMR_OBJ) $(RPC_LSARPC_OBJ) \
|
||||
$(NPA_TSTREAM_OBJ) \
|
||||
$(AFS_OBJ) $(AFS_SETTOKEN_OBJ) \
|
||||
$(LIBADS_SERVER_OBJ) \
|
||||
|
115
source3/rpc_server/rpc_config.c
Normal file
115
source3/rpc_server/rpc_config.c
Normal file
@ -0,0 +1,115 @@
|
||||
/*
|
||||
Unix SMB/Netbios implementation.
|
||||
Generic infrstructure for RPC Daemons
|
||||
Copyright (C) Simo Sorce 2011
|
||||
Copyright (C) Andreas Schneider 2011
|
||||
|
||||
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 "rpc_server/rpc_config.h"
|
||||
|
||||
/* the default is "embedded" so this table
|
||||
* lists only services that are not using
|
||||
* the default in order to keep enumerating it
|
||||
* in rpc_service_mode() as short as possible
|
||||
*/
|
||||
struct rpc_service_defaults {
|
||||
const char *name;
|
||||
const char *def_mode;
|
||||
} rpc_service_defaults[] = {
|
||||
{ "epmapper", "external" },
|
||||
/* { "spoolss", "embedded" }, */
|
||||
/* { "lsarpc", "embedded" }, */
|
||||
/* { "samr", "embedded" }, */
|
||||
/* { "netlogon", "embedded" }, */
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
enum rpc_service_mode_e rpc_service_mode(const char *name)
|
||||
{
|
||||
const char *rpcsrv_type;
|
||||
enum rpc_service_mode_e state;
|
||||
const char *def;
|
||||
int i;
|
||||
|
||||
def = "embedded";
|
||||
for (i = 0; rpc_service_defaults[i].name; i++) {
|
||||
if (strcasecmp_m(name, rpc_service_defaults[i].name) == 0) {
|
||||
def = rpc_service_defaults[i].def_mode;
|
||||
}
|
||||
}
|
||||
|
||||
rpcsrv_type = lp_parm_const_string(GLOBAL_SECTION_SNUM,
|
||||
"rpc_server", name, def);
|
||||
|
||||
if (strcasecmp_m(rpcsrv_type, "embedded") == 0) {
|
||||
state = RPC_SERVICE_MODE_EMBEDDED;
|
||||
} else if (strcasecmp_m(rpcsrv_type, "external") == 0) {
|
||||
state = RPC_SERVICE_MODE_EXTERNAL;
|
||||
} else if (strcasecmp(rpcsrv_type, "daemon") == 0) {
|
||||
state = RPC_SERVICE_MODE_DAEMON;
|
||||
} else {
|
||||
state = RPC_SERVICE_MODE_DISABLED;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
/* the default is "embedded" so this table
|
||||
* lists only daemons that are not using
|
||||
* the default in order to keep enumerating it
|
||||
* in rpc_daemon_type() as short as possible
|
||||
*/
|
||||
struct rpc_daemon_defaults {
|
||||
const char *name;
|
||||
const char *def_type;
|
||||
} rpc_daemon_defaults[] = {
|
||||
{ "epmd", "fork" },
|
||||
/* { "spoolssd", "embedded" }, */
|
||||
/* { "lsasd", "embedded" }, */
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
enum rpc_daemon_type_e rpc_daemon_type(const char *name)
|
||||
{
|
||||
const char *rpcsrv_type;
|
||||
enum rpc_daemon_type_e type;
|
||||
const char *def;
|
||||
int i;
|
||||
|
||||
def = "embedded";
|
||||
for (i = 0; rpc_daemon_defaults[i].name; i++) {
|
||||
if (strcasecmp_m(name, rpc_daemon_defaults[i].name) == 0) {
|
||||
def = rpc_daemon_defaults[i].def_type;
|
||||
}
|
||||
}
|
||||
|
||||
rpcsrv_type = lp_parm_const_string(GLOBAL_SECTION_SNUM,
|
||||
"rpc_daemon", name, def);
|
||||
|
||||
if (strcasecmp_m(rpcsrv_type, "embedded") == 0) {
|
||||
type = RPC_DAEMON_EMBEDDED;
|
||||
} else if (strcasecmp_m(rpcsrv_type, "fork") == 0) {
|
||||
type = RPC_DAEMON_FORK;
|
||||
} else {
|
||||
type = RPC_DAEMON_DISABLED;
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
71
source3/rpc_server/rpc_config.h
Normal file
71
source3/rpc_server/rpc_config.h
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Unix SMB/CIFS implementation.
|
||||
*
|
||||
* SMBD RPC service config
|
||||
*
|
||||
* Copyright (c) 2011 Andreas Schneider <asn@samba.org>
|
||||
* Copyright (C) 2011 Simo Sorce <idra@samba.org>
|
||||
*
|
||||
* 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_CONFIG_H
|
||||
#define _RPC_CONFIG_H
|
||||
|
||||
enum rpc_service_mode_e {
|
||||
RPC_SERVICE_MODE_DISABLED = 0,
|
||||
RPC_SERVICE_MODE_EMBEDDED,
|
||||
RPC_SERVICE_MODE_EXTERNAL,
|
||||
RPC_SERVICE_MODE_DAEMON
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Get the mode in which service pipes are configured.
|
||||
*
|
||||
* @param name Name of the service
|
||||
* @param def_mode The default mode for the service
|
||||
*
|
||||
* @return The actual configured mode.
|
||||
*/
|
||||
enum rpc_service_mode_e rpc_service_mode(const char *name);
|
||||
|
||||
#define rpc_epmapper_mode() rpc_service_mode("epmapper")
|
||||
#define rpc_spoolss_mode() rpc_service_mode("spoolss")
|
||||
#define rpc_lsarpc_mode() rpc_service_mode("lsarpc")
|
||||
#define rpc_samr_mode() rpc_service_mode("samr")
|
||||
#define rpc_netlogon_mode() rpc_service_mode("netlogon")
|
||||
|
||||
|
||||
|
||||
enum rpc_daemon_type_e {
|
||||
RPC_DAEMON_DISABLED = 0,
|
||||
RPC_DAEMON_EMBEDDED,
|
||||
RPC_DAEMON_FORK
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Get the mode in which a server is started.
|
||||
*
|
||||
* @param name Name of the rpc server
|
||||
* @param def_type The default type for the server
|
||||
*
|
||||
* @return The actual configured type.
|
||||
*/
|
||||
enum rpc_daemon_type_e rpc_daemon_type(const char *name);
|
||||
|
||||
#define rpc_epmapper_daemon() rpc_daemon_type("epmd")
|
||||
#define rpc_spoolss_daemon() rpc_daemon_type("spoolssd")
|
||||
#define rpc_lsasd_daemon() rpc_daemon_type("lsasd")
|
||||
|
||||
#endif /* _RPC_CONFIG_H */
|
@ -22,6 +22,7 @@
|
||||
#include "includes.h"
|
||||
#include "rpc_server/rpc_pipes.h"
|
||||
#include "rpc_server/rpc_server.h"
|
||||
#include "rpc_server/rpc_config.h"
|
||||
#include "rpc_dce.h"
|
||||
#include "librpc/gen_ndr/netlogon.h"
|
||||
#include "librpc/gen_ndr/auth.h"
|
||||
@ -36,50 +37,6 @@
|
||||
#define SERVER_TCP_LOW_PORT 1024
|
||||
#define SERVER_TCP_HIGH_PORT 1300
|
||||
|
||||
/* the default is "embedded" so this table
|
||||
* lists only daemons that are not using
|
||||
* the default in order to keep enumerating it
|
||||
* in rpc_daemon_type() as short as possible
|
||||
*/
|
||||
struct rpc_daemon_defaults {
|
||||
const char *name;
|
||||
const char *def_type;
|
||||
} rpc_daemon_defaults[] = {
|
||||
{ "epmd", "fork" },
|
||||
/* { "spoolssd", "embedded" }, */
|
||||
/* { "lsasd", "embedded" }, */
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
enum rpc_daemon_type_e rpc_daemon_type(const char *name)
|
||||
{
|
||||
const char *rpcsrv_type;
|
||||
enum rpc_daemon_type_e type;
|
||||
const char *def;
|
||||
int i;
|
||||
|
||||
def = "embedded";
|
||||
for (i = 0; rpc_daemon_defaults[i].name; i++) {
|
||||
if (strcasecmp_m(name, rpc_daemon_defaults[i].name) == 0) {
|
||||
def = rpc_daemon_defaults[i].def_type;
|
||||
}
|
||||
}
|
||||
|
||||
rpcsrv_type = lp_parm_const_string(GLOBAL_SECTION_SNUM,
|
||||
"rpc_daemon", name, def);
|
||||
|
||||
if (strcasecmp_m(rpcsrv_type, "embedded") == 0) {
|
||||
type = RPC_DAEMON_EMBEDDED;
|
||||
} else if (strcasecmp_m(rpcsrv_type, "fork") == 0) {
|
||||
type = RPC_DAEMON_FORK;
|
||||
} else {
|
||||
type = RPC_DAEMON_DISABLED;
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
static NTSTATUS auth_anonymous_session_info(TALLOC_CTX *mem_ctx,
|
||||
struct auth_session_info **session_info)
|
||||
{
|
||||
|
@ -20,27 +20,6 @@
|
||||
#ifndef _RPC_SERVER_H_
|
||||
#define _RPC_SERVER_H_
|
||||
|
||||
enum rpc_daemon_type_e {
|
||||
RPC_DAEMON_DISABLED = 0,
|
||||
RPC_DAEMON_EMBEDDED,
|
||||
RPC_DAEMON_FORK
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Get the mode in which a server is started.
|
||||
*
|
||||
* @param name Name of the rpc server
|
||||
* @param def_type The default type for the server
|
||||
*
|
||||
* @return The actual configured type.
|
||||
*/
|
||||
enum rpc_daemon_type_e rpc_daemon_type(const char *name);
|
||||
|
||||
#define rpc_epmapper_daemon() rpc_daemon_type("epmd")
|
||||
#define rpc_spoolss_daemon() rpc_daemon_type("spoolssd")
|
||||
#define rpc_lsasd_daemon() rpc_daemon_type("lsasd")
|
||||
|
||||
|
||||
struct pipes_struct;
|
||||
|
||||
typedef bool (*dcerpc_ncacn_disconnect_fn)(struct pipes_struct *p);
|
||||
|
@ -50,56 +50,9 @@
|
||||
#include "rpc_server/rpc_service_setup.h"
|
||||
#include "rpc_server/rpc_ep_register.h"
|
||||
#include "rpc_server/rpc_server.h"
|
||||
#include "rpc_server/rpc_config.h"
|
||||
#include "rpc_server/epmapper/srv_epmapper.h"
|
||||
|
||||
/* the default is "embedded" so this table
|
||||
* lists only services that are not using
|
||||
* the default in order to keep enumerating it
|
||||
* in rpc_service_mode() as short as possible
|
||||
*/
|
||||
struct rpc_service_defaults {
|
||||
const char *name;
|
||||
const char *def_mode;
|
||||
} rpc_service_defaults[] = {
|
||||
{ "epmapper", "external" },
|
||||
/* { "spoolss", "embedded" }, */
|
||||
/* { "lsarpc", "embedded" }, */
|
||||
/* { "samr", "embedded" }, */
|
||||
/* { "netlogon", "embedded" }, */
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
enum rpc_service_mode_e rpc_service_mode(const char *name)
|
||||
{
|
||||
const char *rpcsrv_type;
|
||||
enum rpc_service_mode_e state;
|
||||
const char *def;
|
||||
int i;
|
||||
|
||||
def = "embedded";
|
||||
for (i = 0; rpc_service_defaults[i].name; i++) {
|
||||
if (strcasecmp_m(name, rpc_service_defaults[i].name) == 0) {
|
||||
def = rpc_service_defaults[i].def_mode;
|
||||
}
|
||||
}
|
||||
|
||||
rpcsrv_type = lp_parm_const_string(GLOBAL_SECTION_SNUM,
|
||||
"rpc_server", name, def);
|
||||
|
||||
if (strcasecmp_m(rpcsrv_type, "embedded") == 0) {
|
||||
state = RPC_SERVICE_MODE_EMBEDDED;
|
||||
} else if (strcasecmp_m(rpcsrv_type, "external") == 0) {
|
||||
state = RPC_SERVICE_MODE_EXTERNAL;
|
||||
} else if (strcasecmp(rpcsrv_type, "daemon") == 0) {
|
||||
state = RPC_SERVICE_MODE_DAEMON;
|
||||
} else {
|
||||
state = RPC_SERVICE_MODE_DISABLED;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
static bool rpc_setup_epmapper(struct tevent_context *ev_ctx,
|
||||
struct messaging_context *msg_ctx)
|
||||
{
|
||||
|
@ -24,29 +24,6 @@
|
||||
|
||||
struct ndr_interface_table;
|
||||
|
||||
enum rpc_service_mode_e {
|
||||
RPC_SERVICE_MODE_DISABLED = 0,
|
||||
RPC_SERVICE_MODE_EMBEDDED,
|
||||
RPC_SERVICE_MODE_EXTERNAL,
|
||||
RPC_SERVICE_MODE_DAEMON
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Get the mode in which a service is started.
|
||||
*
|
||||
* @param name Name of the service
|
||||
* @param def_mode The default mode for the service
|
||||
*
|
||||
* @return The actual configured mode.
|
||||
*/
|
||||
enum rpc_service_mode_e rpc_service_mode(const char *name);
|
||||
|
||||
#define rpc_epmapper_mode() rpc_service_mode("epmapper")
|
||||
#define rpc_spoolss_mode() rpc_service_mode("spoolss")
|
||||
#define rpc_lsarpc_mode() rpc_service_mode("lsarpc")
|
||||
#define rpc_samr_mode() rpc_service_mode("samr")
|
||||
#define rpc_netlogon_mode() rpc_service_mode("netlogon")
|
||||
|
||||
/**
|
||||
* @brief Register an endpoint at the endpoint mapper.
|
||||
*
|
||||
|
7
source3/rpc_server/wscript_build
Normal file → Executable file
7
source3/rpc_server/wscript_build
Normal file → Executable file
@ -25,9 +25,12 @@ bld.SAMBA3_SUBSYSTEM('rpc',
|
||||
deps='RPC_PIPE_REGISTER',
|
||||
vars=locals())
|
||||
|
||||
bld.SAMBA3_SUBSYSTEM('RPC_CONFIG',
|
||||
source='rpc_config.c')
|
||||
|
||||
bld.SAMBA3_SUBSYSTEM('RPC_NCACN_NP',
|
||||
source='rpc_ncacn_np.c rpc_handles.c rpc_contexts.c',
|
||||
deps='auth auth_sam_reply RPC_PIPE_REGISTER npa_tstream')
|
||||
deps='RPC_CONFIG auth auth_sam_reply RPC_PIPE_REGISTER npa_tstream')
|
||||
|
||||
bld.SAMBA3_SUBSYSTEM('RPC_SERVICE',
|
||||
source='rpc_server.c',
|
||||
@ -130,7 +133,7 @@ bld.SAMBA3_SUBSYSTEM('RPC_EPMAPPER',
|
||||
|
||||
bld.SAMBA3_SUBSYSTEM('RPC_SERVER',
|
||||
source='srv_pipe_hnd.c srv_pipe.c rpc_sock_helper.c rpc_service_setup.c',
|
||||
deps='''RPC_NCACN_NP RPC_SERVICE RPC_CRYPTO
|
||||
deps='''RPC_CONFIG RPC_NCACN_NP RPC_SERVICE RPC_CRYPTO
|
||||
RPC_SAMR RPC_LSARPC RPC_WINREG RPC_INITSHUTDOWN
|
||||
RPC_DSSETUP RPC_WKSSVC RPC_SVCCTL RPC_NTSVCS
|
||||
RPC_NETLOGON RPC_NETDFS RPC_SRVSVC RPC_SPOOLSS
|
||||
|
Loading…
Reference in New Issue
Block a user