summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/auth/gensec/gensec.h2
-rw-r--r--source4/build/smb_build/makefile.pm2
-rw-r--r--source4/include/core.h22
-rw-r--r--source4/include/includes.h2
-rw-r--r--source4/lib/charset/charset.h2
-rw-r--r--source4/lib/charset/iconv.c13
-rw-r--r--source4/lib/events/events.h2
-rw-r--r--source4/lib/registry/hive.h3
-rw-r--r--source4/lib/registry/registry.h3
-rw-r--r--source4/lib/talloc/config.mk2
-rw-r--r--source4/lib/tdr/tdr.h3
-rw-r--r--source4/lib/util/config.mk1
-rw-r--r--source4/lib/util/module.c111
-rw-r--r--source4/lib/util/util.h45
-rw-r--r--source4/libcli/libcli.h1
-rw-r--r--source4/librpc/ndr/libndr.h4
-rw-r--r--source4/param/param.h2
-rw-r--r--source4/param/util.c87
-rw-r--r--source4/rpc_server/dcerpc_server.h1
19 files changed, 129 insertions, 179 deletions
diff --git a/source4/auth/gensec/gensec.h b/source4/auth/gensec/gensec.h
index d129b194af..48a2903513 100644
--- a/source4/auth/gensec/gensec.h
+++ b/source4/auth/gensec/gensec.h
@@ -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"
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 8c6e17a551..b88a1ea72e 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -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)
diff --git a/source4/include/core.h b/source4/include/core.h
index fc66e10283..270b6406a4 100644
--- a/source4/include/core.h
+++ b/source4/include/core.h
@@ -27,16 +27,6 @@
#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 {
diff --git a/source4/include/includes.h b/source4/include/includes.h
index ac6204921c..d8503fe47a 100644
--- a/source4/include/includes.h
+++ b/source4/include/includes.h
@@ -109,7 +109,7 @@
#endif
/* Lists, trees, caching, database... */
-#include "talloc/talloc.h"
+#include <talloc.h>
#include "core.h"
#include <stdbool.h>
#include "charset/charset.h"
diff --git a/source4/lib/charset/charset.h b/source4/lib/charset/charset.h
index 3c548192b6..6943a60182 100644
--- a/source4/lib/charset/charset.h
+++ b/source4/lib/charset/charset.h
@@ -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;
diff --git a/source4/lib/charset/iconv.c b/source4/lib/charset/iconv.c
index 4eda585d4e..062b4ddfc8 100644
--- a/source4/lib/charset/iconv.c
+++ b/source4/lib/charset/iconv.c
@@ -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
diff --git a/source4/lib/events/events.h b/source4/lib/events/events.h
index 0c0e8fe697..d30ffda2e2 100644
--- a/source4/lib/events/events.h
+++ b/source4/lib/events/events.h
@@ -22,7 +22,7 @@
#ifndef __EVENTS_H__
#define __EVENTS_H__
-#include "talloc/talloc.h"
+#include <talloc.h>
#include <stdlib.h>
struct event_context;
diff --git a/source4/lib/registry/hive.h b/source4/lib/registry/hive.h
index ef44da373c..36491f149b 100644
--- a/source4/lib/registry/hive.h
+++ b/source4/lib/registry/hive.h
@@ -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"
/**
diff --git a/source4/lib/registry/registry.h b/source4/lib/registry/registry.h
index 616bbb82dc..1d92a9edab 100644
--- a/source4/lib/registry/registry.h
+++ b/source4/lib/registry/registry.h
@@ -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"
diff --git a/source4/lib/talloc/config.mk b/source4/lib/talloc/config.mk
index 714ad72d1c..0f138aafcd 100644
--- a/source4/lib/talloc/config.mk
+++ b/source4/lib/talloc/config.mk
@@ -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
#
diff --git a/source4/lib/tdr/tdr.h b/source4/lib/tdr/tdr.h
index 256aaee74c..689b9f3ebb 100644
--- a/source4/lib/tdr/tdr.h
+++ b/source4/lib/tdr/tdr.h
@@ -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
diff --git a/source4/lib/util/config.mk b/source4/lib/util/config.mk
index 0912c897db..702e3df5aa 100644
--- a/source4/lib/util/config.mk
+++ b/source4/lib/util/config.mk
@@ -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/source4/lib/util/module.c b/source4/lib/util/module.c
deleted file mode 100644
index 170ea0bacb..0000000000
--- a/source4/lib/util/module.c
+++ /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;
-}
diff --git a/source4/lib/util/util.h b/source4/lib/util/util.h
index 0c784d1c97..8259e08512 100644
--- a/source4/lib/util/util.h
+++ b/source4/lib/util/util.h
@@ -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.
**/
diff --git a/source4/libcli/libcli.h b/source4/libcli/libcli.h
index 98ca9d57eb..568f2f3b3e 100644
--- a/source4/libcli/libcli.h
+++ b/source4/libcli/libcli.h
@@ -21,7 +21,6 @@
#ifndef __LIBCLI_H__
#define __LIBCLI_H__
-#include "core.h"
#include "librpc/gen_ndr/nbt.h"
/*
diff --git a/source4/librpc/ndr/libndr.h b/source4/librpc/ndr/libndr.h
index e138b3eac9..09a2680190 100644
--- a/source4/librpc/ndr/libndr.h
+++ b/source4/librpc/ndr/libndr.h
@@ -20,10 +20,10 @@
#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
diff --git a/source4/param/param.h b/source4/param/param.h
index 0438a87db9..c829e0bf57 100644
--- a/source4/param/param.h
+++ b/source4/param/param.h
@@ -42,6 +42,8 @@ struct smbsrv_connection;
#define Auto (2)
+typedef NTSTATUS (*init_module_fn) (void);
+
#include "param/proto.h"
#endif /* _PARAM_H */
diff --git a/source4/param/util.c b/source4/param/util.c
index 7af2693876..6e6e12596b 100644
--- a/source4/param/util.c
+++ b/source4/param/util.c
@@ -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");
diff --git a/source4/rpc_server/dcerpc_server.h b/source4/rpc_server/dcerpc_server.h
index 219bb51e02..f9a0f00288 100644
--- a/source4/rpc_server/dcerpc_server.h
+++ b/source4/rpc_server/dcerpc_server.h
@@ -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"