1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-05 20:58:40 +03:00

r24814: Fix headers, trim core.h even more.

(This used to be commit 9647f860bdd5c0a74583e886182bd041a45e7655)
This commit is contained in:
Jelmer Vernooij 2007-08-30 23:15:12 +00:00 committed by Gerald (Jerry) Carter
parent 09c188e735
commit 82037a75ea
19 changed files with 129 additions and 179 deletions

View 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"

View 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)

View File

@ -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 {

View File

@ -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"

View 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;

View 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

View File

@ -22,7 +22,7 @@
#ifndef __EVENTS_H__
#define __EVENTS_H__
#include "talloc/talloc.h"
#include <talloc.h>
#include <stdlib.h>
struct event_context;

View 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"
/**

View 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"

View 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
#

View 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

View 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 \

View File

@ -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;
}

View 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.
**/

View File

@ -21,7 +21,6 @@
#ifndef __LIBCLI_H__
#define __LIBCLI_H__
#include "core.h"
#include "librpc/gen_ndr/nbt.h"
/*

View File

@ -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

View File

@ -42,6 +42,8 @@ struct smbsrv_connection;
#define Auto (2)
typedef NTSTATUS (*init_module_fn) (void);
#include "param/proto.h"
#endif /* _PARAM_H */

View 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");

View 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"