1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

use the new modules system for the rpc modules (backport from HEAD)

This commit is contained in:
Jelmer Vernooij -
parent 1755d5f662
commit aca7319e8d
10 changed files with 15 additions and 163 deletions

View File

@ -141,7 +141,8 @@ QUOTAOBJS=@QUOTAOBJS@
VFS_MODULES = bin/vfs_audit.@SHLIBEXT@ bin/vfs_extd_audit.@SHLIBEXT@ bin/vfs_recycle.@SHLIBEXT@ bin/vfs_netatalk.@SHLIBEXT@
PDB_MODULES = @PDB_MODULES@
MODULES = $(VFS_MODULES) $(PDB_MODULES)
RPC_MODULES = @RPC_MODULES@
MODULES = $(VFS_MODULES) $(PDB_MODULES) $(RPC_MODULES)
######################################################################
# object file lists
@ -238,7 +239,6 @@ RPC_SVC_OBJ = rpc_server/srv_srvsvc.o rpc_server/srv_srvsvc_nt.o
RPC_WKS_OBJ = rpc_server/srv_wkssvc.o rpc_server/srv_wkssvc_nt.o
RPC_DFS_OBJ = rpc_server/srv_dfs.o rpc_server/srv_dfs_nt.o
RPC_SPOOLSS_OBJ = rpc_server/srv_spoolss.o rpc_server/srv_spoolss_nt.o
RPC_ECHO_OBJ = rpc_server/srv_echo.o rpc_server/srv_echo_nt.o
@ -246,32 +246,7 @@ RPC_ECHO_OBJ = rpc_server/srv_echo.o rpc_server/srv_echo_nt.o
RPC_PIPE_OBJ = rpc_server/srv_pipe_hnd.o rpc_server/srv_util.o \
rpc_server/srv_pipe.o rpc_server/srv_lsa_hnd.o
# These are like they are to avoid a dependency on GNU MAKE
@LSA_DYNAMIC_YES@RPC_MODULES1 = bin/librpc_lsarpc.@SHLIBEXT@
@NETLOG_DYNAMIC_YES@RPC_MODULES2 = bin/librpc_NETLOGON.@SHLIBEXT@
@SAMR_DYNAMIC_YES@RPC_MODULES3 = bin/librpc_samr.@SHLIBEXT@
@SVC_DYNAMIC_YES@RPC_MODULES4 = bin/librpc_srvsvc.@SHLIBEXT@
@WKS_DYNAMIC_YES@RPC_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OBJ)
# this includes only the low level parse code, not stuff
# that requires knowledge of security contexts
@ -644,7 +619,7 @@ nsswitch : SHOWFLAGS bin/winbindd@EXEEXT@ bin/wbinfo@EXEEXT@ nsswitch/libnss_win
wins : SHOWFLAGS nsswitch/libnss_wins.@SHLIBEXT@
modules: SHOWFLAGS proto_exists $(VFS_MODULES) $(PDB_MODULES)
modules: SHOWFLAGS proto_exists $(MODULES)
everything: all libsmbclient debug2html smbfilter talloctort modules torture
@ -1038,6 +1013,7 @@ installbin: all installdirs
installmodules: all installdirs
@$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(VFSLIBDIR) $(VFS_MODULES)
@$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(PDBLIBDIR) $(PDB_MODULES)
@$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(RPCLIBDIR) $(RPC_MODULES)
installscripts: installdirs
@$(SHELL) $(srcdir)/script/installscripts.sh $(INSTALLPERMS) $(DESTDIR)$(BINDIR) $(SCRIPTS)
@ -1113,11 +1089,11 @@ uninstallman:
uninstallbin:
@$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(SBIN_PROGS)
@$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(BIN_PROGS)
@$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(RPCLIBDIR) $(DESTDIR)$(RPC_MODULES)
uninstallmodules:
@$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(PDBLIBDIR) $(DESTDIR)$(VFS_MODULES)
@$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(VFSLIBDIR) $(DESTDIR)$(PDB_MODULES)
@$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(VFSLIBDIR) $(DESTDIR)$(VFS_MODULES)
@$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(PDBLIBDIR) $(DESTDIR)$(PDB_MODULES)
@$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(RPCLIBDIR) $(DESTDIR)$(RPC_MODULES)
uninstallscripts:
@$(SHELL) $(srcdir)/script/uninstallscripts.sh $(INSTALLPERMS) $(DESTDIR)$(BINDIR) $(SCRIPTS)

View File

@ -158,11 +158,7 @@ static BOOL api_dfs_enum(pipes_struct *p)
\pipe\netdfs commands
********************************************************************/
#ifdef RPC_DFS_DYNAMIC
int rpc_pipe_init(void)
#else
int rpc_dfs_init(void)
#endif
{
struct api_struct api_netdfs_cmds[] =
{

View File

@ -645,11 +645,7 @@ static BOOL api_lsa_query_info2(pipes_struct *p)
/***************************************************************************
\PIPE\ntlsa commands
***************************************************************************/
#ifdef RPC_LSA_DYNAMIC
int rpc_pipe_init(void)
#else
int rpc_lsa_init(void)
#endif
{
static const struct api_struct api_lsa_cmds[] =
{

View File

@ -321,11 +321,7 @@ static BOOL api_net_logon_ctrl(pipes_struct *p)
array of \PIPE\NETLOGON operations
********************************************************************/
#ifdef RPC_NETLOG_DYNAMIC
int rpc_pipe_init(void)
#else
int rpc_net_init(void)
#endif
{
static struct api_struct api_net_cmds [] =
{

View File

@ -506,46 +506,6 @@ failed authentication on named pipe %s.\n", domain, user_name, wks, p->name ));
The switch table for the pipe names and the functions to handle them.
*******************************************************************/
struct api_cmd
{
const char *name;
int (*init)(void);
};
static struct api_cmd api_fd_commands[] =
{
#ifndef RPC_LSA_DYNAMIC
{ "lsarpc", rpc_lsa_init },
#endif
#ifndef RPC_SAMR_DYNAMIC
{ "samr", rpc_samr_init },
#endif
#ifndef RPC_SVC_DYNAMIC
{ "srvsvc", rpc_srv_init },
#endif
#ifndef RPC_WKS_DYNAMIC
{ "wkssvc", rpc_wks_init },
#endif
#ifndef RPC_NETLOG_DYNAMIC
{ "NETLOGON", rpc_net_init },
#endif
#ifndef RPC_REG_DYNAMIC
{ "winreg", rpc_reg_init },
#endif
#ifndef RPC_SPOOLSS_DYNAMIC
{ "spoolss", rpc_spoolss_init },
#endif
#ifndef RPC_DFS_DYNAMIC
{ "netdfs", rpc_dfs_init },
#endif
#ifdef DEVELOPER
#ifndef RPC_ECHO_DYNAMIC
{ "rpcecho", rpc_echo_init },
#endif
#endif
{ NULL, NULL }
};
struct rpc_table
{
struct
@ -848,47 +808,6 @@ int rpc_pipe_register_commands(const char *clnt, const char *srv, const struct a
return size;
}
/*******************************************************************
Register commands to an RPC pipe
*******************************************************************/
int rpc_load_module(const char *module)
{
#ifdef HAVE_DLOPEN
void *handle;
int (*module_init)(void);
pstring full_path;
const char *error;
pstrcpy(full_path, lib_path("rpc"));
pstrcat(full_path, "/librpc_");
pstrcat(full_path, module);
pstrcat(full_path, ".");
pstrcat(full_path, shlib_ext());
handle = sys_dlopen(full_path, RTLD_LAZY);
if (!handle) {
DEBUG(0, ("Could not load requested pipe %s as %s\n",
module, full_path));
DEBUG(0, (" Error: %s\n", dlerror()));
return 0;
}
DEBUG(3, ("Module '%s' loaded\n", full_path));
module_init = sys_dlsym(handle, "rpc_pipe_init");
if ((error = sys_dlerror()) != NULL) {
DEBUG(0, ("Error trying to resolve symbol 'rpc_pipe_init' in %s: %s\n",
full_path, error));
return 0;
}
return module_init();
#else
DEBUG(0,("Attempting to load a dynamic RPC pipe when dlopen isn't available\n"));
return 0;
#endif
}
/*******************************************************************
Respond to a pipe bind request.
*******************************************************************/
@ -928,14 +847,7 @@ BOOL api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p)
}
if (i == rpc_lookup_size) {
for (i = 0; api_fd_commands[i].name; i++) {
if (strequal(api_fd_commands[i].name, p->name)) {
api_fd_commands[i].init();
break;
}
}
if (!api_fd_commands[i].name && !rpc_load_module(p->name)) {
if (!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))
@ -951,6 +863,11 @@ BOOL api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p)
break;
}
}
if (i == rpc_lookup_size) {
DEBUG(0, ("module %s doesn't provide functions for pipe %s!\n", p->name, p->name));
return False;
}
}
/* decode the bind request */
@ -1478,16 +1395,7 @@ BOOL api_pipe_request(pipes_struct *p)
if (i == rpc_lookup_size) {
for (i = 0; api_fd_commands[i].name; i++) {
if (strequal(api_fd_commands[i].name, p->name)) {
api_fd_commands[i].init();
break;
}
}
if (!api_fd_commands[i].name) {
rpc_load_module(p->name);
}
smb_probe_module("rpc", p->name);
for (i = 0; i < rpc_lookup_size; i++) {
if (strequal(rpc_lookup[i].pipe.clnt, p->name)) {

View File

@ -373,11 +373,7 @@ static BOOL api_reg_save_key(pipes_struct *p)
array of \PIPE\reg operations
********************************************************************/
#ifdef RPC_REG_DYNAMIC
int rpc_pipe_init(void)
#else
int rpc_reg_init(void)
#endif
{
static struct api_struct api_reg_cmds[] =
{

View File

@ -1443,11 +1443,7 @@ static BOOL api_samr_set_dom_info(pipes_struct *p)
array of \PIPE\samr operations
********************************************************************/
#ifdef RPC_SAMR_DYNAMIC
int rpc_pipe_init(void)
#else
int rpc_samr_init(void)
#endif
{
static struct api_struct api_samr_cmds [] =
{

View File

@ -1580,11 +1580,7 @@ static BOOL api_spoolss_replycloseprinter(pipes_struct *p)
\pipe\spoolss commands
********************************************************************/
#ifdef RPC_SPOOLSS_DYNAMIC
int rpc_pipe_init(void)
#else
int rpc_spoolss_init(void)
#endif
{
struct api_struct api_spoolss_cmds[] =
{

View File

@ -526,11 +526,7 @@ static BOOL api_srv_net_file_set_secdesc(pipes_struct *p)
\PIPE\srvsvc commands
********************************************************************/
#ifdef RPC_SVC_DYNAMIC
int rpc_pipe_init(void)
#else
int rpc_srv_init(void)
#endif
{
static const struct api_struct api_srv_cmds[] =
{

View File

@ -60,11 +60,7 @@ static BOOL api_wks_query_info(pipes_struct *p)
\PIPE\wkssvc commands
********************************************************************/
#ifdef RPC_WKS_DYNAMIC
int rpc_pipe_init(void)
#else
int rpc_wks_init(void)
#endif
{
static struct api_struct api_wks_cmds[] =
{