summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib')
-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
10 files changed, 35 insertions, 150 deletions
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.
**/