From a3f61dea40d8a907d56abe1c0eee980f78228b79 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Sun, 17 Oct 2010 14:27:18 +0200 Subject: Revert "s4:remove "util_ldb" submodule and integrate the three gendb_* calls in "dsdb/common/util.c"" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 8a2ce5c47cee499f90b125ebde83de5f9f1a9aa0. Jelmer pointed out that these are also in use by other LDB databases - not only SAMDB ones. Autobuild-User: Matthias Dieter Wallnöfer Autobuild-Date: Sun Oct 17 13:37:16 UTC 2010 on sn-devel-104 --- source4/auth/config.mk | 2 +- source4/auth/credentials/config.mk | 2 +- source4/auth/credentials/credentials_secrets.c | 1 + source4/auth/ntlm/auth_sam.c | 1 + source4/auth/wscript_build | 2 +- source4/dsdb/common/util.c | 87 +------------------------- source4/dsdb/samdb/cracknames.c | 1 + source4/dsdb/samdb/ldb_modules/samba3sid.c | 1 + source4/dsdb/samdb/ldb_modules/samldb.c | 1 + source4/dsdb/samdb/samdb.c | 1 + source4/dsdb/samdb/samdb_privilege.c | 1 + source4/dsdb/wscript_build | 2 +- source4/headermap.txt | 1 + source4/kdc/db-glue.c | 1 + source4/kdc/kpasswdd.c | 1 + source4/lib/basic.mk | 2 +- source4/lib/ldb-samba/wscript_build | 2 +- source4/libnet/libnet_join.c | 1 + source4/libnet/libnet_samsync_ldb.c | 1 + source4/nbt_server/dgram/netlogon.c | 1 + source4/ntptr/simple_ldb/ntptr_simple_ldb.c | 1 + source4/rpc_server/lsa/lsa.h | 1 + source4/rpc_server/netlogon/dcerpc_netlogon.c | 1 + source4/rpc_server/samr/dcesrv_samr.c | 1 + source4/rpc_server/samr/samr_password.c | 1 + source4/torture/rpc/netlogon.c | 1 + source4/utils/net/drs/net_drs_showrepl.c | 1 + 27 files changed, 27 insertions(+), 92 deletions(-) (limited to 'source4') diff --git a/source4/auth/config.mk b/source4/auth/config.mk index 58d7ed43ca..573f1972bc 100644 --- a/source4/auth/config.mk +++ b/source4/auth/config.mk @@ -29,7 +29,7 @@ auth_system_session_OBJ_FILES = $(addprefix $(authsrcdir)/, system_session.o) $(eval $(call proto_header_template,$(authsrcdir)/system_session_proto.h,$(auth_system_session_OBJ_FILES:.o=.c))) [SUBSYSTEM::auth_sam] -PUBLIC_DEPENDENCIES = SAMDB LIBSECURITY +PUBLIC_DEPENDENCIES = SAMDB UTIL_LDB LIBSECURITY PRIVATE_DEPENDENCIES = LDAP_ENCODE auth_sam_OBJ_FILES = $(addprefix $(authsrcdir)/, sam.o) diff --git a/source4/auth/credentials/config.mk b/source4/auth/credentials/config.mk index 2d3518017d..9762966bff 100644 --- a/source4/auth/credentials/config.mk +++ b/source4/auth/credentials/config.mk @@ -2,7 +2,7 @@ # Start SUBSYSTEM CREDENTIALS [SUBSYSTEM::CREDENTIALS] PUBLIC_DEPENDENCIES = \ - LIBCLI_AUTH SECRETS LIBCRYPTO KERBEROS HEIMDAL_GSSAPI + LIBCLI_AUTH SECRETS LIBCRYPTO KERBEROS UTIL_LDB HEIMDAL_GSSAPI PRIVATE_DEPENDENCIES = \ SECRETS SAMDB diff --git a/source4/auth/credentials/credentials_secrets.c b/source4/auth/credentials/credentials_secrets.c index 210590caff..8c8043cad7 100644 --- a/source4/auth/credentials/credentials_secrets.c +++ b/source4/auth/credentials/credentials_secrets.c @@ -27,6 +27,7 @@ #include "librpc/gen_ndr/samr.h" /* for struct samrPassword */ #include "param/secrets.h" #include "system/filesys.h" +#include "../lib/util/util_ldb.h" #include "auth/credentials/credentials.h" #include "auth/credentials/credentials_krb5.h" #include "auth/kerberos/kerberos_util.h" diff --git a/source4/auth/ntlm/auth_sam.c b/source4/auth/ntlm/auth_sam.c index 259efec8e5..8de33ffa78 100644 --- a/source4/auth/ntlm/auth_sam.c +++ b/source4/auth/ntlm/auth_sam.c @@ -22,6 +22,7 @@ #include "includes.h" #include "system/time.h" #include "lib/ldb/include/ldb.h" +#include "../lib/util/util_ldb.h" #include "libcli/ldap/ldap_ndr.h" #include "libcli/security/security.h" #include "auth/auth.h" diff --git a/source4/auth/wscript_build b/source4/auth/wscript_build index e44a0324f9..38fb1b7707 100644 --- a/source4/auth/wscript_build +++ b/source4/auth/wscript_build @@ -33,7 +33,7 @@ bld.SAMBA_SUBSYSTEM('auth_system_session', bld.SAMBA_SUBSYSTEM('auth_sam', source='sam.c', autoproto='auth_sam.h', - public_deps='SAMDB LIBSECURITY ldb tevent', + public_deps='SAMDB UTIL_LDB LIBSECURITY ldb tevent', deps='' ) diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c index b7f6b69fce..9e6ccbc911 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -26,6 +26,7 @@ #include "ldb.h" #include "ldb_module.h" #include "ldb_errors.h" +#include "../lib/util/util_ldb.h" #include "../lib/crypto/crypto.h" #include "dsdb/samdb/samdb.h" #include "libcli/security/security.h" @@ -43,92 +44,6 @@ #include "lib/socket/socket.h" #include "librpc/gen_ndr/irpc.h" -/* - * search the SAMDB for the specified attributes - va_list variant - */ -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) -{ - enum ldb_scope scope = LDB_SCOPE_SUBTREE; - struct ldb_result *res; - char *expr = NULL; - int ret; - - if (format) { - expr = talloc_vasprintf(mem_ctx, format, ap); - if (expr == NULL) { - return -1; - } - } else { - scope = LDB_SCOPE_BASE; - } - - res = NULL; - - ret = ldb_search(ldb, mem_ctx, &res, basedn, scope, attrs, - expr?"%s":NULL, expr); - - if (ret == LDB_SUCCESS) { - talloc_steal(mem_ctx, res->msgs); - - DEBUG(6,("gendb_search_v: %s %s -> %d\n", - basedn?ldb_dn_get_linearized(basedn):"NULL", - expr?expr:"NULL", res->count)); - - ret = res->count; - *msgs = res->msgs; - talloc_free(res); - } else if (scope == LDB_SCOPE_BASE && ret == LDB_ERR_NO_SUCH_OBJECT) { - ret = 0; - *msgs = NULL; - } else { - DEBUG(4,("gendb_search_v: search failed: %s\n", - ldb_errstring(ldb))); - ret = -1; - } - - talloc_free(expr); - - return ret; -} - -/* - * search the SAMDB for the specified attributes - varargs variant - */ -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, ...) -{ - va_list ap; - int count; - - va_start(ap, format); - count = gendb_search_v(ldb, mem_ctx, basedn, res, attrs, format, ap); - va_end(ap); - - return count; -} - -/* - * search the SAMDB for a specified record (by DN) - */ -int gendb_search_dn(struct ldb_context *ldb, - TALLOC_CTX *mem_ctx, - struct ldb_dn *dn, - struct ldb_message ***res, - const char * const *attrs) -{ - return gendb_search(ldb, mem_ctx, dn, res, attrs, NULL); -} - /* search the sam for the specified attributes in a specific domain, filter on objectSid being in domain_sid. diff --git a/source4/dsdb/samdb/cracknames.c b/source4/dsdb/samdb/cracknames.c index d4b122056b..6df140fed3 100644 --- a/source4/dsdb/samdb/cracknames.c +++ b/source4/dsdb/samdb/cracknames.c @@ -32,6 +32,7 @@ #include "libcli/ldap/ldap_ndr.h" #include "libcli/security/security.h" #include "auth/auth.h" +#include "../lib/util/util_ldb.h" #include "dsdb/samdb/samdb.h" #include "dsdb/common/util.h" #include "param/param.h" diff --git a/source4/dsdb/samdb/ldb_modules/samba3sid.c b/source4/dsdb/samdb/ldb_modules/samba3sid.c index f6db0d1948..a5b3df185c 100644 --- a/source4/dsdb/samdb/ldb_modules/samba3sid.c +++ b/source4/dsdb/samdb/ldb_modules/samba3sid.c @@ -29,6 +29,7 @@ #include "dsdb/samdb/ldb_modules/util.h" #include "libcli/security/security.h" #include "librpc/gen_ndr/ndr_security.h" +#include "../lib/util/util_ldb.h" #include "ldb_wrap.h" #include "param/param.h" diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c index 8db93b2a8a..3a971e80c5 100644 --- a/source4/dsdb/samdb/ldb_modules/samldb.c +++ b/source4/dsdb/samdb/ldb_modules/samldb.c @@ -37,6 +37,7 @@ #include "dsdb/samdb/ldb_modules/ridalloc.h" #include "libcli/security/security.h" #include "librpc/gen_ndr/ndr_security.h" +#include "../lib/util/util_ldb.h" #include "ldb_wrap.h" #include "param/param.h" diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c index 93fc122d21..c7d2c3085d 100644 --- a/source4/dsdb/samdb/samdb.c +++ b/source4/dsdb/samdb/samdb.c @@ -34,6 +34,7 @@ #include "system/time.h" #include "system/filesys.h" #include "ldb_wrap.h" +#include "../lib/util/util_ldb.h" #include "dsdb/samdb/samdb.h" #include "../libds/common/flags.h" #include "param/param.h" diff --git a/source4/dsdb/samdb/samdb_privilege.c b/source4/dsdb/samdb/samdb_privilege.c index e6d9a9a032..69c4ebea61 100644 --- a/source4/dsdb/samdb/samdb_privilege.c +++ b/source4/dsdb/samdb/samdb_privilege.c @@ -24,6 +24,7 @@ #include "dsdb/samdb/samdb.h" #include "auth/auth.h" #include "libcli/security/security.h" +#include "../lib/util/util_ldb.h" #include "param/param.h" #include "ldb_wrap.h" diff --git a/source4/dsdb/wscript_build b/source4/dsdb/wscript_build index 832adb7d1d..db2f38b1b1 100644 --- a/source4/dsdb/wscript_build +++ b/source4/dsdb/wscript_build @@ -14,7 +14,7 @@ bld.SAMBA_LIBRARY('SAMDB', bld.SAMBA_SUBSYSTEM('SAMDB_COMMON', source='common/util.c common/util_samr.c common/dsdb_dn.c common/dsdb_access.c ../../libds/common/flag_mapping.c', autoproto='common/proto.h', - deps='ldb NDR_DRSBLOBS LIBCLI_LDAP_NDR LIBCLI_AUTH LIBTSOCKET samba_socket LIBSAMBA-HOSTCONFIG' + deps='ldb NDR_DRSBLOBS LIBCLI_LDAP_NDR UTIL_LDB LIBCLI_AUTH LIBTSOCKET samba_socket LIBSAMBA-HOSTCONFIG' ) diff --git a/source4/headermap.txt b/source4/headermap.txt index dbf18cbf35..e8dbbce7cb 100644 --- a/source4/headermap.txt +++ b/source4/headermap.txt @@ -51,6 +51,7 @@ lib/ldb_wrap.h: ldb_wrap.h torture/smbtorture.h: smbtorture.h param/share.h: share.h ../lib/util/util_tdb.h: util_tdb.h +../lib/util/util_ldb.h: util_ldb.h ../lib/util/wrap_xattr.h: wrap_xattr.h ../libcli/ldap/ldap_message.h: ldap_message.h ../libcli/ldap/ldap_errors.h: ldap_errors.h diff --git a/source4/kdc/db-glue.c b/source4/kdc/db-glue.c index e9ae5b3486..9d6a230b99 100644 --- a/source4/kdc/db-glue.c +++ b/source4/kdc/db-glue.c @@ -30,6 +30,7 @@ #include "auth/auth.h" #include "auth/credentials/credentials.h" #include "auth/auth_sam.h" +#include "../lib/util/util_ldb.h" #include "dsdb/samdb/samdb.h" #include "dsdb/common/util.h" #include "librpc/ndr/libndr.h" diff --git a/source4/kdc/kpasswdd.c b/source4/kdc/kpasswdd.c index bddc0a9069..5254b62384 100644 --- a/source4/kdc/kpasswdd.c +++ b/source4/kdc/kpasswdd.c @@ -33,6 +33,7 @@ #include "auth/credentials/credentials_krb5.h" #include "auth/auth.h" #include "dsdb/samdb/samdb.h" +#include "../lib/util/util_ldb.h" #include "rpc_server/dcerpc_server.h" #include "rpc_server/samr/proto.h" #include "libcli/security/security.h" diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk index 7df92d432d..4b40ed41d4 100644 --- a/source4/lib/basic.mk +++ b/source4/lib/basic.mk @@ -11,7 +11,7 @@ GENCACHE_OBJ_FILES = $(libgencachesrcdir)/gencache.o [SUBSYSTEM::LDB_WRAP] PUBLIC_DEPENDENCIES = LIBLDB -PRIVATE_DEPENDENCIES = LDBSAMBA +PRIVATE_DEPENDENCIES = LDBSAMBA UTIL_LDB LDB_WRAP_OBJ_FILES = $(libsrcdir)/ldb_wrap.o PUBLIC_HEADERS += $(libsrcdir)/ldb_wrap.h diff --git a/source4/lib/ldb-samba/wscript_build b/source4/lib/ldb-samba/wscript_build index a2ac32bdbe..fd07fd1aff 100644 --- a/source4/lib/ldb-samba/wscript_build +++ b/source4/lib/ldb-samba/wscript_build @@ -9,7 +9,7 @@ bld.SAMBA_SUBSYSTEM('LDBSAMBA', autoproto='ldif_handlers_proto.h', public_deps='ldb', public_headers='ldb_wrap.h', - deps='LIBSECURITY LIBNDR NDR_DRSBLOBS CREDENTIALS NDR_DNSP SAMDB' + deps='LIBSECURITY LIBNDR NDR_DRSBLOBS CREDENTIALS UTIL_LDB NDR_DNSP SAMDB' ) diff --git a/source4/libnet/libnet_join.c b/source4/libnet/libnet_join.c index 6c030be728..da2110842b 100644 --- a/source4/libnet/libnet_join.c +++ b/source4/libnet/libnet_join.c @@ -27,6 +27,7 @@ #include "param/secrets.h" #include "dsdb/samdb/samdb.h" #include "ldb_wrap.h" +#include "../lib/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 fc53c36823..917257de85 100644 --- a/source4/libnet/libnet_samsync_ldb.c +++ b/source4/libnet/libnet_samsync_ldb.c @@ -27,6 +27,7 @@ #include "libcli/ldap/ldap_ndr.h" #include "dsdb/samdb/samdb.h" #include "auth/auth.h" +#include "../lib/util/util_ldb.h" #include "librpc/gen_ndr/ndr_misc.h" #include "ldb_wrap.h" #include "libcli/security/security.h" diff --git a/source4/nbt_server/dgram/netlogon.c b/source4/nbt_server/dgram/netlogon.c index 81ee4c60ea..8e231ccc23 100644 --- a/source4/nbt_server/dgram/netlogon.c +++ b/source4/nbt_server/dgram/netlogon.c @@ -26,6 +26,7 @@ #include "lib/ldb/include/ldb.h" #include "dsdb/samdb/samdb.h" #include "auth/auth.h" +#include "../lib/util/util_ldb.h" #include "param/param.h" #include "smbd/service_task.h" #include "cldap_server/cldap_server.h" diff --git a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c index bdf5b6f8b6..2790f8359d 100644 --- a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c +++ b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c @@ -34,6 +34,7 @@ #include "auth/auth.h" #include "dsdb/samdb/samdb.h" #include "ldb_wrap.h" +#include "../lib/util/util_ldb.h" #include "rpc_server/common/common.h" #include "param/param.h" diff --git a/source4/rpc_server/lsa/lsa.h b/source4/rpc_server/lsa/lsa.h index 8edd570b98..53fe102630 100644 --- a/source4/rpc_server/lsa/lsa.h +++ b/source4/rpc_server/lsa/lsa.h @@ -30,6 +30,7 @@ #include "libcli/security/security.h" #include "libcli/auth/libcli_auth.h" #include "param/secrets.h" +#include "../lib/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 eda23fff98..b4fe5dca88 100644 --- a/source4/rpc_server/netlogon/dcerpc_netlogon.c +++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c @@ -26,6 +26,7 @@ #include "auth/auth.h" #include "auth/auth_sam_reply.h" #include "dsdb/samdb/samdb.h" +#include "../lib/util/util_ldb.h" #include "../libcli/auth/schannel.h" #include "libcli/security/security.h" #include "param/param.h" diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c index f4e1921fe7..ac75b417f9 100644 --- a/source4/rpc_server/samr/dcesrv_samr.c +++ b/source4/rpc_server/samr/dcesrv_samr.c @@ -36,6 +36,7 @@ #include "libcli/ldap/ldap_ndr.h" #include "libcli/security/security.h" #include "rpc_server/samr/proto.h" +#include "../lib/util/util_ldb.h" #include "param/param.h" #include "lib/util/tsort.h" diff --git a/source4/rpc_server/samr/samr_password.c b/source4/rpc_server/samr/samr_password.c index baea71efe9..d95a31d322 100644 --- a/source4/rpc_server/samr/samr_password.c +++ b/source4/rpc_server/samr/samr_password.c @@ -28,6 +28,7 @@ #include "dsdb/samdb/samdb.h" #include "auth/auth.h" #include "libcli/auth/libcli_auth.h" +#include "../lib/util/util_ldb.h" /* samr_ChangePasswordUser diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c index b8644d3674..9758185046 100644 --- a/source4/torture/rpc/netlogon.c +++ b/source4/torture/rpc/netlogon.c @@ -33,6 +33,7 @@ #include "param/param.h" #include "libcli/security/security.h" #include "lib/ldb/include/ldb.h" +#include "lib/util/util_ldb.h" #include "ldb_wrap.h" #include "lib/replace/system/network.h" #include "dsdb/samdb/samdb.h" diff --git a/source4/utils/net/drs/net_drs_showrepl.c b/source4/utils/net/drs/net_drs_showrepl.c index 8d81de1594..584c294707 100644 --- a/source4/utils/net/drs/net_drs_showrepl.c +++ b/source4/utils/net/drs/net_drs_showrepl.c @@ -24,6 +24,7 @@ #include "net_drs.h" #include "lib/ldb/include/ldb.h" #include "dsdb/samdb/samdb.h" +#include "lib/util/util_ldb.h" /** -- cgit