r24814: Fix headers, trim core.h even more.
authorJelmer Vernooij <jelmer@samba.org>
Thu, 30 Aug 2007 23:15:12 +0000 (23:15 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:03:14 +0000 (15:03 -0500)
19 files changed:
source/auth/gensec/gensec.h
source/build/smb_build/makefile.pm
source/include/core.h
source/include/includes.h
source/lib/charset/charset.h
source/lib/charset/iconv.c
source/lib/events/events.h
source/lib/registry/hive.h
source/lib/registry/registry.h
source/lib/talloc/config.mk
source/lib/tdr/tdr.h
source/lib/util/config.mk
source/lib/util/module.c [deleted file]
source/lib/util/util.h
source/libcli/libcli.h
source/librpc/ndr/libndr.h
source/param/param.h
source/param/util.c
source/rpc_server/dcerpc_server.h

index d129b194af825d170f807487da5338bf2a5152b4..48a2903513330a38bd8a2476e279f9afaeaefe6e 100644 (file)
@@ -23,8 +23,6 @@
 #ifndef __GENSEC_H__
 #define __GENSEC_H__
 
-#include "core.h"
-
 #define GENSEC_OID_NTLMSSP "1.3.6.1.4.1.311.2.2.10"
 #define GENSEC_OID_SPNEGO "1.3.6.1.5.5.2"
 #define GENSEC_OID_KERBEROS5 "1.2.840.113554.1.2.2"
index 8c6e17a551f89fb1e40d0fb51ccd750ce3655c2b..b88a1ea72e67fd0206903cbf2e6606ed06e0ed9f 100644 (file)
@@ -181,7 +181,7 @@ SHELL=$self->{config}->{SHELL}
 PERL=$self->{config}->{PERL}
 
 CPP=$self->{config}->{CPP}
-CPPFLAGS=$builddir_headers-I\$(srcdir)/include -I\$(srcdir) -I\$(srcdir)/lib -I\$(srcdir)/lib/replace -D_SAMBA_BUILD_=4 -DHAVE_CONFIG_H $self->{config}->{CPPFLAGS}
+CPPFLAGS=$builddir_headers-I\$(srcdir)/include -I\$(srcdir) -I\$(srcdir)/lib -I\$(srcdir)/lib/replace -I\$(srcdir)/lib/talloc -D_SAMBA_BUILD_=4 -DHAVE_CONFIG_H $self->{config}->{CPPFLAGS}
 
 CC=$self->{config}->{CC}
 CFLAGS=$self->{config}->{CFLAGS} \$(CPPFLAGS)
index fc66e1028321a82502bb72101eaf85d38f505659..270b6406a4e5a5f7db496b9460e874ef84b6c891 100644 (file)
 
 #include <stdlib.h>
 
-/*
-  we use struct ipv4_addr to avoid having to include all the
-  system networking headers everywhere
-*/
-struct ipv4_addr {
-       uint32_t addr;
-};
-
-typedef NTSTATUS (*init_module_fn) (void);
-
 /* 
    use the same structure for dom_sid2 as dom_sid. A dom_sid2 is really
    just a dom sid, but with the sub_auths represented as a conformant
@@ -53,17 +43,7 @@ typedef NTSTATUS (*init_module_fn) (void);
 /* same struct as dom_sid but inside a 28 bytes fixed buffer in NDR */
 #define dom_sid28 dom_sid
 
-/* protocol types. It assumes that higher protocols include lower protocols
-   as subsets. FIXME: Move to one of the smb-specific headers */
-enum protocol_types {
-       PROTOCOL_NONE,
-       PROTOCOL_CORE,
-       PROTOCOL_COREPLUS,
-       PROTOCOL_LANMAN1,
-       PROTOCOL_LANMAN2,
-       PROTOCOL_NT1,
-       PROTOCOL_SMB2
-};
+
 
 /* passed to br lock code. FIXME: Move to one of the smb-specific headers */
 enum brl_type {
index ac6204921c1ab01662dca6305729f3e894e3aed3..d8503fe47ad4fd0a86dae62987085743d8160dcb 100644 (file)
 #endif
 
 /* Lists, trees, caching, database... */
-#include "talloc/talloc.h"
+#include <talloc.h>
 #include "core.h"
 #include <stdbool.h>
 #include "charset/charset.h"
index 3c548192b637fb3d5e58611e16e040f27fb77a81..6943a6018263034331eb123ad99c49adb3c60afd 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef __CHARSET_H__
 #define __CHARSET_H__
 
-#include "lib/talloc/talloc.h"
+#include <talloc.h>
 
 /* this defines the charset types used in samba */
 typedef enum {CH_UTF16=0, CH_UNIX=1, CH_DISPLAY=2, CH_DOS=3, CH_UTF8=4, CH_UTF16BE=5} charset_t;
index 4eda585d4e67e7c2be1e0b56a6df970539b94c6f..062b4ddfc869bcfb87dcc14f0c926522894f7e0b 100644 (file)
@@ -72,23 +72,22 @@ static const struct charset_functions builtin_functions[] = {
 
 static struct charset_functions *charsets = NULL;
 
-NTSTATUS charset_register_backend(const void *_funcs) 
+bool charset_register_backend(const void *_funcs) 
 {
        struct charset_functions *funcs = memdup(_funcs,sizeof(struct charset_functions));
-       struct charset_functions *c = charsets;
+       struct charset_functions *c;
 
        /* Check whether we already have this charset... */
-       while(c) {
-               if(!strcasecmp(c->name, funcs->name)){ 
+       for (c = charsets; c != NULL; c = c->next) {
+               if(!strcasecmp(c->name, funcs->name)) 
                        DEBUG(2, ("Duplicate charset %s, not registering\n", funcs->name));
-                       return NT_STATUS_OBJECT_NAME_COLLISION;
+                       return false;
                }
-               c = c->next;
        }
 
        funcs->next = funcs->prev = NULL;
        DLIST_ADD(charsets, funcs);
-       return NT_STATUS_OK;
+       return true;
 }
 
 #ifdef HAVE_NATIVE_ICONV
index 0c0e8fe697a845772e17336950437c2c61875622..d30ffda2e2a4e34859786b3eed481c2df69b588e 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef __EVENTS_H__
 #define __EVENTS_H__
 
-#include "talloc/talloc.h"
+#include <talloc.h>
 #include <stdlib.h>
 
 struct event_context;
index ef44da373c518a4456d3850efa7448671364042d..36491f149b8c1339113b9822aa9b5877961a2319 100644 (file)
@@ -21,8 +21,7 @@
 #ifndef __REGISTRY_HIVE_H__
 #define __REGISTRY_HIVE_H__
 
-#include "core.h"
-#include "talloc.h"
+#include <talloc.h>
 #include "librpc/gen_ndr/security.h"
 
 /**
index 616bbb82dcdf426b6e8d6b7fbf750b3c401e3330..1d92a9edab3ad631e8f5a99db65db392b7df6ca2 100644 (file)
@@ -23,8 +23,7 @@
 
 struct registry_context;
 
-#include "core.h"
-#include "talloc/talloc.h"
+#include <talloc.h>
 #include "librpc/gen_ndr/security.h"
 #include "lib/registry/hive.h"
 
index 714ad72d1cdbee8e985c3d1f3f6d4ecddf980a60..0f138aafcda73a2fd1963b2c2c23abd3b26d7b55 100644 (file)
@@ -5,7 +5,7 @@ VERSION = 0.0.1
 SO_VERSION = 0
 OBJ_FILES = talloc.o
 MANPAGE = talloc.3
-CFLAGS = -Ilib/talloc
+CFLAGS = -I$(srcdir)/lib/talloc
 PUBLIC_HEADERS = talloc.h
 DESCRIPTION = A hierarchical pool based memory system with destructors
 #
index 256aaee74c28fc1fb6d077799e00a2ae6bfbde5a..689b9f3ebba490715d85f62a76333faf961cbac2 100644 (file)
@@ -20,8 +20,7 @@
 #ifndef __TDR_H__
 #define __TDR_H__
 
-#include "core.h"
-#include "lib/talloc/talloc.h"
+#include <talloc.h>
 #include "charset/charset.h"
 
 #define TDR_BIG_ENDIAN                 0x01
index 0912c897dbdaf6dc183ba7a06a7c50a01778615c..702e3df5aacc24f321814d816adcf1ef4e908845 100644 (file)
@@ -27,7 +27,6 @@ OBJ_FILES = xfile.o \
                ms_fnmatch.o \
                mutex.o \
                idtree.o \
-               module.o \
                become_daemon.o
 PUBLIC_DEPENDENCIES = \
                LIBTALLOC LIBCRYPTO \
diff --git a/source/lib/util/module.c b/source/lib/util/module.c
deleted file mode 100644 (file)
index 170ea0b..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-/* 
-   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 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/>.
-*/
-
-/**
- * @file
- * @brief Module initialization function handling
- */
-
-#include "includes.h"
-#include "system/dir.h"
-
-/**
- * Obtain the init function from a shared library file
- */
-_PUBLIC_ init_module_fn load_module(TALLOC_CTX *mem_ctx, const char *path)
-{
-       void *handle;
-       void *init_fn;
-
-       handle = dlopen(path, RTLD_NOW);
-       if (handle == NULL) {
-               DEBUG(0, ("Unable to open %s: %s\n", path, dlerror()));
-               return NULL;
-       }
-
-       init_fn = dlsym(handle, "init_module");
-
-       if (init_fn == NULL) {
-               DEBUG(0, ("Unable to find init_module() in %s: %s\n", path, dlerror()));
-               DEBUG(1, ("Loading module '%s' failed\n", path));
-               dlclose(handle);
-               return NULL;
-       }
-
-       return (init_module_fn)init_fn;
-}
-
-/**
- * Obtain list of init functions from the modules in the specified
- * directory
- */
-_PUBLIC_ init_module_fn *load_modules(TALLOC_CTX *mem_ctx, const char *path)
-{
-       DIR *dir;
-       struct dirent *entry;
-       char *filename;
-       int success = 0;
-       init_module_fn *ret = talloc_array(mem_ctx, init_module_fn, 2);
-
-       ret[0] = NULL;
-       
-       dir = opendir(path);
-       if (dir == NULL) {
-               talloc_free(ret);
-               return NULL;
-       }
-
-       while((entry = readdir(dir))) {
-               if (ISDOT(entry->d_name) || ISDOTDOT(entry->d_name))
-                       continue;
-
-               filename = talloc_asprintf(mem_ctx, "%s/%s", path, entry->d_name);
-
-               ret[success] = load_module(mem_ctx, filename);
-               if (ret[success]) {
-                       ret = talloc_realloc(mem_ctx, ret, init_module_fn, success+2);
-                       success++;
-                       ret[success] = NULL;
-               }
-
-               talloc_free(filename);
-       }
-
-       closedir(dir);
-
-       return ret;
-}
-
-/**
- * Run the specified init functions.
- *
- * @return true if all functions ran successfully, false otherwise
- */
-_PUBLIC_ bool run_init_functions(NTSTATUS (**fns) (void))
-{
-       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;
-}
index 0c784d1c970f9b2f083d55514ab6c97a766b3234..8259e0851279c37aed8c0e0ed328ee4b49990dc7 100644 (file)
@@ -254,6 +254,14 @@ void CatchChildLeaveStatus(void);
 /* The following definitions come from lib/util/system.c  */
 
 
+/*
+  we use struct ipv4_addr to avoid having to include all the
+  system networking headers everywhere
+*/
+struct ipv4_addr {
+       uint32_t addr;
+};
+
 /**************************************************************************
 A wrapper for gethostbyname() that tries avoids looking up hostnames 
 in the root domain, which can cause dial-on-demand links to come up for no
@@ -769,6 +777,21 @@ _PUBLIC_ int sys_fsusage(const char *path, uint64_t *dfree, uint64_t *dsize);
  * @file
  * @brief MS-style Filename matching
  */
+
+/* protocol types. It assumes that higher protocols include lower protocols
+   as subsets. FIXME: Move to one of the smb-specific headers */
+enum protocol_types {
+       PROTOCOL_NONE,
+       PROTOCOL_CORE,
+       PROTOCOL_COREPLUS,
+       PROTOCOL_LANMAN1,
+       PROTOCOL_LANMAN2,
+       PROTOCOL_NT1,
+       PROTOCOL_SMB2
+};
+
+
+
 int ms_fnmatch(const char *pattern, const char *string, enum protocol_types protocol);
 
 /** a generic fnmatch function - uses for non-CIFS pattern matching */
@@ -820,30 +843,8 @@ _PUBLIC_ void *idr_find(struct idr_context *idp, int id);
 */
 _PUBLIC_ int idr_remove(struct idr_context *idp, int id);
 
-/* The following definitions come from lib/util/module.c  */
-
-
-/**
- * Obtain the init function from a shared library file
- */
-_PUBLIC_ init_module_fn load_module(TALLOC_CTX *mem_ctx, const char *path);
-
-/**
- * Obtain list of init functions from the modules in the specified
- * directory
- */
-_PUBLIC_ init_module_fn *load_modules(TALLOC_CTX *mem_ctx, const char *path);
-
-/**
- * Run the specified init functions.
- *
- * @return true if all functions ran successfully, false otherwise
- */
-_PUBLIC_ bool run_init_functions(NTSTATUS (**fns) (void));
-
 /* The following definitions come from lib/util/become_daemon.c  */
 
-
 /**
  Become a daemon, discarding the controlling terminal.
 **/
index 98ca9d57eb1ca601116ee165efbdb385aa47923f..568f2f3b3e6ab3e043a1995e781e72099ba66702 100644 (file)
@@ -21,7 +21,6 @@
 #ifndef __LIBCLI_H__
 #define __LIBCLI_H__
 
-#include "core.h"
 #include "librpc/gen_ndr/nbt.h"
 
 /* 
index e138b3eac9940b7da38e6fc0d72f78bb23e2a823..09a2680190f6fb9249c72a28de1d71b6a55c1698 100644 (file)
 #ifndef __LIBNDR_H__
 #define __LIBNDR_H__
 
-#include "core.h"
-#include "lib/talloc/talloc.h"
+#include <talloc.h>
 #include "lib/util/util.h" /* for discard_const */
 #include "lib/charset/charset.h"
+#include "libcli/util/nt_status.h"
 
 /*
   this provides definitions for the libcli/rpc/ MSRPC library
index 0438a87db9210f2351828591f7e26cbffd349614..c829e0bf571be13c7b2f56016e5151253b502cb8 100644 (file)
@@ -42,6 +42,8 @@ struct smbsrv_connection;
 
 #define Auto (2)
 
+typedef NTSTATUS (*init_module_fn) (void);
+
 #include "param/proto.h"
 
 #endif /* _PARAM_H */
index 7af2693876caca3a3263bb38978b2196e545b3ef..6e6e12596bd932df940b43062816531b17d10da8 100644 (file)
@@ -6,6 +6,7 @@
    Copyright (C) Simo Sorce 2001
    Copyright (C) Jim McDonough (jmcd@us.ibm.com)  2003.
    Copyright (C) James J Myers 2003
+   Copyright (C) Jelmer Vernooij 2005-2007
    
    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
@@ -25,6 +26,7 @@
 #include "dynconfig.h"
 #include "system/network.h"
 #include "system/filesys.h"
+#include "system/dir.h"
 
 /**
  * @file
@@ -188,6 +190,91 @@ _PUBLIC_ char *smbd_tmp_path(TALLOC_CTX *mem_ctx, const char *name)
        return fname;
 }
 
+/**
+ * Obtain the init function from a shared library file
+ */
+_PUBLIC_ init_module_fn load_module(TALLOC_CTX *mem_ctx, const char *path)
+{
+       void *handle;
+       void *init_fn;
+
+       handle = dlopen(path, RTLD_NOW);
+       if (handle == NULL) {
+               DEBUG(0, ("Unable to open %s: %s\n", path, dlerror()));
+               return NULL;
+       }
+
+       init_fn = dlsym(handle, "init_module");
+
+       if (init_fn == NULL) {
+               DEBUG(0, ("Unable to find init_module() in %s: %s\n", path, dlerror()));
+               DEBUG(1, ("Loading module '%s' failed\n", path));
+               dlclose(handle);
+               return NULL;
+       }
+
+       return (init_module_fn)init_fn;
+}
+
+/**
+ * Obtain list of init functions from the modules in the specified
+ * directory
+ */
+_PUBLIC_ init_module_fn *load_modules(TALLOC_CTX *mem_ctx, const char *path)
+{
+       DIR *dir;
+       struct dirent *entry;
+       char *filename;
+       int success = 0;
+       init_module_fn *ret = talloc_array(mem_ctx, init_module_fn, 2);
+
+       ret[0] = NULL;
+       
+       dir = opendir(path);
+       if (dir == NULL) {
+               talloc_free(ret);
+               return NULL;
+       }
+
+       while((entry = readdir(dir))) {
+               if (ISDOT(entry->d_name) || ISDOTDOT(entry->d_name))
+                       continue;
+
+               filename = talloc_asprintf(mem_ctx, "%s/%s", path, entry->d_name);
+
+               ret[success] = load_module(mem_ctx, filename);
+               if (ret[success]) {
+                       ret = talloc_realloc(mem_ctx, ret, init_module_fn, success+2);
+                       success++;
+                       ret[success] = NULL;
+               }
+
+               talloc_free(filename);
+       }
+
+       closedir(dir);
+
+       return ret;
+}
+
+/**
+ * Run the specified init functions.
+ *
+ * @return true if all functions ran successfully, false otherwise
+ */
+_PUBLIC_ bool run_init_functions(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;
+}
+
 static char *modules_path(TALLOC_CTX* mem_ctx, const char *name)
 {
        const char *env_moduledir = getenv("LD_SAMBA_MODULE_PATH");
index 219bb51e023bbd809d54ec39c94ac088271c38cb..f9a0f00288dcd6b4e0cb30f16bf3999b84d1717b 100644 (file)
@@ -23,7 +23,6 @@
 #ifndef SAMBA_DCERPC_SERVER_H
 #define SAMBA_DCERPC_SERVER_H
 
-#include "core.h"
 #include "librpc/gen_ndr/misc.h"
 #include "librpc/rpc/dcerpc.h"
 #include "librpc/ndr/libndr.h"