summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/Makefile.in49
-rw-r--r--source3/aclocal.m42
-rw-r--r--source3/configure.in143
-rw-r--r--source3/lib/module.c2
-rw-r--r--source3/modules/mysql.c9
-rw-r--r--source3/modules/xml.c9
-rw-r--r--source3/passdb/pdb_guest.c6
-rw-r--r--source3/passdb/pdb_interface.c50
-rw-r--r--source3/passdb/pdb_ldap.c20
-rw-r--r--source3/passdb/pdb_nisplus.c10
-rw-r--r--source3/passdb/pdb_smbpasswd.c7
-rw-r--r--source3/passdb/pdb_tdb.c19
-rw-r--r--source3/passdb/pdb_unix.c5
-rw-r--r--source3/rpc_server/srv_dfs.c4
-rw-r--r--source3/rpc_server/srv_lsa.c4
-rw-r--r--source3/rpc_server/srv_netlog.c4
-rw-r--r--source3/rpc_server/srv_pipe.c77
-rw-r--r--source3/rpc_server/srv_reg.c4
-rw-r--r--source3/rpc_server/srv_samr.c4
-rwxr-xr-xsource3/rpc_server/srv_spoolss.c4
-rw-r--r--source3/rpc_server/srv_srvsvc.c4
-rw-r--r--source3/rpc_server/srv_wkssvc.c4
-rw-r--r--source3/smbd/server.c7
23 files changed, 116 insertions, 331 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 6964a2bc82..47c05191a3 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -2,7 +2,7 @@
# Makefile.in for Samba - rewritten for autoconf support
# Copyright Andrew Tridgell 1992-1998
# Copyright (C) 2001 by Martin Pool <mbp@samba.org>
-# Copyright Andrew Barteltt 2002
+# Copyright Andrew Bartlett 2002
# Copyright (C) 2003 Anthony Liguori <aliguor@us.ibm.com>
###########################################################################
@@ -136,8 +136,9 @@ QUOTAOBJS=@QUOTAOBJS@
VFS_MODULES = bin/vfs_audit.@SHLIBEXT@ bin/vfs_extd_audit.@SHLIBEXT@ bin/vfs_recycle.@SHLIBEXT@ \
bin/vfs_netatalk.@SHLIBEXT@ bin/vfs_fake_perms.@SHLIBEXT@
-PDB_MODULES = @MODULE_MYSQL@ @MODULE_XML@
-MODULES = bin/developer.@SHLIBEXT@
+PDB_MODULES = @PDB_MODULES@
+RPC_MODULES = @RPC_MODULES@
+MODULES = $(VFS_MODULES) $(PDB_MODULES) $(RPC_MODULES)
######################################################################
# object file lists
@@ -241,29 +242,7 @@ RPC_SPOOLSS_OBJ = rpc_server/srv_spoolss.o rpc_server/srv_spoolss_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_MODULES5 = bin/librpc_wkssvc.@SHLIBEXT@
-@REG_DYNAMIC_YES@RPC_MODULES6 = bin/librpc_winreg.@SHLIBEXT@
-@SPOOLSS_DYNAMIC_YES@RPC_MODULES7 = bin/librpc_spoolss.@SHLIBEXT@
-@DFS_DYNAMIC_YES@RPC_MODULES8 = bin/librpc_netdfs.@SHLIBEXT@
-RPC_MODULES = $(RPC_MODULES1) $(RPC_MODULES2) $(RPC_MODULES3) $(RPC_MODULES4) \
- $(RPC_MODULES5) $(RPC_MODULES6) $(RPC_MODULES7) $(RPC_MODULES8)
-
-@LSA_DYNAMIC_NO@RPC_PIPE_OBJ1 = $(RPC_LSA_OBJ)
-@NETLOG_DYNAMIC_NO@RPC_PIPE_OBJ2 = $(RPC_NETLOG_OBJ)
-@SAMR_DYNAMIC_NO@RPC_PIPE_OBJ3 = $(RPC_SAMR_OBJ)
-@SVC_DYNAMIC_NO@RPC_PIPE_OBJ4 = $(RPC_SVC_OBJ)
-@WKS_DYNAMIC_NO@RPC_PIPE_OBJ5 = $(RPC_WKS_OBJ)
-@REG_DYNAMIC_NO@RPC_PIPE_OBJ6 = $(RPC_REG_OBJ)
-@SPOOLSS_DYNAMIC_NO@RPC_PIPE_OBJ7 = $(RPC_SPOOLSS_OBJ)
-@DFS_DYNAMIC_NO@RPC_PIPE_OBJ8 = $(RPC_DFS_OBJ)
-RPC_SERVER_OBJ = $(RPC_PIPE_OBJ1) $(RPC_PIPE_OBJ2) $(RPC_PIPE_OBJ3) \
- $(RPC_PIPE_OBJ4) $(RPC_PIPE_OBJ5) $(RPC_PIPE_OBJ6) $(RPC_PIPE_OBJ7) \
- $(RPC_PIPE_OBJ8) $(RPC_PIPE_OBJ)
+RPC_SERVER_OBJ = @RPC_STATIC@ $(RPC_PIPE_OBJ)
# this includes only the low level parse code, not stuff
# that requires knowledge of security contexts
@@ -285,11 +264,8 @@ LOCKING_OBJ = locking/locking.o locking/brlock.o locking/posix.o
PASSDB_GET_SET_OBJ = passdb/pdb_get_set.o
PASSDB_OBJ = $(PASSDB_GET_SET_OBJ) passdb/passdb.o passdb/pdb_interface.o \
- passdb/machine_sid.o passdb/pdb_smbpasswd.o \
- passdb/pdb_tdb.o passdb/pdb_ldap.o \
- passdb/pdb_unix.o passdb/pdb_guest.o passdb/util_sam_sid.o \
- passdb/pdb_compat.o passdb/pdb_nisplus.o \
- passdb/privileges.o
+ passdb/machine_sid.o passdb/util_sam_sid.o passdb/pdb_compat.o \
+ passdb/privileges.o @PDB_STATIC@
XML_OBJ = modules/xml.o
MYSQL_OBJ = modules/mysql.o
@@ -304,8 +280,6 @@ SAMTEST_OBJ = torture/samtest.o torture/cmd_sam.o $(SAM_OBJ) $(LIB_OBJ) $(PARAM_
GROUPDB_OBJ = groupdb/mapping.o
-# passdb/smbpass.o passdb/ldap.o passdb/nispass.o
-
PROFILE_OBJ = profile/profile.o
OPLOCK_OBJ = smbd/oplock.o smbd/oplock_irix.o smbd/oplock_linux.o
@@ -617,7 +591,7 @@ NTLM_AUTH_OBJ = utils/ntlm_auth.o $(LIBNTLMSSP_OBJ) $(LIBSAMBA_OBJ) $(POPT_LIB_O
# now the rules...
######################################################################
all : SHOWFLAGS proto_exists $(SBIN_PROGS) $(BIN_PROGS) $(SHLIBS) \
- $(TORTURE_PROGS) $(RPC_MODULES) @EXTRA_ALL_TARGETS@
+ $(TORTURE_PROGS) @EXTRA_ALL_TARGETS@
pam_smbpass : SHOWFLAGS bin/pam_smbpass.@SHLIBEXT@
@@ -649,7 +623,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)
+modules: SHOWFLAGS proto_exists $(MODULES)
everything: all libsmbclient debug2html smbfilter talloctort
@@ -1054,11 +1028,11 @@ installbin: all installdirs
@$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(SBIN_PROGS)
@$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(BIN_PROGS)
- @$(SHELL) $(srcdir)/script/installmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(RPCLIBDIR) $(RPC_MODULES)
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)
@@ -1128,12 +1102,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)$(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)$(LIBDIR) $(DESTDIR)$(MODULES)
+ @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(RPCLIBDIR) $(DESTDIR)$(RPC_MODULES)
uninstallscripts:
@$(SHELL) $(srcdir)/script/uninstallscripts.sh $(INSTALLPERMS) $(DESTDIR)$(BINDIR) $(SCRIPTS)
diff --git a/source3/aclocal.m4 b/source3/aclocal.m4
index 87acceb2ae..15508206c3 100644
--- a/source3/aclocal.m4
+++ b/source3/aclocal.m4
@@ -59,7 +59,7 @@ AC_DEFUN(SMB_SUBSYSTEM,
[
AC_SUBST($1_STATIC)
AC_SUBST($1_MODULES)
- AC_DEFINE_UNQUOTED([static_init_]translit([$1], [A-Z], [a-z]), ["$init_static_modules_]translit([$1], [A-Z], [a-z])["], [Static init functions])
+ AC_DEFINE_UNQUOTED([static_init_]translit([$1], [A-Z], [a-z]), [{$init_static_modules_]translit([$1], [A-Z], [a-z])[}], [Static init functions])
])
dnl AC_PROG_CC_FLAG(flag)
diff --git a/source3/configure.in b/source3/configure.in
index e038654f7e..ee6a88ee6d 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -158,41 +158,6 @@ AC_SUBST(SMBWRAPPER)
AC_SUBST(EXTRA_BIN_PROGS)
AC_SUBST(EXTRA_SBIN_PROGS)
AC_SUBST(EXTRA_ALL_TARGETS)
-dnl For the DYNAMIC RPC stuff
-dnl The complicated _YES and _NO stuff allows us to avoid a dependency
-dnl on GNU Make.
-AC_SUBST(LSA_DYNAMIC_YES)
-AC_SUBST(LSA_DYNAMIC_NO)
-LSA_DYNAMIC_YES="#"
-LSA_DYNAMIC_NO=
-AC_SUBST(NETLOG_DYNAMIC_YES)
-AC_SUBST(NETLOG_DYNAMIC_NO)
-NETLOG_DYNAMIC_YES="#"
-NETLOG_DYNAMIC_NO=
-AC_SUBST(SAMR_DYNAMIC_YES)
-AC_SUBST(SAMR_DYNAMIC_NO)
-SAMR_DYNAMIC_YES="#"
-SAMR_DYNAMIC_NO=
-AC_SUBST(SVC_DYNAMIC_YES)
-AC_SUBST(SVC_DYNAMIC_NO)
-SVC_DYNAMIC_YES="#"
-SVC_DYNAMIC_NO=
-AC_SUBST(WKS_DYNAMIC_YES)
-AC_SUBST(WKS_DYNAMIC_NO)
-WKS_DYNAMIC_YES="#"
-WKS_DYNAMIC_NO=
-AC_SUBST(REG_DYNAMIC_YES)
-AC_SUBST(REG_DYNAMIC_NO)
-REG_DYNAMIC_YES="#"
-REG_DYNAMIC_NO=
-AC_SUBST(SPOOLSS_DYNAMIC_YES)
-AC_SUBST(SPOOLSS_DYNAMIC_NO)
-SPOOLSS_DYNAMIC_YES="#"
-SPOOLSS_DYNAMIC_NO=
-AC_SUBST(DFS_DYNAMIC_YES)
-AC_SUBST(DFS_DYNAMIC_NO)
-DFS_DYNAMIC_YES="#"
-DFS_DYNAMIC_NO=
# compile with optimization and without debugging by default
CFLAGS="-O ${CFLAGS}"
@@ -223,60 +188,6 @@ then
LIBS="$LIBS -ldmalloc"
fi
-AC_ARG_ENABLE(dynrpc, [ --enable-dynrpc Enable dynamic RPC modules [default=no]])
-
-if test x$enable_dynrpc = xyes
-then
- enable_dynrpc=lsa,samr,reg,wks,netlog,dfs
-fi
-
-if test x$enable_dynrpc != xno
-then
- for i in `echo $enable_dynrpc | sed -e's/,/ /g'`
- do case $i in lsa)
- LSA_DYNAMIC_YES=
- LSA_DYNAMIC_NO="#"
- AC_DEFINE(RPC_LSA_DYNAMIC, 1,
- [Define to make the LSA pipe dynamic])
- ;; samr)
- SAMR_DYNAMIC_YES=
- SAMR_DYNAMIC_NO="#"
- AC_DEFINE(RPC_SAMR_DYNAMIC, 1,
- [Define to make the SAMR pipe dynamic])
- ;; svc)
- SVC_DYNAMIC_YES=
- SVC_DYNAMIC_NO="#"
- AC_DEFINE(RPC_SVC_DYNAMIC, 1,
- [Define to make the SRVSVC pipe dynamic])
- ;; wks)
- WKS_DYNAMIC_YES=
- WKS_DYNAMIC_NO="#"
- AC_DEFINE(RPC_WKS_DYNAMIC, 1,
- [Define to make the WKSSVC pipe dynamic])
- ;; netlog)
- NETLOG_DYNAMIC_YES=
- NETLOG_DYNAMIC_NO="#"
- AC_DEFINE(RPC_NETLOG_DYNAMIC, 1,
- [Define to make the NETLOGON pipe dynamic])
- ;; reg)
- REG_DYNAMIC_YES=
- REG_DYNAMIC_NO="#"
- AC_DEFINE(RPC_REG_DYNAMIC, 1,
- [Define to make the WINREG pipe dynamic])
- ;; spoolss)
- SPOOLSS_DYNAMIC_YES=
- SPOOLSS_DYNAMIC_NO="#"
- AC_DEFINE(RPC_SPOOLSS_DYNAMIC, 1,
- [Define to make the SPOOLSS pipe dynamic])
- ;; dfs)
- DFS_DYNAMIC_YES=
- DFS_DYNAMIC_NO="#"
- AC_DEFINE(RPC_DFS_DYNAMIC, 1,
- [Define to make the NETDFS pipe dynamic])
- ;; esac
- done
-fi
-
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
@@ -323,6 +234,9 @@ AC_VALIDATE_CACHE_SYSTEM_TYPE
DYNEXP=
+dnl Add modules that have to be built by default here
+default_modules="pdb_smbpasswd pdb_tdb pdb_unix rpc_lsa rpc_samr rpc_reg rpc_wks rpc_netlog rpc_dfs rpc_srv rpc_spoolss"
+
#
# Config CPPFLAG settings for strange OS's that must be set
# before other tests.
@@ -2329,6 +2243,7 @@ if test x"$with_ldap_support" = x"yes"; then
if test x$have_ldap != xyes; then
AC_CHECK_LIB(ldap, ldap_domain2hostlist, [LIBS="$LIBS -lldap";
AC_DEFINE(HAVE_LDAP,1,[Whether ldap is available])])
+ default_modules="$default_modules pdb_ldap"
########################################################
# If we have LDAP, does it's rebind procedure take 2 or 3 arguments?
@@ -2344,15 +2259,15 @@ fi
########################################################
# Compile with MySQL support?
-AM_PATH_MYSQL([0.11.0],[MODULE_MYSQL=bin/mysql.so],[MODULE_MYSQL=])
+AM_PATH_MYSQL([0.11.0],[default_modules="$default_modules pdb_mysql"],[])
CFLAGS="$CFLAGS $MYSQL_CFLAGS"
-AC_SUBST(MODULE_MYSQL)
+LIBS="$LIBS $MYSQL_LIBS"
########################################################
# Compile with XML support?
-AM_PATH_XML2([2.0.0],[MODULE_XML=bin/xml.so],[MODULE_XML=])
+AM_PATH_XML2([2.0.0],[default_modules="$default_modules pdb_xml"],[])
CFLAGS="$CFLAGS $XML_CFLAGS"
-AC_SUBST(MODULE_XML)
+LIBS="$LIBS $XML_LIBS"
#################################################
# check for automount support
@@ -3434,6 +3349,48 @@ AC_ARG_WITH(python,
esac ])
AC_SUBST(PYTHON)
+for i in `echo $default_modules | sed -e's/,/ /g'`
+do
+ dnl Set to shared instead of static when dlopen() is available?
+ eval MODULE_$i=STATIC
+done
+
+AC_ARG_WITH(static-modules,
+[ --with-static-modules=MODULES Comma-seperated list of names of modules to statically link in],
+[ if test $withval; then
+ for i in `echo $withval | sed -e's/,/ /g'`
+ do
+ eval MODULE_$i=STATIC
+ done
+fi ])
+
+AC_ARG_WITH(shared-modules,
+[ --with-shared-modules=MODULES Comma-seperated list of names of modules to build shared],
+[ if test $withval; then
+ for i in `echo $withval | sed -e's/,/ /g'`
+ do
+ eval MODULE_$i=SHARED
+ done
+fi ])
+
+SMB_MODULE($MODULE_pdb_xml, pdb_xml, modules/xml.o, bin/xml.so PDB)
+SMB_MODULE($MODULE_pdb_mysql, pdb_mysql, modules/mysql.o, bin/mysql.so, PDB)
+SMB_MODULE($MODULE_pdb_ldap, pdb_ldap, passdb/pdb_ldap.o, bin/pdb_ldap.so, PDB)
+SMB_MODULE($MODULE_pdb_smbpasswd, pdb_smbpasswd, passdb/pdb_smbpasswd.o, bin/smbpasswd.so, PDB)
+SMB_MODULE($MODULE_pdb_tdb, pdb_tdbsam, passdb/pdb_tdb.o, bin/tdb.so, PDB)
+SMB_MODULE($MODULE_pdb_nisplussam, pdb_nisplussam, passdb/pdb_nisplus.o, bin/nisplus.so, PDB)
+SMB_MODULE(STATIC, pdb_guest, passdb/pdb_guest.o, bin/pdb_guest.so, PDB)
+SMB_SUBSYSTEM(PDB)
+
+SMB_MODULE($MODULE_rpc_lsa, rpc_lsa, \$(RPC_LSA_OBJ), bin/librpc_lsa.so, RPC)
+SMB_MODULE($MODULE_rpc_reg, rpc_reg, \$(RPC_REG_OBJ), bin/librpc_reg.so, RPC)
+SMB_MODULE($MODULE_rpc_wks, rpc_wks, \$(RPC_WKS_OBJ), bin/librpc_wks.so, RPC)
+SMB_MODULE($MODULE_rpc_netlog, rpc_net, \$(RPC_NETLOG_OBJ), bin/librpc_netlog.so, RPC)
+SMB_MODULE($MODULE_rpc_dfs, rpc_dfs, \$(RPC_DFS_OBJ), bin/librpc_dfs.so, RPC)
+SMB_MODULE($MODULE_rpc_srv, rpc_srv, \$(RPC_SVC_OBJ), bin/librpc_srvsvc.so, RPC)
+SMB_MODULE($MODULE_rpc_spoolss, rpc_spoolss, \$(RPC_SPOOLSS_OBJ), bin/librpc_spoolss.so, RPC)
+SMB_SUBSYSTEM(RPC)
+
#################################################
# do extra things if we are running insure
diff --git a/source3/lib/module.c b/source3/lib/module.c
index 4e2fe48af7..bf37078bb9 100644
--- a/source3/lib/module.c
+++ b/source3/lib/module.c
@@ -87,6 +87,8 @@ int smb_probe_module(const char *subsystem, const char *module)
pstrcat(full_path, module);
pstrcat(full_path, ".");
pstrcat(full_path, shlib_ext());
+
+ DEBUG(5, ("Probing module %s: Trying to load from %s\n", module, full_path));
return smb_load_module(full_path);
}
diff --git a/source3/modules/mysql.c b/source3/modules/mysql.c
index 1d5819295b..47883ca7f7 100644
--- a/source3/modules/mysql.c
+++ b/source3/modules/mysql.c
@@ -1032,12 +1032,7 @@ static NTSTATUS mysqlsam_init(struct pdb_context * pdb_context, struct pdb_metho
return NT_STATUS_OK;
}
-int init_module(void);
-
-int init_module()
+int pdb_mysql_init(void)
{
- if(smb_register_passdb("mysql", mysqlsam_init, PASSDB_INTERFACE_VERSION))
- return 0;
-
- return 1;
+ return smb_register_passdb("mysql", mysqlsam_init, PASSDB_INTERFACE_VERSION);
}
diff --git a/source3/modules/xml.c b/source3/modules/xml.c
index ead3e3a874..85b9e81b7f 100644
--- a/source3/modules/xml.c
+++ b/source3/modules/xml.c
@@ -564,12 +564,7 @@ NTSTATUS xmlsam_init(PDB_CONTEXT * pdb_context, PDB_METHODS ** pdb_method,
return NT_STATUS_OK;
}
-int init_module(void);
-
-int init_module()
+int pdb_xml_init(void)
{
- if(smb_register_passdb("xml", xmlsam_init, PASSDB_INTERFACE_VERSION))
- return 0;
-
- return 1;
+ return smb_register_passdb("xml", xmlsam_init, PASSDB_INTERFACE_VERSION);
}
diff --git a/source3/passdb/pdb_guest.c b/source3/passdb/pdb_guest.c
index 3f0f06d18d..f5a15057e0 100644
--- a/source3/passdb/pdb_guest.c
+++ b/source3/passdb/pdb_guest.c
@@ -121,3 +121,9 @@ NTSTATUS pdb_init_guestsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, c
/* There's not very much to initialise here */
return NT_STATUS_OK;
}
+
+int pdb_guest_init(void)
+{
+ return smb_register_passdb("guest", pdb_init_guestsam, PASSDB_INTERFACE_VERSION);
+}
+
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index 48a039b3de..9819df75ec 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -24,39 +24,14 @@
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_PASSDB
-/** List of various built-in passdb modules */
-static const struct {
- const char *name;
- /* Function to create a member of the pdb_methods list */
- pdb_init_function init;
-} builtin_pdb_init_functions[] = {
- { "smbpasswd", pdb_init_smbpasswd },
- { "smbpasswd_nua", pdb_init_smbpasswd_nua },
- { "tdbsam", pdb_init_tdbsam },
- { "tdbsam_nua", pdb_init_tdbsam_nua },
- { "ldapsam", pdb_init_ldapsam },
- { "ldapsam_nua", pdb_init_ldapsam_nua },
- { "unixsam", pdb_init_unixsam },
- { "guest", pdb_init_guestsam },
- { "nisplussam", pdb_init_nisplussam },
- { NULL, NULL}
-};
-
-static struct pdb_init_function_entry *backends;
-static void lazy_initialize_passdb(void);
-
-static void lazy_initialize_passdb()
-{
- int i;
- static BOOL initialised = False;
-
- if(!initialised) {
- initialised = True;
+static struct pdb_init_function_entry *backends = NULL;
- for(i = 0; builtin_pdb_init_functions[i].name; i++) {
- smb_register_passdb(builtin_pdb_init_functions[i].name, builtin_pdb_init_functions[i].init, PASSDB_INTERFACE_VERSION);
- }
- }
+static void lazy_initialize_passdb(void)
+{
+ static BOOL initialized = FALSE;
+ if(initialized)return;
+ static_init_pdb;
+ initialized = TRUE;
}
BOOL smb_register_passdb(const char *name, pdb_init_function init, int version)
@@ -451,13 +426,18 @@ static NTSTATUS make_pdb_methods_name(struct pdb_methods **methods, struct pdb_c
entry = pdb_find_backend_entry(module_name);
/* Try to find a module that contains this module */
- if(!entry) {
- smb_probe_module("passdb", module_name);
- entry = pdb_find_backend_entry(module_name);
+ if (!entry) {
+ DEBUG(2,("No builtin backend found, trying to load plugin\n"));
+ if(smb_probe_module("passdb", module_name) && !(entry = pdb_find_backend_entry(module_name))) {
+ DEBUG(0,("Plugin is available, but doesn't register passdb backend %s\n", module_name));
+ SAFE_FREE(module_name);
+ return NT_STATUS_UNSUCCESSFUL;
+ }
}
/* No such backend found */
if(!entry) {
+ DEBUG(0,("No builtin nor plugin backend for %s found\n", module_name));
SAFE_FREE(module_name);
return NT_STATUS_INVALID_PARAMETER;
}
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 2571ecd33a..98ddc72ed1 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -28,7 +28,6 @@
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_PASSDB
-#ifdef HAVE_LDAP
/* TODO:
* persistent connections: if using NSS LDAP, many connections are made
* however, using only one within Samba would be nice
@@ -2611,20 +2610,9 @@ NTSTATUS pdb_init_ldapsam_nua(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method
return NT_STATUS_OK;
}
-
-#else
-
-NTSTATUS pdb_init_ldapsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, const char *location)
+int pdb_ldap_init(void)
{
- DEBUG(0, ("ldap not detected at configure time, ldapsam not availalble!\n"));
- return NT_STATUS_UNSUCCESSFUL;
+ smb_register_passdb("ldapsam", pdb_init_ldapsam, PASSDB_INTERFACE_VERSION);
+ smb_register_passdb("ldapsam_nua", pdb_init_ldapsam_nua, PASSDB_INTERFACE_VERSION);
+ return TRUE;
}
-
-NTSTATUS pdb_init_ldapsam_nua(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, const char *location)
-{
- DEBUG(0, ("ldap not dectected at configure time, ldapsam_nua not available!\n"));
- return NT_STATUS_UNSUCCESSFUL;
-}
-
-
-#endif
diff --git a/source3/passdb/pdb_nisplus.c b/source3/passdb/pdb_nisplus.c
index 0a42c36ea0..73d65af1c6 100644
--- a/source3/passdb/pdb_nisplus.c
+++ b/source3/passdb/pdb_nisplus.c
@@ -24,8 +24,6 @@
#include "includes.h"
-#ifdef WITH_NISPLUS_SAM
-
#ifdef BROKEN_NISPLUS_INCLUDE_FILES
/*
@@ -1555,11 +1553,7 @@ NTSTATUS pdb_init_nisplussam (PDB_CONTEXT * pdb_context,
return NT_STATUS_OK;
}
-#else
-NTSTATUS pdb_init_nisplussam (PDB_CONTEXT * c, PDB_METHODS ** m,
- const char *l)
+int pdb_nisplus_init(void)
{
- DEBUG (0, ("nisplus sam not compiled in!\n"));
- return NT_STATUS_UNSUCCESSFUL;
+ return smb_register_passdb("nisplussam", pdb_init_nisplussam, PASSDB_INTERFACE_VERSION);
}
-#endif /* WITH_NISPLUS_SAM */
diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c
index b5a2bbbfe7..bcbeb74808 100644
--- a/source3/passdb/pdb_smbpasswd.c
+++ b/source3/passdb/pdb_smbpasswd.c
@@ -1579,3 +1579,10 @@ NTSTATUS pdb_init_smbpasswd_nua(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_meth
return NT_STATUS_OK;
}
+
+int pdb_smbpasswd_init(void)
+{
+ smb_register_passdb("smbpasswd", pdb_init_smbpasswd, PASSDB_INTERFACE_VERSION);
+ smb_register_passdb("smbpasswd_nua", pdb_init_smbpasswd_nua, PASSDB_INTERFACE_VERSION);
+ return TRUE;
+}
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index c48c9567b1..da6fcf70fc 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -37,8 +37,6 @@ static int tdbsam_debug_level = DBGC_ALL;
#endif
-#ifdef WITH_TDB_SAM
-
#define PDB_VERSION "20010830"
#define PASSDB_FILE_NAME "passdb.tdb"
#define TDB_FORMAT_STRING "ddddddBBBBBBBBBBBBddBBwdwdBdd"
@@ -988,20 +986,9 @@ NTSTATUS pdb_init_tdbsam_nua(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method,
return NT_STATUS_OK;
}
-
-#else
-
-NTSTATUS pdb_init_tdbsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, const char *location)
+int pdb_tdbsam_init(void)
{
- DEBUG(0, ("tdbsam not compiled in!\n"));
- return NT_STATUS_UNSUCCESSFUL;
+ smb_register_passdb("tdbsam", pdb_init_tdbsam, PASSDB_INTERFACE_VERSION);
+ smb_register_passdb("tdbsam_nua", pdb_init_tdbsam_nua, PASSDB_INTERFACE_VERSION);
}
-NTSTATUS pdb_init_tdbsam_nua(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, const char *location)
-{
- DEBUG(0, ("tdbsam_nua not compiled in!\n"));
- return NT_STATUS_UNSUCCESSFUL;
-}
-
-
-#endif
diff --git a/source3/passdb/pdb_unix.c b/source3/passdb/pdb_unix.c
index 07acd08a4e..dcdf5cf50b 100644
--- a/source3/passdb/pdb_unix.c
+++ b/source3/passdb/pdb_unix.c
@@ -123,3 +123,8 @@ NTSTATUS pdb_init_unixsam(PDB_CONTEXT *pdb_context, PDB_METHODS **pdb_method, co
/* There's not very much to initialise here */
return NT_STATUS_OK;
}
+
+int pdb_unix_init(void)
+{
+ return smb_register_passdb("unixsam", pdb_init_unixsam, PASSDB_INTERFACE_VERSION);
+}
diff --git a/source3/rpc_server/srv_dfs.c b/source3/rpc_server/srv_dfs.c
index 14c1cb4088..0807efd550 100644
--- a/source3/rpc_server/srv_dfs.c
+++ b/source3/rpc_server/srv_dfs.c
@@ -158,11 +158,7 @@ static BOOL api_dfs_enum(pipes_struct *p)
\pipe\netdfs commands
********************************************************************/
-#ifdef RPC_DFS_DYNAMIC
-int init_module(void)
-#else
int rpc_dfs_init(void)
-#endif
{
struct api_struct api_netdfs_cmds[] =
{
diff --git a/source3/rpc_server/srv_lsa.c b/source3/rpc_server/srv_lsa.c
index 0e4039326b..bfa706acf2 100644
--- a/source3/rpc_server/srv_lsa.c
+++ b/source3/rpc_server/srv_lsa.c
@@ -771,11 +771,7 @@ static BOOL api_lsa_remove_acct_rights(pipes_struct *p)
\PIPE\ntlsa commands
***************************************************************************/
-#ifdef RPC_LSA_DYNAMIC
-int init_module(void)
-#else
int rpc_lsa_init(void)
-#endif
{
static const struct api_struct api_lsa_cmds[] =
{
diff --git a/source3/rpc_server/srv_netlog.c b/source3/rpc_server/srv_netlog.c
index c9e4fc1b1f..7dc0f57f34 100644
--- a/source3/rpc_server/srv_netlog.c
+++ b/source3/rpc_server/srv_netlog.c
@@ -321,11 +321,7 @@ static BOOL api_net_logon_ctrl(pipes_struct *p)
array of \PIPE\NETLOGON operations
********************************************************************/
-#ifdef RPC_NETLOG_DYNAMIC
-int init_module(void)
-#else
int rpc_net_init(void)
-#endif
{
static struct api_struct api_net_cmds [] =
{
diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
index f6deac68f8..d6b774c566 100644
--- a/source3/rpc_server/srv_pipe.c
+++ b/source3/rpc_server/srv_pipe.c
@@ -454,41 +454,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
- { NULL, NULL }
-};
-
struct rpc_table
{
struct
@@ -792,28 +757,6 @@ int rpc_pipe_register_commands(const char *clnt, const char *srv, const struct a
}
/*******************************************************************
- Register commands to an RPC pipe
-*******************************************************************/
-int rpc_load_module(const char *module)
-{
- pstring full_path;
- int status;
-
- pstrcpy(full_path, lib_path("rpc"));
- pstrcat(full_path, "/librpc_");
- pstrcat(full_path, module);
- pstrcat(full_path, ".");
- pstrcat(full_path, shlib_ext());
-
- if (!(status = smb_load_module(full_path))) {
- DEBUG(0, ("Could not load requested pipe %s as %s\n",
- module, full_path));
- }
-
- return status;
-}
-
-/*******************************************************************
Respond to a pipe bind request.
*******************************************************************/
@@ -851,14 +794,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))
@@ -1273,16 +1209,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)) {
diff --git a/source3/rpc_server/srv_reg.c b/source3/rpc_server/srv_reg.c
index 8fc1d42b2f..f72d8e4f29 100644
--- a/source3/rpc_server/srv_reg.c
+++ b/source3/rpc_server/srv_reg.c
@@ -373,11 +373,7 @@ static BOOL api_reg_save_key(pipes_struct *p)
array of \PIPE\reg operations
********************************************************************/
-#ifdef RPC_REG_DYNAMIC
-int init_module(void)
-#else
int rpc_reg_init(void)
-#endif
{
static struct api_struct api_reg_cmds[] =
{
diff --git a/source3/rpc_server/srv_samr.c b/source3/rpc_server/srv_samr.c
index b75195ceef..67c092775b 100644
--- a/source3/rpc_server/srv_samr.c
+++ b/source3/rpc_server/srv_samr.c
@@ -1443,11 +1443,7 @@ static BOOL api_samr_set_dom_info(pipes_struct *p)
array of \PIPE\samr operations
********************************************************************/
-#ifdef RPC_SAMR_DYNAMIC
-int init_module(void)
-#else
int rpc_samr_init(void)
-#endif
{
static struct api_struct api_samr_cmds [] =
{
diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c
index 3023922a5b..a7dd7a6cef 100755
--- a/source3/rpc_server/srv_spoolss.c
+++ b/source3/rpc_server/srv_spoolss.c
@@ -1580,11 +1580,7 @@ static BOOL api_spoolss_replycloseprinter(pipes_struct *p)
\pipe\spoolss commands
********************************************************************/
-#ifdef RPC_SPOOLSS_DYNAMIC
-int init_module(void)
-#else
int rpc_spoolss_init(void)
-#endif
{
struct api_struct api_spoolss_cmds[] =
{
diff --git a/source3/rpc_server/srv_srvsvc.c b/source3/rpc_server/srv_srvsvc.c
index 7c5e317c87..96820ae74b 100644
--- a/source3/rpc_server/srv_srvsvc.c
+++ b/source3/rpc_server/srv_srvsvc.c
@@ -526,11 +526,7 @@ static BOOL api_srv_net_file_set_secdesc(pipes_struct *p)
\PIPE\srvsvc commands
********************************************************************/
-#ifdef RPC_SVC_DYNAMIC
-int init_module(void)
-#else
int rpc_srv_init(void)
-#endif
{
static const struct api_struct api_srv_cmds[] =
{
diff --git a/source3/rpc_server/srv_wkssvc.c b/source3/rpc_server/srv_wkssvc.c
index e0d662ea80..ddcbadd1d4 100644
--- a/source3/rpc_server/srv_wkssvc.c
+++ b/source3/rpc_server/srv_wkssvc.c
@@ -60,11 +60,7 @@ static BOOL api_wks_query_info(pipes_struct *p)
\PIPE\wkssvc commands
********************************************************************/
-#ifdef RPC_WKS_DYNAMIC
-int init_module(void)
-#else
int rpc_wks_init(void)
-#endif
{
static struct api_struct api_wks_cmds[] =
{
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index aff402df66..96d936d3a8 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -411,9 +411,6 @@ static BOOL open_sockets_smbd(BOOL is_daemon, BOOL interactive, const char *smb_
return False;
}
- /* Load DSO's */
- init_modules();
-
return True;
}
/* The parent doesn't need this socket */
@@ -866,6 +863,10 @@ static BOOL init_structs(void )
if(!initialize_password_db(False))
exit(1);
+ static_init_rpc;
+
+ init_modules();
+
uni_group_cache_init(); /* Non-critical */
/* possibly reload the services file. */