svn commit: samba r11304 - in branches/SAMBA_4_0/source: build/m4
lib lib/ldb lib/registry lib/tdb
jelmer at samba.org
jelmer at samba.org
Wed Oct 26 15:07:14 GMT 2005
Author: jelmer
Date: 2005-10-26 15:07:13 +0000 (Wed, 26 Oct 2005)
New Revision: 11304
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=11304
Log:
Add support back in for loading shared modules (not used yet)
Added:
branches/SAMBA_4_0/source/lib/module.c
Modified:
branches/SAMBA_4_0/source/build/m4/public.m4
branches/SAMBA_4_0/source/lib/basic.mk
branches/SAMBA_4_0/source/lib/ldb/config.m4
branches/SAMBA_4_0/source/lib/registry/config.m4
branches/SAMBA_4_0/source/lib/tdb/config.m4
Changeset:
Modified: branches/SAMBA_4_0/source/build/m4/public.m4
===================================================================
--- branches/SAMBA_4_0/source/build/m4/public.m4 2005-10-26 14:18:27 UTC (rev 11303)
+++ branches/SAMBA_4_0/source/build/m4/public.m4 2005-10-26 15:07:13 UTC (rev 11304)
@@ -16,8 +16,6 @@
dnl
dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags)
dnl
-dnl SMB_LIBRARY_ENABLE(name,default_build)
-dnl
dnl SMB_BINARY_ENABLE(name,default_build)
dnl
dnl #######################################################
@@ -150,13 +148,6 @@
"
])
-dnl SMB_LIBRARY_ENABLE(name,default_build)
-AC_DEFUN([SMB_LIBRARY_ENABLE],
-[
-SMB_INFO_ENABLES="$SMB_INFO_ENABLES
-\$enabled{$1} = \"$2\";"
-])
-
dnl SMB_BINARY_ENABLE(name,default_build)
AC_DEFUN([SMB_BINARY_ENABLE],
[
Modified: branches/SAMBA_4_0/source/lib/basic.mk
===================================================================
--- branches/SAMBA_4_0/source/lib/basic.mk 2005-10-26 14:18:27 UTC (rev 11303)
+++ branches/SAMBA_4_0/source/lib/basic.mk 2005-10-26 15:07:13 UTC (rev 11304)
@@ -55,6 +55,9 @@
OBJ_FILES = \
gencache.o \
+[SUBSYSTEM::MODULE]
+OBJ_FILES = module.o
+
##############################
# Start SUBSYSTEM LIBBASIC
[SUBSYSTEM::LIBBASIC]
Modified: branches/SAMBA_4_0/source/lib/ldb/config.m4
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/config.m4 2005-10-26 14:18:27 UTC (rev 11303)
+++ branches/SAMBA_4_0/source/lib/ldb/config.m4 2005-10-26 15:07:13 UTC (rev 11304)
@@ -2,8 +2,3 @@
if test x"$with_sqlite3_support" = x"yes"; then
SMB_MODULE_DEFAULT(libldb_sqlite3,STATIC)
fi
-
-SMB_LIBRARY_ENABLE(libldb,NO)
-if test x"$experimental" = x"yes"; then
- SMB_LIBRARY_ENABLE(libldb,YES)
-fi
Added: branches/SAMBA_4_0/source/lib/module.c
===================================================================
--- branches/SAMBA_4_0/source/lib/module.c 2005-10-26 14:18:27 UTC (rev 11303)
+++ branches/SAMBA_4_0/source/lib/module.c 2005-10-26 15:07:13 UTC (rev 11304)
@@ -0,0 +1,93 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ Copyright (C) Jelmer Vernooij 2005
+
+ 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 2 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, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "includes.h"
+#include "dynconfig.h"
+#include "system/dir.h"
+
+static BOOL load_module(TALLOC_CTX *mem_ctx, const char *dir, const char *name)
+{
+ char *path;
+ void *handle;
+ BOOL (*init_module_fn) (void);
+ BOOL ret;
+
+ path = talloc_asprintf(mem_ctx, "%s/%s", dir, name);
+
+ handle = dlopen(path, 0);
+ if (handle == NULL) {
+ DEBUG(0, ("Unable to open %s: %s\n", path, dlerror()));
+ return False;
+ }
+
+ init_module_fn = dlsym(handle, "init_module");
+
+ if (init_module_fn == NULL) {
+ DEBUG(0, ("Unable to find init_module() in %s: %s\n", path, dlerror()));
+ return False;
+ }
+
+ ret = init_module_fn();
+ if (!ret) {
+ DEBUG(1, ("Loading module '%s' failed\n", path));
+ }
+
+ dlclose(handle);
+
+ talloc_free(path);
+
+ return ret;
+}
+
+BOOL load_modules(const char *subsystem)
+{
+ DIR *dir;
+ struct dirent *entry;
+ char *dir_path;
+ BOOL ret;
+ TALLOC_CTX *mem_ctx;
+
+ mem_ctx = talloc_init(NULL);
+
+ dir_path = talloc_asprintf(mem_ctx, "%s/%s", dyn_LIBDIR, subsystem);
+ if (!dir_path) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
+ dir = opendir(subsystem);
+ if (dir == NULL) {
+ talloc_free(mem_ctx);
+ return False;
+ }
+
+ while((entry = readdir(dir))) {
+ if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, ".."))
+ continue;
+
+ ret &= load_module(mem_ctx, dir_path, entry->d_name);
+ }
+
+ closedir(dir);
+
+ talloc_free(mem_ctx);
+
+ return ret;
+}
Property changes on: branches/SAMBA_4_0/source/lib/module.c
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: branches/SAMBA_4_0/source/lib/registry/config.m4
===================================================================
--- branches/SAMBA_4_0/source/lib/registry/config.m4 2005-10-26 14:18:27 UTC (rev 11303)
+++ branches/SAMBA_4_0/source/lib/registry/config.m4 2005-10-26 15:07:13 UTC (rev 11304)
@@ -1,10 +1,4 @@
# Registry backends
-
-if test t$BLDSHARED = ttrue; then
- LIBWINREG_SHARED=bin/libwinregistry.$SHLIBEXT
-fi
-LIBWINREG=libwinregistry
-
SMB_MODULE_DEFAULT(registry_gconf, NOT)
SMB_EXT_LIB_FROM_PKGCONFIG(gconf, gconf-2.0)
@@ -16,7 +10,3 @@
SMB_MODULE_DEFAULT(registry_gconf, STATIC)
fi
])
-
-if test x"$experimental" = x"yes"; then
- SMB_LIBRARY_ENABLE(libwinregistry, YES)
-fi
Modified: branches/SAMBA_4_0/source/lib/tdb/config.m4
===================================================================
--- branches/SAMBA_4_0/source/lib/tdb/config.m4 2005-10-26 14:18:27 UTC (rev 11303)
+++ branches/SAMBA_4_0/source/lib/tdb/config.m4 2005-10-26 15:07:13 UTC (rev 11304)
@@ -5,8 +5,3 @@
AC_HAVE_DECL(pread, [#include <unistd.h>])
AC_HAVE_DECL(pwrite, [#include <unistd.h>])
-
-if test x"$experimental" = x"yes"; then
- SMB_LIBRARY_ENABLE(libtdb,YES)
-fi
-
More information about the samba-cvs
mailing list