The branch, master has been updated
via 8a2ce5c s4:remove "util_ldb" submodule and integrate the three
gendb_* calls in "dsdb/common/util.c"
via 39bd4ce s4:lib/util/util_ldb.c - remove unused "gendb_add_ldif" call
via e1078d2 s4:ldb-samba/ldb_wrap.c - fix indentation and trailing
whitespaces
via be4a0d3 s4:"wrap_casefold" - move it to "ldb_wrap.c" since it's
only used there
from 10adee8 s4:dsdb - make the RELAX control private
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 8a2ce5c47cee499f90b125ebde83de5f9f1a9aa0
Author: Matthias Dieter Wallnöfer <[email protected]>
Date: Sun Oct 17 10:37:23 2010 +0200
s4:remove "util_ldb" submodule and integrate the three gendb_* calls in
"dsdb/common/util.c"
They're only in use by SAMDB code.
Autobuild-User: Matthias Dieter Wallnöfer <[email protected]>
Autobuild-Date: Sun Oct 17 09:40:13 UTC 2010 on sn-devel-104
commit 39bd4ce92055f79e55e2f228537324d7f1401cc0
Author: Matthias Dieter Wallnöfer <[email protected]>
Date: Sun Oct 17 10:29:46 2010 +0200
s4:lib/util/util_ldb.c - remove unused "gendb_add_ldif" call
commit e1078d2de2a2462fb24d3d4b5e2643290e663c6c
Author: Matthias Dieter Wallnöfer <[email protected]>
Date: Sun Oct 17 10:23:41 2010 +0200
s4:ldb-samba/ldb_wrap.c - fix indentation and trailing whitespaces
commit be4a0d35ac8c55a102e5a938a4b7627e0defd23d
Author: Matthias Dieter Wallnöfer <[email protected]>
Date: Sun Oct 17 10:20:40 2010 +0200
s4:"wrap_casefold" - move it to "ldb_wrap.c" since it's only used there
-----------------------------------------------------------------------
Summary of changes:
lib/util/util_ldb.c | 134 ------------------------
lib/util/util_ldb.h | 29 -----
lib/util/wscript_build | 9 --
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/ldb_wrap.c | 81 ++++++++-------
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 -
31 files changed, 137 insertions(+), 235 deletions(-)
delete mode 100644 lib/util/util_ldb.c
delete mode 100644 lib/util/util_ldb.h
Changeset truncated at 500 lines:
diff --git a/lib/util/util_ldb.c b/lib/util/util_ldb.c
deleted file mode 100644
index 9fd2ace..0000000
--- a/lib/util/util_ldb.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
-
- common share info functions
-
- Copyright (C) Andrew Tridgell 2004
- Copyright (C) Tim Potter 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/>.
-*/
-
-#include "includes.h"
-#include "lib/ldb/include/ldb.h"
-#include "../lib/util/util_ldb.h"
-/*
- search the sam 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 LDB 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 LDB 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);
-}
-
-/*
- setup some initial ldif in a ldb
-*/
-int gendb_add_ldif(struct ldb_context *ldb, const char *ldif_string)
-{
- struct ldb_ldif *ldif;
- const char *s = ldif_string;
- int ret;
- while (s && *s != '\0') {
- ldif = ldb_ldif_read_string(ldb, &s);
- if (ldif == NULL) return -1;
- ret = ldb_add(ldb, ldif->msg);
- talloc_free(ldif);
- }
- return ret;
-}
-
-char *wrap_casefold(void *context, void *mem_ctx, const char *s, size_t n)
-{
- return strupper_talloc_n(mem_ctx, s, n);
-}
-
diff --git a/lib/util/util_ldb.h b/lib/util/util_ldb.h
deleted file mode 100644
index f9eb028..0000000
--- a/lib/util/util_ldb.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef __LIB_UTIL_UTIL_LDB_H__
-#define __LIB_UTIL_UTIL_LDB_H__
-
-struct ldb_dn;
-
-/* 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, size_t n);
-
-#endif /* __LIB_UTIL_UTIL_LDB_H__ */
diff --git a/lib/util/wscript_build b/lib/util/wscript_build
index 91c85f0..b551953 100644
--- a/lib/util/wscript_build
+++ b/lib/util/wscript_build
@@ -47,15 +47,6 @@ bld.SAMBA_SUBSYSTEM('UTIL_TEVENT',
header_path=[ ('*', 'util') ],
)
-
-bld.SAMBA_SUBSYSTEM('UTIL_LDB',
- source='util_ldb.c',
- local_include=False,
- public_deps='ldb',
- public_headers='util_ldb.h'
- )
-
-
bld.SAMBA_SUBSYSTEM('UTIL_RUNCMD',
source='util_runcmd.c',
local_include=False,
diff --git a/source4/auth/config.mk b/source4/auth/config.mk
index 573f197..58d7ed4 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 UTIL_LDB LIBSECURITY
+PUBLIC_DEPENDENCIES = SAMDB 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 32f415a..2d35180 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 UTIL_LDB HEIMDAL_GSSAPI
+ LIBCLI_AUTH SECRETS LIBCRYPTO KERBEROS HEIMDAL_GSSAPI
PRIVATE_DEPENDENCIES = \
SECRETS SAMDB
diff --git a/source4/auth/credentials/credentials_secrets.c
b/source4/auth/credentials/credentials_secrets.c
index 8c8043c..210590c 100644
--- a/source4/auth/credentials/credentials_secrets.c
+++ b/source4/auth/credentials/credentials_secrets.c
@@ -27,7 +27,6 @@
#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 8de33ff..259efec 100644
--- a/source4/auth/ntlm/auth_sam.c
+++ b/source4/auth/ntlm/auth_sam.c
@@ -22,7 +22,6 @@
#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 38fb1b7..e44a032 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 UTIL_LDB LIBSECURITY ldb tevent',
+ public_deps='SAMDB LIBSECURITY ldb tevent',
deps=''
)
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index 9e6ccbc..b7f6b69 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -26,7 +26,6 @@
#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"
@@ -45,6 +44,92 @@
#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 6df140f..d4b1220 100644
--- a/source4/dsdb/samdb/cracknames.c
+++ b/source4/dsdb/samdb/cracknames.c
@@ -32,7 +32,6 @@
#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 a5b3df1..f6db0d1 100644
--- a/source4/dsdb/samdb/ldb_modules/samba3sid.c
+++ b/source4/dsdb/samdb/ldb_modules/samba3sid.c
@@ -29,7 +29,6 @@
#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 3a971e8..8db93b2 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -37,7 +37,6 @@
#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 c7d2c30..93fc122 100644
--- a/source4/dsdb/samdb/samdb.c
+++ b/source4/dsdb/samdb/samdb.c
@@ -34,7 +34,6 @@
#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 69c4ebe..e6d9a9a 100644
--- a/source4/dsdb/samdb/samdb_privilege.c
+++ b/source4/dsdb/samdb/samdb_privilege.c
@@ -24,7 +24,6 @@
#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 db2f38b..832adb7 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 UTIL_LDB LIBCLI_AUTH LIBTSOCKET
samba_socket LIBSAMBA-HOSTCONFIG'
+ deps='ldb NDR_DRSBLOBS LIBCLI_LDAP_NDR LIBCLI_AUTH LIBTSOCKET
samba_socket LIBSAMBA-HOSTCONFIG'
)
diff --git a/source4/headermap.txt b/source4/headermap.txt
index e8dbbce..dbf18cb 100644
--- a/source4/headermap.txt
+++ b/source4/headermap.txt
@@ -51,7 +51,6 @@ 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 9d6a230..e9ae5b3 100644
--- a/source4/kdc/db-glue.c
+++ b/source4/kdc/db-glue.c
@@ -30,7 +30,6 @@
#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 5254b62..bddc0a9 100644
--- a/source4/kdc/kpasswdd.c
+++ b/source4/kdc/kpasswdd.c
@@ -33,7 +33,6 @@
#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 4b40ed4..7df92d4 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 UTIL_LDB
+PRIVATE_DEPENDENCIES = LDBSAMBA
LDB_WRAP_OBJ_FILES = $(libsrcdir)/ldb_wrap.o
PUBLIC_HEADERS += $(libsrcdir)/ldb_wrap.h
diff --git a/source4/lib/ldb-samba/ldb_wrap.c b/source4/lib/ldb-samba/ldb_wrap.c
index 299dbf4..763e785 100644
--- a/source4/lib/ldb-samba/ldb_wrap.c
+++ b/source4/lib/ldb-samba/ldb_wrap.c
@@ -1,20 +1,20 @@
-/*
+/*
Unix SMB/CIFS implementation.
LDB wrap functions
Copyright (C) Andrew Tridgell 2004-2009
-
+
This program is free software; you can redistribute it and/or modify
--
Samba Shared Repository