lib/util Split samba-modules library into public and private parts
authorAndrew Bartlett <abartlet@samba.org>
Mon, 24 Oct 2011 08:39:53 +0000 (19:39 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 28 Oct 2011 11:10:28 +0000 (13:10 +0200)
This will allow OpenChange to get at the symbols it needs, without
exposing any more of this as a public API than we must.

Andrew Bartlett

28 files changed:
auth/gensec/gensec_start.c
auth/gensec/wscript_build
lib/util/internal_module.c [moved from lib/util/modules.c with 85% similarity]
lib/util/internal_module.h [new file with mode: 0644]
lib/util/samba-module.pc.in [new file with mode: 0644]
lib/util/samba_module.c [new file with mode: 0644]
lib/util/samba_module.h [moved from lib/util/samba_modules.h with 82% similarity]
lib/util/wscript_build
source3/Makefile.in
source3/include/includes.h
source3/wscript_build
source4/auth/ntlm/auth.c
source4/auth/ntlm/wscript_build
source4/ntptr/ntptr_base.c
source4/ntvfs/ntvfs_base.c
source4/ntvfs/posix/pvfs_acl.c
source4/ntvfs/posix/wscript_build
source4/ntvfs/sysdep/sys_lease.c
source4/ntvfs/sysdep/sys_notify.c
source4/ntvfs/wscript_build
source4/param/share.c
source4/param/wscript_build
source4/rpc_server/dcerpc_server.c
source4/smbd/process_model.c
source4/smbd/server.c
source4/smbd/wscript_build
source4/torture/smbtorture.c
source4/torture/torture.c

index 43125e8f1a1887c13b231816e226c357cc53fd48..d7a6dafe6f48db71eab78d14c5f4d369b4db24e2 100644 (file)
@@ -29,7 +29,7 @@
 #include "auth/gensec/gensec.h"
 #include "lib/param/param.h"
 #include "lib/util/tsort.h"
-#include "lib/util/samba_modules.h"
+#include "lib/util/samba_module.h"
 
 /* the list of currently registered GENSEC backends */
 static struct gensec_security_ops **generic_security_ops;
index e3e9372c3dfb81a62424928f071241a5649b0f27..6514a064b7a4b6c4a119635ad036af26bfefa564 100644 (file)
@@ -3,7 +3,7 @@ bld.SAMBA_LIBRARY('gensec',
        source='gensec.c gensec_start.c',
        pc_files='gensec.pc',
        autoproto='gensec_toplevel_proto.h',
-       public_deps='tevent-util samba-util errors LIBPACKET auth_system_session samba-modules gensec_util',
+       public_deps='tevent-util samba-util errors LIBPACKET auth_system_session samba-module gensec_util',
        public_headers='gensec.h',
        deps='com_err',
        vnum='0.0.1'
similarity index 85%
rename from lib/util/modules.c
rename to lib/util/internal_module.c
index e9e6bf5dc83662a0278f32637572647e7cd41930..04c02f07600c1f2a07bee60f57dec6642acc3a80 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "includes.h"
 #include "dynconfig/dynconfig.h"
-#include "lib/util/samba_modules.h"
+#include "lib/util/internal_module.h"
 #include "system/filesys.h"
 #include "system/dir.h"
 
@@ -82,7 +82,7 @@ samba_init_module_fn load_module(const char *path, bool is_probe, void **handle_
  * Obtain list of init functions from the modules in the specified
  * directory
  */
-static samba_init_module_fn *load_modules(TALLOC_CTX *mem_ctx, const char *path)
+samba_init_module_fn *load_modules(TALLOC_CTX *mem_ctx, const char *path)
 {
        DIR *dir;
        struct dirent *entry;
@@ -119,43 +119,6 @@ static samba_init_module_fn *load_modules(TALLOC_CTX *mem_ctx, const char *path)
        return ret;
 }
 
-/**
- * Run the specified init functions.
- *
- * @return true if all functions ran successfully, false otherwise
- */
-bool samba_init_module_fns_run(samba_init_module_fn *fns)
-{
-       int i;
-       bool ret = true;
-
-       if (fns == NULL)
-               return true;
-
-       for (i = 0; fns[i]; i++) { ret &= (bool)NT_STATUS_IS_OK(fns[i]()); }
-
-       return ret;
-}
-
-/**
- * Load the initialization functions from DSO files for a specific subsystem.
- *
- * Will return an array of function pointers to initialization functions
- */
-
-samba_init_module_fn *samba_modules_load(TALLOC_CTX *mem_ctx, const char *subsystem)
-{
-       char *path = modules_path(mem_ctx, subsystem);
-       samba_init_module_fn *ret;
-
-       ret = load_modules(mem_ctx, path);
-
-       talloc_free(path);
-
-       return ret;
-}
-
-
 /* Load a dynamic module.  Only log a level 0 error if we are not checking
    for the existence of a module (probling). */
 
diff --git a/lib/util/internal_module.h b/lib/util/internal_module.h
new file mode 100644 (file)
index 0000000..7d1acc5
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+   Unix SMB/CIFS implementation.
+   Handling of idle/exit events
+   Copyright (C) Stefan (metze) Metzmacher     2003
+   Copyright (C) Andrew Bartlett 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/>.
+*/
+
+#ifndef _INTERNAL_MODULES_H
+#define _INTERNAL_MODULES_H
+
+#include "lib/util/samba_module.h"
+
+/**
+ * Obtain the init function from a shared library file.
+ *
+ * The handle to dlclose() in case of error is returns in *handle if handle is not NULL
+ */
+samba_init_module_fn load_module(const char *path, bool is_probe, void **handle);
+
+int smb_load_modules(const char **modules);
+NTSTATUS smb_probe_module(const char *subsystem, const char *module);
+
+/**
+ * Obtain list of init functions from the modules in the specified
+ * directory
+ */
+samba_init_module_fn *load_modules(TALLOC_CTX *mem_ctx, const char *path);
+
+#endif /* _INTERNAL_MODULES_H */
diff --git a/lib/util/samba-module.pc.in b/lib/util/samba-module.pc.in
new file mode 100644 (file)
index 0000000..8f22988
--- /dev/null
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: samba-modules
+Description: Samba module loading utility functions
+Requires: talloc
+Version: 0.0.1
+Libs: @LIB_RPATH@ -L${libdir} -lsamba-modules
+Cflags: -I${includedir}  -DHAVE_IMMEDIATE_STRUCTURES=1
diff --git a/lib/util/samba_module.c b/lib/util/samba_module.c
new file mode 100644 (file)
index 0000000..f555eea
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+   Unix SMB/CIFS implementation.
+   Samba utility functions
+   Copyright (C) Jelmer Vernooij 2002-2003,2005-2007
+   Copyright (C) Stefan (metze) Metzmacher 2003
+   Copyright (C) Andrew Bartlett 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 "dynconfig/dynconfig.h"
+#include "lib/util/internal_module.h"
+#include "system/filesys.h"
+#include "system/dir.h"
+
+/**
+ * Run the specified init functions.
+ *
+ * @return true if all functions ran successfully, false otherwise
+ */
+bool samba_init_module_fns_run(samba_init_module_fn *fns)
+{
+       int i;
+       bool ret = true;
+
+       if (fns == NULL)
+               return true;
+
+       for (i = 0; fns[i]; i++) { ret &= (bool)NT_STATUS_IS_OK(fns[i]()); }
+
+       return ret;
+}
+
+/**
+ * Load the initialization functions from DSO files for a specific subsystem.
+ *
+ * Will return an array of function pointers to initialization functions
+ */
+
+samba_init_module_fn *samba_modules_load(TALLOC_CTX *mem_ctx, const char *subsystem)
+{
+       char *path = modules_path(mem_ctx, subsystem);
+       samba_init_module_fn *ret;
+
+       ret = load_modules(mem_ctx, path);
+
+       talloc_free(path);
+
+       return ret;
+}
similarity index 82%
rename from lib/util/samba_modules.h
rename to lib/util/samba_module.h
index a3d7609cb69e54fa1bf350ee8082294910659149..32b5c4b6ad007f45d1ea4d714052c140de1706f9 100644 (file)
@@ -32,13 +32,6 @@ NTSTATUS samba_init_module(void);
    function init_module() which makes a system call */
 #define SAMBA_INIT_MODULE "samba_init_module"
 
-/**
- * Obtain the init function from a shared library file.  
- *
- * The handle to dlclose() in case of error is returns in *handle if handle is not NULL
- */
-samba_init_module_fn load_module(const char *path, bool is_probe, void **handle);
-
 /**
  * Run the specified init functions.
  *
@@ -53,7 +46,4 @@ bool samba_init_module_fns_run(samba_init_module_fn *fns);
  */
 samba_init_module_fn *samba_modules_load(TALLOC_CTX *mem_ctx, const char *subsystem);
 
-int smb_load_modules(const char **modules);
-NTSTATUS smb_probe_module(const char *subsystem, const char *module);
-
 #endif /* _SAMBA_MODULES_H */
index 1dc65fab5e9f71658966782dde548f1e2ffa87ce..990887aeab063cfb10d7c61338de487e0a4a6df1 100755 (executable)
@@ -17,11 +17,19 @@ bld.SAMBA_LIBRARY('samba-util',
                   pc_files='samba-util.pc'
                   )
 
-bld.SAMBA_LIBRARY('samba-modules',
-                 source='modules.c',
+bld.SAMBA_LIBRARY('samba-module',
+                 source='samba_module.c',
+                 deps='errors samba-util samba-internal-module',
+                 local_include=False,
+                  public_headers='samba_module.h',
+                  vnum='0.0.1',
+                  pc_files='samba-module.pc')
+
+bld.SAMBA_LIBRARY('samba-internal-module',
+                 source='internal_module.c',
                  deps='errors samba-util',
                  local_include=False,
-                 private_library=True)
+                  private_library=True)
 
 bld.SAMBA_LIBRARY('asn1util',
                   source='asn1.c',
index d19409098f19587af5b7cd2905a70863651679b7..a3725735eb2ae772ce9043bd4c93a98326a97b03 100644 (file)
@@ -468,7 +468,7 @@ LIB_OBJ = $(LIBSAMBAUTIL_OBJ) $(UTIL_OBJ) $(CRYPTO_OBJ) $(LIBTSOCKET_OBJ) \
          ../lib/util/charset/charset_macosxfs.o intl/lang_tdb.o \
          lib/conn_tdb.o lib/adt_tree.o lib/gencache.o \
          lib/sessionid_tdb.o \
-         ../lib/util/modules.o lib/events.o @LIBTEVENT_OBJ0@ \
+         ../lib/util/internal_module.o ../lib/util/samba_module.o lib/events.o @LIBTEVENT_OBJ0@ \
          @CCAN_OBJ@ \
          lib/server_contexts.o \
          lib/server_prefork.o \
index 562b64ca9a92c6bc8621cea0bb00bee9076945ef..94ff3181e67d03dbf252a941ec3129a7e3307a9b 100644 (file)
@@ -524,7 +524,7 @@ typedef char fstring[FSTRING_LEN];
 #include "smb.h"
 #include "../lib/util/byteorder.h"
 
-#include "../lib/util/samba_modules.h"
+#include "../lib/util/internal_module.h"
 #include "../lib/util/talloc_stack.h"
 #include "../lib/util/smb_threads.h"
 #include "../lib/util/smb_threads_internal.h"
index d8f6893d4656b155de256567ea3eb36ebb171c45..095cd078d6a7cad42c372ce7bda1560536ae8016 100755 (executable)
@@ -799,7 +799,7 @@ bld.SAMBA3_SUBSYSTEM('KRBCLIENT',
 
 bld.SAMBA3_SUBSYSTEM('samba3core',
                    source=LIB_SRC,
-                   deps='LIBTSOCKET LIBCRYPTO ndr security NDR_SECURITY samba-util NDR_MESSAGING LIBASYNC_REQ tdb-wrap3 UTIL_TDB UTIL_PW SAMBA_VERSION KRB5_WRAP flag_mapping util_reg PTHREADPOOL interfaces cap string_init param util_str CHARSET3 namearray dbwrap util_sec util_malloc memcache ccan errors3 samba-modules',
+                   deps='LIBTSOCKET LIBCRYPTO ndr security NDR_SECURITY samba-util NDR_MESSAGING LIBASYNC_REQ tdb-wrap3 UTIL_TDB UTIL_PW SAMBA_VERSION KRB5_WRAP flag_mapping util_reg PTHREADPOOL interfaces cap string_init param util_str CHARSET3 namearray dbwrap util_sec util_malloc memcache ccan errors3 samba-module  samba-internal-module',
                    vars=locals())
 
 bld.SAMBA3_LIBRARY('smbd_shim',
index 870f8a9ba32dad49c0c4dd60804b6f6d1d298b5d..0a3122673eb3ab0d2b1978144478fc92b5cb38eb 100644 (file)
@@ -27,7 +27,7 @@
 #include "param/param.h"
 #include "dsdb/samdb/samdb.h"
 #include "libcli/wbclient/wbclient.h"
-#include "lib/util/samba_modules.h"
+#include "lib/util/samba_module.h"
 
 /***************************************************************************
  Set a fixed challenge
index 6447bf2ea0780746fca4d155d784175c604ce1f2..bb687d96000aa7f6b5bb11aa302f26d11b586053 100644 (file)
@@ -51,7 +51,7 @@ bld.SAMBA_MODULE('auth4_unix',
 bld.SAMBA_LIBRARY('auth4',
        source='auth.c auth_util.c auth_simple.c',
        autoproto='auth_proto.h',
-       deps='samba-util security samdb samba-credentials tevent-util LIBWBCLIENT_OLD auth_unix_token samba-modules',
+       deps='samba-util security samdb samba-credentials tevent-util LIBWBCLIENT_OLD auth_unix_token samba-module',
        private_library=True
        )
 
index 425a311fe5d128f743d9058a4c059235829a50eb..7b16986655e11f6763fe33d7a4fe50a76527c4ae 100644 (file)
@@ -25,7 +25,7 @@
 #include "includes.h"
 #include "ntptr/ntptr.h"
 #include "param/param.h"
-#include "lib/util/samba_modules.h"
+#include "lib/util/samba_module.h"
 
 /* the list of currently registered NTPTR backends */
 static struct ntptr_backend {
index fa4167e03d6b52e1bda24490b47c1489c2adb937..25cbfc1194b182dd134443539e311c85f88b92e9 100644 (file)
@@ -26,7 +26,7 @@
 #include "../lib/util/dlinklist.h"
 #include "ntvfs/ntvfs.h"
 #include "param/param.h"
-#include "lib/util/samba_modules.h"
+#include "lib/util/samba_module.h"
 
 /* the list of currently registered NTVFS backends, note that there
  * can be more than one backend with the same name, as long as they
index 2bff4be3049b5ab2297f524d24f5a4b0e9029933..d8090952244cec23c6d0b72677eb3f425a59a639 100644 (file)
@@ -27,7 +27,7 @@
 #include "libcli/security/security.h"
 #include "param/param.h"
 #include "../lib/util/unix_privs.h"
-#include "lib/util/samba_modules.h"
+#include "lib/util/samba_module.h"
 
 /* the list of currently registered ACL backends */
 static struct pvfs_acl_backend {
index acceefadf69cf8037f2ce4ba2999709c24725cc1..eea506fdb238e29e04dd070bd4932d25ec686a72 100644 (file)
@@ -3,7 +3,7 @@
 bld.SAMBA_SUBSYSTEM('pvfs_acl',
        source='pvfs_acl.c',
        autoproto='vfs_acl_proto.h',
-       deps='events samba-modules',
+       deps='events samba-module',
        )
 
 
index 35d99c19384dddb0413eeb90dc03ac2b032942c6..f95e02a578377e20e89ef2f84349efd78585fb1d 100644 (file)
@@ -27,7 +27,7 @@
 #include "ntvfs/sysdep/sys_lease.h"
 #include "../lib/util/dlinklist.h"
 #include "param/param.h"
-#include "lib/util/samba_modules.h"
+#include "lib/util/samba_module.h"
 
 /* list of registered backends */
 static struct sys_lease_ops *backends;
index 660e87f51a3df7b7d997251a809b6c07f31ad984..71ffda2bac3422f44a7562bae7be98392db37932 100644 (file)
@@ -28,7 +28,7 @@
 #include <tevent.h>
 #include "../lib/util/dlinklist.h"
 #include "param/param.h"
-#include "lib/util/samba_modules.h"
+#include "lib/util/samba_module.h"
 
 /* list of registered backends */
 static struct sys_notify_backend *backends;
index 455e7f0b8b800519865f6c074613b581ea35b521..738b7e0fa16a34aede467e347d4b96e013a1ec4f 100644 (file)
@@ -67,7 +67,7 @@ bld.SAMBA_MODULE('ntvfs_nbench',
 bld.SAMBA_LIBRARY('ntvfs',
                   source='ntvfs_base.c ntvfs_generic.c ntvfs_interface.c ntvfs_util.c',
                   autoproto='ntvfs_proto.h',
-                  deps='tevent samba-modules',
+                  deps='tevent samba-module',
                   private_library=True
                   )
 
index bdd12df2aaab3588d3819cf69a457cc5a94ad71c..67759369bd50f45959f1663900b99cd0fecf73bd 100644 (file)
@@ -22,7 +22,7 @@
 #include "includes.h"
 #include "param/share.h"
 #include "param/param.h"
-#include "lib/util/samba_modules.h"
+#include "lib/util/samba_module.h"
 
 const char *share_string_option(struct share_config *scfg, const char *opt_name, const char *defval)
 {
index 80b2758766caf2d7c45d329c66a45215314646a5..faeeae6e71f7b76d56cb5d289802e0a7ff7fb872 100644 (file)
@@ -10,7 +10,7 @@ bld.SAMBA_SUBSYSTEM('PROVISION',
 bld.SAMBA_SUBSYSTEM('share',
        source='share.c',
        public_headers='share.h',
-       deps='samba-util samba-modules'
+       deps='samba-util samba-module'
        )
 
 
index 63bf1c0daf713b669654bccb2713989943e7366b..94e628f9bfb7aa55d62f1e9cf44e61492e3f18d8 100644 (file)
@@ -39,7 +39,7 @@
 #include "smbd/process_model.h"
 #include "lib/messaging/irpc.h"
 #include "librpc/rpc/rpc_common.h"
-#include "lib/util/samba_modules.h"
+#include "lib/util/samba_module.h"
 
 /* this is only used when the client asks for an unknown interface */
 #define DUMMY_ASSOC_GROUP 0x0FFFFFFF
index 6e1252c718992b5af877f9348ea8b91d6d080463..710246cf8b60573b3241ef10ffa9640e92588045 100644 (file)
@@ -21,7 +21,7 @@
 #include "includes.h"
 #include "smbd/process_model.h"
 #include "param/param.h"
-#include "lib/util/samba_modules.h"
+#include "lib/util/samba_module.h"
 
 /* the list of currently registered process models */
 static struct process_model {
index e925dd4e3f915abe4d5fa5e65927b84d6599f5a1..1da472155dd3c91d381cf3d33ae3b3414e83a1b1 100644 (file)
@@ -42,7 +42,7 @@
 #include "librpc/gen_ndr/ndr_irpc.h"
 #include "cluster/cluster.h"
 #include "dynconfig/dynconfig.h"
-#include "lib/util/samba_modules.h"
+#include "lib/util/samba_module.h"
 
 /*
   recursively delete a directory tree
index ab92e3c9209e53a357641f506762dd934f0c6ffe..20fabe1a270b2e189b4e22448eeaee5ea405ac34 100644 (file)
@@ -76,7 +76,7 @@ bld.SAMBA_MODULE('process_model_onefork',
 bld.SAMBA_LIBRARY('process_model',
                   source='process_model.c',
                   autoproto='process_model_proto.h',
-                  deps='samba-util samba-hostconfig samba-modules',
+                  deps='samba-util samba-hostconfig samba-module',
                   private_library=True
                   )
 
index b2bd4c67491f2ebf02d1e02343ee77f9c0978775..9620605174344b293f9c47f57c783082e7ccee80 100644 (file)
@@ -32,7 +32,7 @@
 #include "librpc/rpc/dcerpc.h"
 #include "auth/gensec/gensec.h"
 #include "param/param.h"
-#include "lib/util/samba_modules.h"
+#include "lib/util/internal_module.h"
 
 #if HAVE_READLINE_HISTORY_H
 #include <readline/history.h>
index 50ff4c96fc503b1201df3e38fe7115d20a361d60..e270818dce1c6b8eed6b689d0f021f05290522c6 100644 (file)
@@ -23,7 +23,7 @@
 #include "param/param.h"
 #include "lib/cmdline/popt_common.h"
 #include "torture/smbtorture.h"
-#include "lib/util/samba_modules.h"
+#include "lib/util/samba_module.h"
 
 _PUBLIC_ int torture_numops=10;
 _PUBLIC_ int torture_entries=1000;