diff options
62 files changed, 308 insertions, 167 deletions
diff --git a/source4/auth/auth_sam.c b/source4/auth/auth_sam.c index da1ffb5c851..fd92f3ae126 100644 --- a/source4/auth/auth_sam.c +++ b/source4/auth/auth_sam.c @@ -22,7 +22,8 @@ #include "includes.h" #include "librpc/gen_ndr/ndr_netlogon.h" #include "system/time.h" -#include "db_wrap.h" +#include "tdb_wrap.h" +#include "util/util_ldb.h" #include "lib/ldb/include/ldb.h" #include "auth/auth.h" #include "auth/auth_sam.h" diff --git a/source4/auth/config.mk b/source4/auth/config.mk index c34a941d121..497fccbc965 100644 --- a/source4/auth/config.mk +++ b/source4/auth/config.mk @@ -7,7 +7,7 @@ include credentials/config.mk [SUBSYSTEM::auth_sam] PRIVATE_PROTO_HEADER = auth_sam.h OBJ_FILES = sam.o auth_sam_reply.o ntlm_check.o -PUBLIC_DEPENDENCIES = SAMDB +PUBLIC_DEPENDENCIES = SAMDB UTIL_LDB ####################### # Start MODULE auth_sam diff --git a/source4/auth/credentials/credentials_files.c b/source4/auth/credentials/credentials_files.c index 1708fa5841d..db69fc1cb4f 100644 --- a/source4/auth/credentials/credentials_files.c +++ b/source4/auth/credentials/credentials_files.c @@ -26,7 +26,7 @@ #include "librpc/gen_ndr/samr.h" /* for struct samrPassword */ #include "param/secrets.h" #include "system/filesys.h" -#include "db_wrap.h" +#include "util/util_ldb.h" #include "auth/credentials/credentials.h" #include "auth/credentials/credentials_krb5.h" #include "param/param.h" diff --git a/source4/auth/gensec/schannel_state.c b/source4/auth/gensec/schannel_state.c index 808240c4f4b..1bb71d8fc91 100644 --- a/source4/auth/gensec/schannel_state.c +++ b/source4/auth/gensec/schannel_state.c @@ -23,7 +23,8 @@ #include "lib/ldb/include/ldb.h" #include "lib/ldb/include/ldb_errors.h" #include "dsdb/samdb/samdb.h" -#include "db_wrap.h" +#include "ldb_wrap.h" +#include "util/util_ldb.h" #include "libcli/auth/libcli_auth.h" #include "auth/auth.h" #include "param/param.h" diff --git a/source4/auth/sam.c b/source4/auth/sam.c index ad8d77ecf86..6a212b8cfe7 100644 --- a/source4/auth/sam.c +++ b/source4/auth/sam.c @@ -22,7 +22,8 @@ #include "includes.h" #include "system/time.h" #include "auth/auth.h" -#include "db_wrap.h" +#include <ldb.h> +#include "util/util_ldb.h" #include "dsdb/samdb/samdb.h" #include "libcli/security/security.h" #include "libcli/ldap/ldap.h" diff --git a/source4/cldap_server/cldap_server.c b/source4/cldap_server/cldap_server.c index 454beb3ae22..ed78f45ca70 100644 --- a/source4/cldap_server/cldap_server.c +++ b/source4/cldap_server/cldap_server.c @@ -31,7 +31,7 @@ #include "lib/ldb/include/ldb.h" #include "lib/ldb/include/ldb_errors.h" #include "dsdb/samdb/samdb.h" -#include "db_wrap.h" +#include "ldb_wrap.h" #include "auth/auth.h" #include "param/param.h" diff --git a/source4/cldap_server/netlogon.c b/source4/cldap_server/netlogon.c index c6b1fc376b9..2031f58e7b9 100644 --- a/source4/cldap_server/netlogon.c +++ b/source4/cldap_server/netlogon.c @@ -30,7 +30,7 @@ #include "librpc/gen_ndr/ndr_misc.h" #include "dsdb/samdb/samdb.h" #include "auth/auth.h" -#include "db_wrap.h" +#include "ldb_wrap.h" #include "system/network.h" #include "lib/socket/netif.h" #include "param/param.h" diff --git a/source4/cldap_server/rootdse.c b/source4/cldap_server/rootdse.c index 10b2d2cdad3..4ff71c08634 100644 --- a/source4/cldap_server/rootdse.c +++ b/source4/cldap_server/rootdse.c @@ -30,7 +30,7 @@ #include "librpc/gen_ndr/ndr_misc.h" #include "dsdb/samdb/samdb.h" #include "auth/auth.h" -#include "db_wrap.h" +#include "ldb_wrap.h" #include "system/network.h" #include "lib/socket/netif.h" diff --git a/source4/cluster/ctdb/brlock_ctdb.c b/source4/cluster/ctdb/brlock_ctdb.c index 8b633358a3b..c38d666c3c6 100644 --- a/source4/cluster/ctdb/brlock_ctdb.c +++ b/source4/cluster/ctdb/brlock_ctdb.c @@ -23,7 +23,6 @@ #include "system/filesys.h" #include "lib/tdb/include/tdb.h" #include "messaging/messaging.h" -#include "db_wrap.h" #include "lib/messaging/irpc.h" #include "libcli/libcli.h" #include "cluster/cluster.h" diff --git a/source4/cluster/ctdb/client/ctdb_client.c b/source4/cluster/ctdb/client/ctdb_client.c index 84c095ec8a6..2af0d418a8b 100644 --- a/source4/cluster/ctdb/client/ctdb_client.c +++ b/source4/cluster/ctdb/client/ctdb_client.c @@ -19,7 +19,7 @@ */ #include "includes.h" -#include "db_wrap.h" +#include "tdb_wrap.h" #include "lib/tdb/include/tdb.h" #include "lib/util/dlinklist.h" #include "lib/events/events.h" diff --git a/source4/cluster/ctdb/common/ctdb_ltdb.c b/source4/cluster/ctdb/common/ctdb_ltdb.c index 8d8b4fd24a2..92adc4a12af 100644 --- a/source4/cluster/ctdb/common/ctdb_ltdb.c +++ b/source4/cluster/ctdb/common/ctdb_ltdb.c @@ -23,7 +23,7 @@ #include "system/network.h" #include "system/filesys.h" #include "../include/ctdb_private.h" -#include "db_wrap.h" +#include "tdb_wrap.h" #include "lib/util/dlinklist.h" /* diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index d8860aabd08..e4a9742401d 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -26,7 +26,7 @@ #include "cluster/cluster_private.h" #include "lib/tdb/include/tdb.h" #include "include/ctdb.h" -#include "db_wrap.h" +#include "tdb_wrap.h" #include "lib/util/dlinklist.h" #include "param/param.h" #include "librpc/gen_ndr/misc.h" diff --git a/source4/cluster/ctdb/opendb_ctdb.c b/source4/cluster/ctdb/opendb_ctdb.c index 53febecb694..c8b673e74d2 100644 --- a/source4/cluster/ctdb/opendb_ctdb.c +++ b/source4/cluster/ctdb/opendb_ctdb.c @@ -42,7 +42,7 @@ #include "system/filesys.h" #include "lib/tdb/include/tdb.h" #include "messaging/messaging.h" -#include "db_wrap.h" +#include "tdb_wrap.h" #include "lib/messaging/irpc.h" #include "librpc/gen_ndr/ndr_opendb.h" #include "ntvfs/ntvfs.h" diff --git a/source4/cluster/local.c b/source4/cluster/local.c index 2abe422d5a9..110bc295eb2 100644 --- a/source4/cluster/local.c +++ b/source4/cluster/local.c @@ -23,7 +23,7 @@ #include "cluster/cluster.h" #include "cluster/cluster_private.h" #include "lib/tdb/include/tdb.h" -#include "db_wrap.h" +#include "tdb_wrap.h" #include "system/filesys.h" #include "param/param.h" #include "librpc/gen_ndr/misc.h" diff --git a/source4/dsdb/common/sidmap.c b/source4/dsdb/common/sidmap.c index de1f3f3c7a1..46052ac2a02 100644 --- a/source4/dsdb/common/sidmap.c +++ b/source4/dsdb/common/sidmap.c @@ -25,7 +25,7 @@ #include "dsdb/samdb/samdb.h" #include "auth/auth.h" #include "libcli/ldap/ldap.h" -#include "db_wrap.h" +#include "util/util_ldb.h" #include "libcli/security/security.h" /* diff --git a/source4/dsdb/samdb/cracknames.c b/source4/dsdb/samdb/cracknames.c index a4565844ec6..e607dbc5dee 100644 --- a/source4/dsdb/samdb/cracknames.c +++ b/source4/dsdb/samdb/cracknames.c @@ -31,7 +31,7 @@ #include "libcli/security/security.h" #include "librpc/gen_ndr/ndr_misc.h" #include "auth/auth.h" -#include "db_wrap.h" +#include "util/util_ldb.h" #include "dsdb/samdb/samdb.h" static WERROR DsCrackNameOneFilter(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx, diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c index b1366fd9943..85ca1a7f4bf 100644 --- a/source4/dsdb/samdb/ldb_modules/samldb.c +++ b/source4/dsdb/samdb/ldb_modules/samldb.c @@ -39,7 +39,7 @@ #include "dsdb/samdb/samdb.h" #include "libcli/security/security.h" #include "librpc/gen_ndr/ndr_security.h" -#include "db_wrap.h" +#include "util/util_ldb.h" int samldb_notice_sid(struct ldb_module *module, TALLOC_CTX *mem_ctx, const struct dom_sid *sid); diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c index 8b1c00dc90e..6eb2ecffaed 100644 --- a/source4/dsdb/samdb/samdb.c +++ b/source4/dsdb/samdb/samdb.c @@ -32,7 +32,8 @@ #include "libcli/ldap/ldap.h" #include "system/time.h" #include "system/filesys.h" -#include "db_wrap.h" +#include "ldb_wrap.h" +#include "util/util_ldb.h" #include "dsdb/samdb/samdb.h" #include "dsdb/common/flags.h" #include "param/param.h" diff --git a/source4/dsdb/samdb/samdb_privilege.c b/source4/dsdb/samdb/samdb_privilege.c index 23133856045..7fe840fca9f 100644 --- a/source4/dsdb/samdb/samdb_privilege.c +++ b/source4/dsdb/samdb/samdb_privilege.c @@ -24,7 +24,7 @@ #include "dsdb/samdb/samdb.h" #include "auth/auth.h" #include "libcli/security/security.h" -#include "db_wrap.h" +#include "util/util_ldb.h" /* add privilege bits for one sid to a security_token diff --git a/source4/kdc/hdb-ldb.c b/source4/kdc/hdb-ldb.c index 52f7da25bf3..125852cfa17 100644 --- a/source4/kdc/hdb-ldb.c +++ b/source4/kdc/hdb-ldb.c @@ -44,7 +44,7 @@ #include "auth/auth.h" #include "auth/credentials/credentials.h" #include "auth/auth_sam.h" -#include "db_wrap.h" +#include "util/util_ldb.h" #include "dsdb/samdb/samdb.h" #include "librpc/ndr/libndr.h" #include "librpc/gen_ndr/ndr_drsblobs.h" diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c index 62fe6270dcb..5a953947f32 100644 --- a/source4/ldap_server/ldap_backend.c +++ b/source4/ldap_server/ldap_backend.c @@ -23,7 +23,7 @@ #include "libcli/ldap/ldap.h" #include "lib/ldb/include/ldb.h" #include "lib/ldb/include/ldb_errors.h" -#include "lib/db_wrap.h" +#include "lib/ldb_wrap.h" #include "auth/credentials/credentials.h" #include "auth/gensec/gensec.h" #include "param/param.h" diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk index d1ed7ede0dc..0a0c8237ee6 100644 --- a/source4/lib/basic.mk +++ b/source4/lib/basic.mk @@ -29,9 +29,13 @@ OBJ_FILES = compression/mszip.o PRIVATE_PROTO_HEADER = gencache/gencache.h OBJ_FILES = gencache/gencache.o \ -[SUBSYSTEM::DB_WRAP] -PUBLIC_PROTO_HEADER = db_wrap_proto.h -PUBLIC_HEADERS = db_wrap.h -OBJ_FILES = db_wrap.o gendb.o -PUBLIC_DEPENDENCIES = LIBTDB LIBLDB +[SUBSYSTEM::LDB_WRAP] +PUBLIC_HEADERS = ldb_wrap.h +OBJ_FILES = ldb_wrap.o +PUBLIC_DEPENDENCIES = LIBLDB PRIVATE_DEPENDENCIES = LDBSAMBA + +[SUBSYSTEM::TDB_WRAP] +PUBLIC_HEADERS = tdb_wrap.h +OBJ_FILES = tdb_wrap.o +PUBLIC_DEPENDENCIES = LIBTDB diff --git a/source4/lib/dbwrap/dbwrap_tdb.c b/source4/lib/dbwrap/dbwrap_tdb.c index b256b6ccc4d..621b19532d8 100644 --- a/source4/lib/dbwrap/dbwrap_tdb.c +++ b/source4/lib/dbwrap/dbwrap_tdb.c @@ -24,7 +24,7 @@ #include "lib/tdb/include/tdb.h" #include "lib/dbwrap/dbwrap.h" #include "system/filesys.h" -#include "db_wrap.h" +#include "tdb_wrap.h" #include "param/param.h" struct db_tdb_ctx { diff --git a/source4/lib/ldb/tools/cmdline.c b/source4/lib/ldb/tools/cmdline.c index a713f54e685..01ef04f5d2d 100644 --- a/source4/lib/ldb/tools/cmdline.c +++ b/source4/lib/ldb/tools/cmdline.c @@ -30,7 +30,7 @@ #include "lib/ldb-samba/ldif_handlers.h" #include "auth/gensec/gensec.h" #include "auth/auth.h" -#include "db_wrap.h" +#include "ldb_wrap.h" #endif diff --git a/source4/lib/db_wrap.c b/source4/lib/ldb_wrap.c index c33786a1e43..659b91d2547 100644 --- a/source4/lib/db_wrap.c +++ b/source4/lib/ldb_wrap.c @@ -1,7 +1,7 @@ /* Unix SMB/CIFS implementation. - database wrap functions + LDB wrap functions Copyright (C) Andrew Tridgell 2004 @@ -27,18 +27,15 @@ */ #include "includes.h" -#include "lib/util/dlinklist.h" #include "lib/events/events.h" -#include "lib/tdb/include/tdb.h" #include "lib/ldb/include/ldb.h" #include "lib/ldb/include/ldb_errors.h" #include "lib/ldb-samba/ldif_handlers.h" -#include "db_wrap.h" +#include "ldb_wrap.h" #include "dsdb/samdb/samdb.h" +#include "dsdb/schema/proto.h" #include "param/param.h" -static struct tdb_wrap *tdb_list; - /* this is used to catch debug messages from ldb */ @@ -71,11 +68,6 @@ static void ldb_wrap_debug(void *context, enum ldb_debug_level level, free(s); } -char *wrap_casefold(void *context, void *mem_ctx, const char *s) -{ - return strupper_talloc(mem_ctx, s); -} - /* check for memory leaks on the ldb context */ static int ldb_wrap_destructor(struct ldb_context *ldb) { @@ -192,91 +184,4 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx, } -/* - Log tdb messages via DEBUG(). -*/ -static void tdb_wrap_log(TDB_CONTEXT *tdb, enum tdb_debug_level level, - const char *format, ...) PRINTF_ATTRIBUTE(3,4); - -static void tdb_wrap_log(TDB_CONTEXT *tdb, enum tdb_debug_level level, - const char *format, ...) -{ - va_list ap; - char *ptr = NULL; - int debug_level; - - va_start(ap, format); - vasprintf(&ptr, format, ap); - va_end(ap); - - switch (level) { - case TDB_DEBUG_FATAL: - debug_level = 0; - break; - case TDB_DEBUG_ERROR: - debug_level = 1; - break; - case TDB_DEBUG_WARNING: - debug_level = 2; - break; - case TDB_DEBUG_TRACE: - debug_level = 5; - break; - default: - debug_level = 0; - } - - if (ptr != NULL) { - const char *name = tdb_name(tdb); - DEBUG(debug_level, ("tdb(%s): %s", name ? name : "unnamed", ptr)); - free(ptr); - } -} - -/* destroy the last connection to a tdb */ -static int tdb_wrap_destructor(struct tdb_wrap *w) -{ - tdb_close(w->tdb); - DLIST_REMOVE(tdb_list, w); - return 0; -} - -/* - wrapped connection to a tdb database - to close just talloc_free() the tdb_wrap pointer - */ -struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx, - const char *name, int hash_size, int tdb_flags, - int open_flags, mode_t mode) -{ - struct tdb_wrap *w; - struct tdb_logging_context log_ctx; - log_ctx.log_fn = tdb_wrap_log; - - for (w=tdb_list;w;w=w->next) { - if (strcmp(name, w->name) == 0) { - return talloc_reference(mem_ctx, w); - } - } - - w = talloc(mem_ctx, struct tdb_wrap); - if (w == NULL) { - return NULL; - } - - w->name = talloc_strdup(w, name); - - w->tdb = tdb_open_ex(name, hash_size, tdb_flags, - open_flags, mode, &log_ctx, NULL); - if (w->tdb == NULL) { - talloc_free(w); - return NULL; - } - - talloc_set_destructor(w, tdb_wrap_destructor); - - DLIST_ADD(tdb_list, w); - - return w; -} diff --git a/source4/lib/ldb_wrap.h b/source4/lib/ldb_wrap.h new file mode 100644 index 00000000000..d3ff04b8808 --- /dev/null +++ b/source4/lib/ldb_wrap.h @@ -0,0 +1,41 @@ +/* + Unix SMB/CIFS implementation. + + database wrap headers + + Copyright (C) Andrew Tridgell 2004 + + 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 _LDB_WRAP_H_ +#define _LDB_WRAP_H_ + +struct auth_session_info; +struct ldb_message; +struct ldb_dn; +struct cli_credentials; +struct loadparm_context; + +char *wrap_casefold(void *context, void *mem_ctx, const char *s); + +struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx, + struct loadparm_context *lp_ctx, + const char *url, + struct auth_session_info *session_info, + struct cli_credentials *credentials, + unsigned int flags, + const char *options[]); + +#endif /* _LDB_WRAP_H_ */ diff --git a/source4/lib/messaging/config.mk b/source4/lib/messaging/config.mk index 85a57917032..843851e8531 100644 --- a/source4/lib/messaging/config.mk +++ b/source4/lib/messaging/config.mk @@ -6,7 +6,7 @@ OBJ_FILES = \ messaging.o PUBLIC_DEPENDENCIES = \ LIBSAMBA-UTIL \ - DB_WRAP \ + TDB_WRAP \ NDR_IRPC \ UNIX_PRIVS \ UTIL_TDB \ diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index 963dfe4f0c4..df0bfa32a69 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -27,7 +27,7 @@ #include "lib/socket/socket.h" #include "librpc/gen_ndr/ndr_irpc.h" #include "lib/messaging/irpc.h" -#include "db_wrap.h" +#include "tdb_wrap.h" #include "lib/util/unix_privs.h" #include "librpc/rpc/dcerpc.h" #include "lib/tdb/include/tdb.h" diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c index 4a6ef65bc4d..fdd4c275998 100644 --- a/source4/lib/registry/ldb.c +++ b/source4/lib/registry/ldb.c @@ -21,7 +21,7 @@ #include "registry.h" #include "lib/ldb/include/ldb.h" #include "lib/ldb/include/ldb_errors.h" -#include "db_wrap.h" +#include "ldb_wrap.h" #include "librpc/gen_ndr/winreg.h" #include "param/param.h" diff --git a/source4/lib/tdb_wrap.c b/source4/lib/tdb_wrap.c new file mode 100644 index 00000000000..37095dff2c0 --- /dev/null +++ b/source4/lib/tdb_wrap.c @@ -0,0 +1,117 @@ +/* + Unix SMB/CIFS implementation. + TDB wrap functions + + Copyright (C) Andrew Tridgell 2004 + Copyright (C) Jelmer Vernooij <jelmer@samba.org> 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 + 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 "lib/tdb/include/tdb.h" +#include "lib/util/dlinklist.h" +#include "tdb_wrap.h" +#include "tdb.h" + +static struct tdb_wrap *tdb_list; + +/* destroy the last connection to a tdb */ +static int tdb_wrap_destructor(struct tdb_wrap *w) +{ + tdb_close(w->tdb); + DLIST_REMOVE(tdb_list, w); + return 0; +} + +/* + Log tdb messages via DEBUG(). +*/ +static void tdb_wrap_log(TDB_CONTEXT *tdb, enum tdb_debug_level level, + const char *format, ...) PRINTF_ATTRIBUTE(3,4); + +static void tdb_wrap_log(TDB_CONTEXT *tdb, enum tdb_debug_level level, + const char *format, ...) +{ + va_list ap; + char *ptr = NULL; + int debug_level; + + va_start(ap, format); + vasprintf(&ptr, format, ap); + va_end(ap); + + switch (level) { + case TDB_DEBUG_FATAL: + debug_level = 0; + break; + case TDB_DEBUG_ERROR: + debug_level = 1; + break; + case TDB_DEBUG_WARNING: + debug_level = 2; + break; + case TDB_DEBUG_TRACE: + debug_level = 5; + break; + default: + debug_level = 0; + } + + if (ptr != NULL) { + const char *name = tdb_name(tdb); + DEBUG(debug_level, ("tdb(%s): %s", name ? name : "unnamed", ptr)); + free(ptr); + } +} + + +/* + wrapped connection to a tdb database + to close just talloc_free() the tdb_wrap pointer + */ +struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx, + const char *name, int hash_size, int tdb_flags, + int open_flags, mode_t mode) +{ + struct tdb_wrap *w; + struct tdb_logging_context log_ctx; + log_ctx.log_fn = tdb_wrap_log; + + for (w=tdb_list;w;w=w->next) { + if (strcmp(name, w->name) == 0) { + return talloc_reference(mem_ctx, w); + } + } + + w = talloc(mem_ctx, struct tdb_wrap); + if (w == NULL) { + return NULL; + } + + w->name = talloc_strdup(w, name); + + w->tdb = tdb_open_ex(name, hash_size, tdb_flags, + open_flags, mode, &log_ctx, NULL); + if (w->tdb == NULL) { + talloc_free(w); + return NULL; + } + + talloc_set_destructor(w, tdb_wrap_destructor); + + DLIST_ADD(tdb_list, w); + + return w; +} diff --git a/source4/lib/db_wrap.h b/source4/lib/tdb_wrap.h index b45a05c24f5..bb36cabd40f 100644 --- a/source4/lib/db_wrap.h +++ b/source4/lib/tdb_wrap.h @@ -19,6 +19,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#ifndef _TDB_WRAP_H_ +#define _TDB_WRAP_H_ + +#include "tdb.h" struct tdb_wrap { struct tdb_context *tdb; @@ -27,10 +31,8 @@ struct tdb_wrap { struct tdb_wrap *next, *prev; }; -struct auth_session_info; -struct ldb_message; -struct ldb_dn; -struct cli_credentials; -struct loadparm_context; +struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx, + const char *name, int hash_size, int tdb_flags, + int open_flags, mode_t mode); -#include "lib/db_wrap_proto.h" +#endif /* _TDB_WRAP_H_ */ diff --git a/source4/lib/util/config.mk b/source4/lib/util/config.mk index 0691bd7889d..01ad14aa95b 100644 --- a/source4/lib/util/config.mk +++ b/source4/lib/util/config.mk @@ -49,12 +49,14 @@ PUBLIC_DEPENDENCIES = XATTR # End SUBSYSTEM WRAP_XATTR ################################################ -################################################ -# Start SUBSYSTEM UTIL_TDB [SUBSYSTEM::UTIL_TDB] PUBLIC_PROTO_HEADER = util_tdb.h OBJ_FILES = \ util_tdb.o PUBLIC_DEPENDENCIES = LIBTDB -# End SUBSYSTEM UTIL_TDB -################################################ + +[SUBSYSTEM::UTIL_LDB] +PUBLIC_PROTO_HEADER = util_ldb.h +OBJ_FILES = \ + util_ldb.o +PUBLIC_DEPENDENCIES = LIBLDB diff --git a/source4/lib/gendb.c b/source4/lib/util/util_ldb.c index 35b55a1fd75..ba8443c2364 100644 --- a/source4/lib/gendb.c +++ b/source4/lib/util/util_ldb.c @@ -23,7 +23,6 @@ #include "includes.h" #include "lib/ldb/include/ldb.h" #include "lib/ldb/include/ldb_errors.h" -#include "lib/db_wrap.h" /* search the sam for the specified attributes - va_list variant @@ -123,3 +122,10 @@ int gendb_add_ldif(struct ldb_context *ldb, const char *ldif_string) talloc_free(ldif); return ret; } + +char *wrap_casefold(void *context, void *mem_ctx, const char *s) +{ + return strupper_talloc(mem_ctx, s); +} + + diff --git a/source4/lib/util/util_ldb.h b/source4/lib/util/util_ldb.h new file mode 100644 index 00000000000..f4f56d6b181 --- /dev/null +++ b/source4/lib/util/util_ldb.h @@ -0,0 +1,55 @@ +#ifndef __LIB_UTIL_UTIL_LDB_H__ +#define __LIB_UTIL_UTIL_LDB_H__ + +#undef _PRINTF_ATTRIBUTE +#define _PRINTF_ATTRIBUTE(a1, a2) PRINTF_ATTRIBUTE(a1, a2) +/* This file was automatically generated by mkproto.pl. DO NOT EDIT */ + +#ifndef _PUBLIC_ +#define _PUBLIC_ +#endif + +#ifndef _PURE_ +#define _PURE_ +#endif + +#ifndef _NORETURN_ +#define _NORETURN_ +#endif + +#ifndef _DEPRECATED_ +#define _DEPRECATED_ +#endif + +#ifndef _WARN_UNUSED_RESULT_ +#define _WARN_UNUSED_RESULT_ +#endif + + +/* The following definitions come from lib/util/util_ldb.c */ + +int gendb_search_v(struct ldb_context *ldb, + TALLOC_CTX *mem_ctx, + struct ldb_dn *basedn, + struct ldb_message ***msgs, + const char * const *attrs, + const char *format, + va_list ap) _PRINTF_ATTRIBUTE(6,0); +int gendb_search(struct ldb_context *ldb, + TALLOC_CTX *mem_ctx, + struct ldb_dn *basedn, + struct ldb_message ***res, + const char * const *attrs, + const char *format, ...) _PRINTF_ATTRIBUTE(6,7); +int gendb_search_dn(struct ldb_context *ldb, + TALLOC_CTX *mem_ctx, + struct ldb_dn *dn, + struct ldb_message ***res, + const char * const *attrs); +int gendb_add_ldif(struct ldb_context *ldb, const char *ldif_string); +char *wrap_casefold(void *context, void *mem_ctx, const char *s); +#undef _PRINTF_ATTRIBUTE +#define _PRINTF_ATTRIBUTE(a1, a2) + +#endif /* __LIB_UTIL_UTIL_LDB_H__ */ + diff --git a/source4/libnet/libnet_become_dc.c b/source4/libnet/libnet_become_dc.c index 7cf2eca1dbb..2673af8e0fd 100644 --- a/source4/libnet/libnet_become_dc.c +++ b/source4/libnet/libnet_become_dc.c @@ -23,7 +23,7 @@ #include "libcli/cldap/cldap.h" #include "lib/ldb/include/ldb.h" #include "lib/ldb/include/ldb_errors.h" -#include "lib/db_wrap.h" +#include "lib/ldb_wrap.h" #include "dsdb/samdb/samdb.h" #include "dsdb/common/flags.h" #include "librpc/gen_ndr/ndr_drsuapi_c.h" diff --git a/source4/libnet/libnet_join.c b/source4/libnet/libnet_join.c index 4abd2954f88..215217bfef4 100644 --- a/source4/libnet/libnet_join.c +++ b/source4/libnet/libnet_join.c @@ -26,7 +26,8 @@ #include "lib/ldb/include/ldb_errors.h" #include "param/secrets.h" #include "dsdb/samdb/samdb.h" -#include "db_wrap.h" +#include "ldb_wrap.h" +#include "util/util_ldb.h" #include "libcli/security/security.h" #include "auth/credentials/credentials.h" #include "auth/credentials/credentials_krb5.h" diff --git a/source4/libnet/libnet_samsync_ldb.c b/source4/libnet/libnet_samsync_ldb.c index 72b6a392399..86e5af2d6ed 100644 --- a/source4/libnet/libnet_samsync_ldb.c +++ b/source4/libnet/libnet_samsync_ldb.c @@ -27,8 +27,9 @@ #include "libcli/ldap/ldap.h" #include "dsdb/samdb/samdb.h" #include "auth/auth.h" +#include "util/util_ldb.h" #include "librpc/gen_ndr/ndr_misc.h" -#include "db_wrap.h" +#include "ldb_wrap.h" #include "libcli/security/security.h" #include "librpc/rpc/dcerpc.h" #include "param/param.h" diff --git a/source4/libnet/libnet_unbecome_dc.c b/source4/libnet/libnet_unbecome_dc.c index 40b1aab2152..8b27d857188 100644 --- a/source4/libnet/libnet_unbecome_dc.c +++ b/source4/libnet/libnet_unbecome_dc.c @@ -23,7 +23,7 @@ #include "libcli/cldap/cldap.h" #include "lib/ldb/include/ldb.h" #include "lib/ldb/include/ldb_errors.h" -#include "lib/db_wrap.h" +#include "lib/ldb_wrap.h" #include "dsdb/samdb/samdb.h" #include "dsdb/common/flags.h" #include "librpc/gen_ndr/ndr_drsuapi_c.h" diff --git a/source4/nbt_server/dgram/netlogon.c b/source4/nbt_server/dgram/netlogon.c index 2f96970a65e..86720283488 100644 --- a/source4/nbt_server/dgram/netlogon.c +++ b/source4/nbt_server/dgram/netlogon.c @@ -25,7 +25,7 @@ #include "lib/ldb/include/ldb.h" #include "dsdb/samdb/samdb.h" #include "auth/auth.h" -#include "db_wrap.h" +#include "util/util_ldb.h" #include "librpc/gen_ndr/ndr_nbt.h" #include "param/param.h" diff --git a/source4/nbt_server/wins/winsdb.c b/source4/nbt_server/wins/winsdb.c index 91996b24d38..6ba03638245 100644 --- a/source4/nbt_server/wins/winsdb.c +++ b/source4/nbt_server/wins/winsdb.c @@ -27,7 +27,7 @@ #include "lib/ldb/include/ldb_errors.h" #include "librpc/gen_ndr/ndr_nbt.h" #include "system/time.h" -#include "db_wrap.h" +#include "ldb_wrap.h" #include "system/network.h" #include "lib/socket/netif.h" #include "param/param.h" diff --git a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c index 2544e9eb972..e59d84ff919 100644 --- a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c +++ b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c @@ -33,7 +33,8 @@ #include "lib/ldb/include/ldb.h" #include "auth/auth.h" #include "dsdb/samdb/samdb.h" -#include "db_wrap.h" +#include "ldb_wrap.h" +#include "util/util_ldb.h" #include "rpc_server/common/common.h" #include "param/param.h" diff --git a/source4/ntvfs/common/brlock.c b/source4/ntvfs/common/brlock.c index 27d7437f4ff..ddf3219a9a0 100644 --- a/source4/ntvfs/common/brlock.c +++ b/source4/ntvfs/common/brlock.c @@ -28,7 +28,6 @@ #include "system/filesys.h" #include "lib/tdb/include/tdb.h" #include "messaging/messaging.h" -#include "db_wrap.h" #include "lib/messaging/irpc.h" #include "libcli/libcli.h" #include "cluster/cluster.h" diff --git a/source4/ntvfs/common/notify.c b/source4/ntvfs/common/notify.c index 4578dfbf100..16cf4e4b542 100644 --- a/source4/ntvfs/common/notify.c +++ b/source4/ntvfs/common/notify.c @@ -28,7 +28,7 @@ #include "lib/tdb/include/tdb.h" #include "lib/util/util_tdb.h" #include "messaging/messaging.h" -#include "db_wrap.h" +#include "tdb_wrap.h" #include "lib/messaging/irpc.h" #include "librpc/gen_ndr/ndr_notify.h" #include "lib/util/dlinklist.h" diff --git a/source4/ntvfs/common/opendb_tdb.c b/source4/ntvfs/common/opendb_tdb.c index 07eef829e13..9926bf8d3ef 100644 --- a/source4/ntvfs/common/opendb_tdb.c +++ b/source4/ntvfs/common/opendb_tdb.c @@ -41,7 +41,7 @@ #include "system/filesys.h" #include "lib/tdb/include/tdb.h" #include "messaging/messaging.h" -#include "db_wrap.h" +#include "tdb_wrap.h" #include "lib/messaging/irpc.h" #include "librpc/gen_ndr/ndr_opendb.h" #include "ntvfs/ntvfs.h" diff --git a/source4/ntvfs/posix/vfs_posix.c b/source4/ntvfs/posix/vfs_posix.c index 208c9e62b70..24aa023de5f 100644 --- a/source4/ntvfs/posix/vfs_posix.c +++ b/source4/ntvfs/posix/vfs_posix.c @@ -27,7 +27,8 @@ #include "vfs_posix.h" #include "librpc/gen_ndr/security.h" #include "lib/tdb/include/tdb.h" -#include "db_wrap.h" +#include "tdb_wrap.h" +#include "util/util_ldb.h" #include "libcli/security/security.h" #include "lib/events/events.h" diff --git a/source4/ntvfs/posix/xattr_tdb.c b/source4/ntvfs/posix/xattr_tdb.c index b49b11a72da..1113ac1739c 100644 --- a/source4/ntvfs/posix/xattr_tdb.c +++ b/source4/ntvfs/posix/xattr_tdb.c @@ -22,7 +22,7 @@ #include "includes.h" #include "vfs_posix.h" #include "lib/tdb/include/tdb.h" -#include "db_wrap.h" +#include "tdb_wrap.h" #define XATTR_LIST_ATTR ".xattr_list" diff --git a/source4/param/config.mk b/source4/param/config.mk index 5ed10972960..7082a8bca3d 100644 --- a/source4/param/config.mk +++ b/source4/param/config.mk @@ -47,4 +47,4 @@ PRIVATE_DEPENDENCIES = LIBLDB [SUBSYSTEM::SECRETS] OBJ_FILES = secrets.o -PRIVATE_DEPENDENCIES = DB_WRAP UTIL_TDB +PRIVATE_DEPENDENCIES = LDB_WRAP UTIL_TDB diff --git a/source4/param/secrets.c b/source4/param/secrets.c index 6640fd473d9..aea27d1cfc1 100644 --- a/source4/param/secrets.c +++ b/source4/param/secrets.c @@ -25,10 +25,12 @@ #include "secrets.h" #include "param/param.h" #include "system/filesys.h" -#include "db_wrap.h" +#include "tdb_wrap.h" +#include "ldb_wrap.h" #include "lib/ldb/include/ldb.h" #include "lib/tdb/include/tdb.h" #include "lib/util/util_tdb.h" +#include "lib/util/util_ldb.h" #include "dsdb/samdb/samdb.h" static struct tdb_wrap *tdb; diff --git a/source4/param/share_ldb.c b/source4/param/share_ldb.c index 019b1616391..ece9c0544b2 100644 --- a/source4/param/share_ldb.c +++ b/source4/param/share_ldb.c @@ -23,7 +23,7 @@ #include "ldb/include/ldb.h" #include "ldb/include/ldb_errors.h" #include "auth/auth.h" -#include "db_wrap.h" +#include "ldb_wrap.h" #include "param/share.h" #include "param/param.h" diff --git a/source4/rpc_server/lsa/dcesrv_lsa.c b/source4/rpc_server/lsa/dcesrv_lsa.c index 25d6f8c8f71..0b426145c6f 100644 --- a/source4/rpc_server/lsa/dcesrv_lsa.c +++ b/source4/rpc_server/lsa/dcesrv_lsa.c @@ -21,6 +21,7 @@ */ #include "rpc_server/lsa/lsa.h" +#include "util/util_ldb.h" /* this type allows us to distinguish handle types diff --git a/source4/rpc_server/lsa/lsa.h b/source4/rpc_server/lsa/lsa.h index 6ecda0ff820..3959311b99b 100644 --- a/source4/rpc_server/lsa/lsa.h +++ b/source4/rpc_server/lsa/lsa.h @@ -30,7 +30,7 @@ #include "libcli/security/security.h" #include "libcli/auth/libcli_auth.h" #include "param/secrets.h" -#include "db_wrap.h" +#include "util/util_ldb.h" #include "librpc/gen_ndr/ndr_dssetup.h" #include "param/param.h" diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c index 7bee070251f..b8f0103901e 100644 --- a/source4/rpc_server/netlogon/dcerpc_netlogon.c +++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c @@ -28,7 +28,7 @@ #include "auth/auth_sam.h" #include "dsdb/samdb/samdb.h" #include "rpc_server/samr/proto.h" -#include "db_wrap.h" +#include "util/util_ldb.h" #include "libcli/auth/libcli_auth.h" #include "auth/gensec/schannel_state.h" #include "libcli/security/security.h" diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c index 0ec979b81f3..e0d965da9e4 100644 --- a/source4/rpc_server/samr/dcesrv_samr.c +++ b/source4/rpc_server/samr/dcesrv_samr.c @@ -34,7 +34,7 @@ #include "libcli/ldap/ldap.h" #include "libcli/security/security.h" #include "rpc_server/samr/proto.h" -#include "db_wrap.h" +#include "util/util_ldb.h" #include "param/param.h" /* these query macros make samr_Query[User|Group]Info a bit easier to read */ diff --git a/source4/rpc_server/samr/samr_password.c b/source4/rpc_server/samr/samr_password.c index 28816c03f8e..a38f9840b66 100644 --- a/source4/rpc_server/samr/samr_password.c +++ b/source4/rpc_server/samr/samr_password.c @@ -32,7 +32,7 @@ #include "auth/auth.h" #include "rpc_server/samr/proto.h" #include "libcli/auth/libcli_auth.h" -#include "db_wrap.h" +#include "util/util_ldb.h" /* samr_ChangePasswordUser diff --git a/source4/scripting/ejs/smbcalls_ldb.c b/source4/scripting/ejs/smbcalls_ldb.c index 04162830b4d..b8c35d267ed 100644 --- a/source4/scripting/ejs/smbcalls_ldb.c +++ b/source4/scripting/ejs/smbcalls_ldb.c @@ -25,7 +25,7 @@ #include "lib/appweb/ejs/ejs.h" #include "lib/ldb/include/ldb.h" #include "lib/ldb/include/ldb_errors.h" -#include "db_wrap.h" +#include "ldb_wrap.h" #include "dsdb/samdb/samdb.h" #include "librpc/ndr/libndr.h" diff --git a/source4/scripting/ejs/smbcalls_reg.c b/source4/scripting/ejs/smbcalls_reg.c index d4b13cc2ca5..38634b996c9 100644 --- a/source4/scripting/ejs/smbcalls_reg.c +++ b/source4/scripting/ejs/smbcalls_reg.c @@ -22,7 +22,6 @@ #include "includes.h" #include "scripting/ejs/smbcalls.h" #include "lib/appweb/ejs/ejs.h" -#include "db_wrap.h" #include "dsdb/samdb/samdb.h" #include "librpc/ndr/libndr.h" #include "lib/registry/registry.h" diff --git a/source4/torture/ldap/schema.c b/source4/torture/ldap/schema.c index 30fd9877e63..9d9195bb9d7 100644 --- a/source4/torture/ldap/schema.c +++ b/source4/torture/ldap/schema.c @@ -22,7 +22,7 @@ #include "includes.h" #include "libcli/ldap/ldap_client.h" #include "lib/cmdline/popt_common.h" -#include "db_wrap.h" +#include "ldb_wrap.h" #include "lib/ldb/include/ldb.h" #include "lib/ldb/include/ldb_errors.h" #include "dsdb/samdb/samdb.h" diff --git a/source4/torture/ldap/uptodatevector.c b/source4/torture/ldap/uptodatevector.c index 7b1614af522..aa473ff5cf7 100644 --- a/source4/torture/ldap/uptodatevector.c +++ b/source4/torture/ldap/uptodatevector.c @@ -22,7 +22,7 @@ #include "includes.h" #include "libcli/ldap/ldap_client.h" #include "lib/cmdline/popt_common.h" -#include "db_wrap.h" +#include "ldb_wrap.h" #include "lib/ldb/include/ldb.h" #include "lib/ldb/include/ldb_errors.h" #include "dsdb/samdb/samdb.h" diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c index 65d4deaaa4a..ef8e4d03c09 100644 --- a/source4/torture/libnet/libnet_BecomeDC.c +++ b/source4/torture/libnet/libnet_BecomeDC.c @@ -35,7 +35,7 @@ #include "librpc/gen_ndr/ndr_misc.h" #include "system/time.h" #include "auth/auth.h" -#include "lib/db_wrap.h" +#include "lib/ldb_wrap.h" #include "lib/appweb/ejs/ejs.h" #include "lib/appweb/ejs/ejsInternal.h" #include "scripting/ejs/smbcalls.h" diff --git a/source4/torture/local/dbspeed.c b/source4/torture/local/dbspeed.c index 34458123650..8bef01c20ac 100644 --- a/source4/torture/local/dbspeed.c +++ b/source4/torture/local/dbspeed.c @@ -24,7 +24,8 @@ #include "lib/tdb/include/tdb.h" #include "lib/ldb/include/ldb.h" #include "lib/ldb/include/ldb_errors.h" -#include "lib/db_wrap.h" +#include "lib/ldb_wrap.h" +#include "lib/tdb_wrap.h" #include "torture/torture.h" #include "param/param.h" diff --git a/source4/torture/rpc/spoolss_notify.c b/source4/torture/rpc/spoolss_notify.c index bffbd1108cd..2547f8ce001 100644 --- a/source4/torture/rpc/spoolss_notify.c +++ b/source4/torture/rpc/spoolss_notify.c @@ -29,7 +29,7 @@ #include "smbd/process_model.h" #include "smb_server/smb_server.h" #include "lib/socket/netif.h" -#include "dlinklist.h" +#include "util/dlinklist.h" #include "ntvfs/ntvfs.h" #include "param/param.h" diff --git a/source4/wrepl_server/wrepl_server.c b/source4/wrepl_server/wrepl_server.c index be606b2a0cc..834d9a70e81 100644 --- a/source4/wrepl_server/wrepl_server.c +++ b/source4/wrepl_server/wrepl_server.c @@ -30,7 +30,7 @@ #include "ldb/include/ldb.h" #include "ldb/include/ldb_errors.h" #include "auth/auth.h" -#include "db_wrap.h" +#include "ldb_wrap.h" #include "param/param.h" static struct ldb_context *wins_config_db_connect(TALLOC_CTX *mem_ctx) |