The branch, master has been updated via 8556602 ldb:"ldb_schema_attribute_by_name_internal" - switch back to 32bit counters via 48cd89e ldb:ldb_tdb.c - fix up counter variables via 94a4458 ldb:ldb_tdb.c - improve the error outputs via 3ead246 s4:"util_ldb" - remove some really unused dependancies from a610ce4 libcli/nbt: we don't need LIBCLI_COMPOSITE anymore
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 8556602b048e825b35df314d6865f997823ec2bb Author: Matthias Dieter Wallnöfer <m...@samba.org> Date: Mon Oct 18 20:19:00 2010 +0200 ldb:"ldb_schema_attribute_by_name_internal" - switch back to 32bit counters Use the signed counter for the binary search but use an unsigned one for accessing the entry. Autobuild-User: Matthias Dieter Wallnöfer <m...@samba.org> Autobuild-Date: Mon Oct 18 19:01:31 UTC 2010 on sn-devel-104 commit 48cd89e25d58d5d2fd0dbb7ce4a0e8b96e3e6044 Author: Matthias Dieter Wallnöfer <m...@samba.org> Date: Mon Oct 18 20:10:17 2010 +0200 ldb:ldb_tdb.c - fix up counter variables "find_element" returns an "int" since there is also the possibility that a certain element doesn't exist - then "-1" is returned. But beside this exception treat all other return values as unsigned. commit 94a445869c5fa3bb6df542c494e8822478f790e8 Author: Matthias Dieter Wallnöfer <m...@samba.org> Date: Mon Oct 18 20:07:49 2010 +0200 ldb:ldb_tdb.c - improve the error outputs - Fix indentation - Include always the failing DN - Reorder the outputs to make them consistent commit 3ead246062b927e44cb75e684cc67c41109d63c4 Author: Matthias Dieter Wallnöfer <m...@samba.org> Date: Mon Oct 18 19:24:43 2010 +0200 s4:"util_ldb" - remove some really unused dependancies ----------------------------------------------------------------------- Summary of changes: 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/samdb/ldb_modules/samba3sid.c | 1 - source4/dsdb/samdb/ldb_modules/samldb.c | 1 - source4/kdc/db-glue.c | 1 - source4/lib/basic.mk | 2 +- source4/lib/ldb-samba/wscript_build | 2 +- source4/lib/ldb/common/ldb_attributes.c | 9 ++-- source4/lib/ldb/ldb_tdb/ldb_tdb.c | 51 +++++++++++++++-------- source4/libnet/libnet_join.c | 1 - source4/nbt_server/dgram/netlogon.c | 1 - 13 files changed, 42 insertions(+), 33 deletions(-) Changeset truncated at 500 lines: diff --git a/source4/auth/credentials/config.mk b/source4/auth/credentials/config.mk index 9762966..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/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/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/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/wscript_build b/source4/lib/ldb-samba/wscript_build index fd07fd1..a2ac32b 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 UTIL_LDB NDR_DNSP SAMDB' + deps='LIBSECURITY LIBNDR NDR_DRSBLOBS CREDENTIALS NDR_DNSP SAMDB' ) diff --git a/source4/lib/ldb/common/ldb_attributes.c b/source4/lib/ldb/common/ldb_attributes.c index 13f4d32..ea6fafd 100644 --- a/source4/lib/ldb/common/ldb_attributes.c +++ b/source4/lib/ldb/common/ldb_attributes.c @@ -123,8 +123,8 @@ static const struct ldb_schema_attribute *ldb_schema_attribute_by_name_internal( const char *name) { /* for binary search we need signed variables */ - long long int i, e, b = 0; - int r; + int r, i, e, b = 0; + unsigned int u_i; const struct ldb_schema_attribute *def = &ldb_attribute_default; /* as handlers are sorted, '*' must be the first if present */ @@ -139,9 +139,10 @@ static const struct ldb_schema_attribute *ldb_schema_attribute_by_name_internal( while (b <= e) { i = (b + e) / 2; - r = ldb_attr_cmp(name, ldb->schema.attributes[i].name); + u_i = (unsigned int) i; + r = ldb_attr_cmp(name, ldb->schema.attributes[u_i].name); if (r == 0) { - return &ldb->schema.attributes[i]; + return &ldb->schema.attributes[u_i]; } if (r < 0) { e = i - 1; diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c index f12bc58..4350537 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c @@ -4,7 +4,7 @@ Copyright (C) Andrew Tridgell 2004 Copyright (C) Stefan Metzmacher 2004 Copyright (C) Simo Sorce 2006-2008 - Copyright (C) Matthias Dieter Wallnöfer 2009 + Copyright (C) Matthias Dieter Wallnöfer 2009-2010 ** NOTE! The following LGPL license applies to the ldb ** library. This does NOT imply that all of Samba is released @@ -296,7 +296,7 @@ static int ltdb_add_internal(struct ldb_module *module, struct ldb_message_element *el = &msg->elements[i]; if (el->num_values == 0) { - ldb_asprintf_errstring(ldb, "attribute %s on %s specified, but with 0 values (illegal)", + ldb_asprintf_errstring(ldb, "attribute '%s' on '%s' specified, but with 0 values (illegal)", el->name, ldb_dn_get_linearized(msg->dn)); return LDB_ERR_CONSTRAINT_VIOLATION; } @@ -548,7 +548,8 @@ static int msg_delete_element(struct ldb_module *module, return LDB_ERR_NO_SUCH_ATTRIBUTE; } - el = &msg->elements[found]; + i = (unsigned int) found; + el = &(msg->elements[i]); a = ldb_schema_attribute_by_name(ldb, el->name); @@ -608,7 +609,7 @@ int ltdb_modify_internal(struct ldb_module *module, struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); TDB_DATA tdb_key, tdb_data; struct ldb_message *msg2; - unsigned i, j, k; + unsigned int i, j, k; int ret = LDB_SUCCESS, idx; struct ldb_control *control_permissive = NULL; @@ -655,7 +656,8 @@ int ltdb_modify_internal(struct ldb_module *module, case LDB_FLAG_MOD_ADD: if (el->num_values == 0) { - ldb_asprintf_errstring(ldb, "attribute %s on %s specified, but with 0 values (illigal)", + ldb_asprintf_errstring(ldb, + "attribute '%s': attribute on '%s' specified, but with 0 values (illegal)", el->name, ldb_dn_get_linearized(msg2->dn)); ret = LDB_ERR_CONSTRAINT_VIOLATION; goto done; @@ -691,12 +693,14 @@ int ltdb_modify_internal(struct ldb_module *module, ret = LDB_ERR_OTHER; goto done; } - ret = ltdb_index_add_element(module, msg2->dn, el); + ret = ltdb_index_add_element(module, msg2->dn, + el); if (ret != LDB_SUCCESS) { goto done; } } else { - el2 = &(msg2->elements[idx]); + j = (unsigned int) idx; + el2 = &(msg2->elements[j]); /* Check that values don't exist yet on multi- valued attributes or aren't provided twice */ @@ -713,12 +717,16 @@ int ltdb_modify_internal(struct ldb_module *module, continue; } - ldb_asprintf_errstring(ldb, "%s: value #%d already exists", el->name, j); + ldb_asprintf_errstring(ldb, + "attribute '%s': value #%u on '%s' already exists", + el->name, j, ldb_dn_get_linearized(msg2->dn)); ret = LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS; goto done; } if (ldb_msg_find_val(el, &el->values[j]) != &el->values[j]) { - ldb_asprintf_errstring(ldb, "%s: value #%d provided more than once", el->name, j); + ldb_asprintf_errstring(ldb, + "attribute '%s': value #%u on '%s' provided more than once", + el->name, j, ldb_dn_get_linearized(msg2->dn)); ret = LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS; goto done; } @@ -756,22 +764,27 @@ int ltdb_modify_internal(struct ldb_module *module, /* TODO: This is O(n^2) - replace with more efficient check */ for (j=0; j<el->num_values; j++) { if (ldb_msg_find_val(el, &el->values[j]) != &el->values[j]) { - ldb_asprintf_errstring(ldb, "%s: value #%d provided more than once", el->name, j); + ldb_asprintf_errstring(ldb, + "attribute '%s': value #%u on '%s' provided more than once", + el->name, j, ldb_dn_get_linearized(msg2->dn)); ret = LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS; goto done; } } + /* Checks if element already exists */ idx = find_element(msg2, el->name); if (idx != -1) { - el2 = &(msg2->elements[idx]); + j = (unsigned int) idx; + el2 = &(msg2->elements[j]); if (ldb_msg_element_compare(el, el2) == 0) { /* we are replacing with the same values */ continue; } /* Delete the attribute if it exists in the DB */ - if (msg_delete_attribute(module, ldb, msg2, el->name) != 0) { + if (msg_delete_attribute(module, ldb, msg2, + el->name) != 0) { ret = LDB_ERR_OTHER; goto done; } @@ -805,7 +818,8 @@ int ltdb_modify_internal(struct ldb_module *module, control_permissive) { ret = LDB_SUCCESS; } else { - ldb_asprintf_errstring(ldb, "No such attribute: %s for delete on %s", + ldb_asprintf_errstring(ldb, + "attribute '%s': no such attribute for delete on '%s'", msg->elements[i].name, dn); } if (ret != LDB_SUCCESS) { @@ -822,7 +836,8 @@ int ltdb_modify_internal(struct ldb_module *module, control_permissive) { ret = LDB_SUCCESS; } else { - ldb_asprintf_errstring(ldb, "No matching attribute value when deleting attribute: %s on %s", + ldb_asprintf_errstring(ldb, + "attribute '%s': no matching attribute value while deleting attribute on '%s'", msg->elements[i].name, dn); } if (ret != LDB_SUCCESS) { @@ -833,9 +848,9 @@ int ltdb_modify_internal(struct ldb_module *module, break; default: ldb_asprintf_errstring(ldb, - "Invalid ldb_modify flags on %s: 0x%x", - msg->elements[i].name, - msg->elements[i].flags & LDB_FLAG_MOD_MASK); + "attribute '%s': invalid modify flags on '%s': 0x%x", + msg->elements[i].name, ldb_dn_get_linearized(msg->dn), + msg->elements[i].flags & LDB_FLAG_MOD_MASK); ret = LDB_ERR_PROTOCOL_ERROR; goto done; } @@ -1262,7 +1277,7 @@ static int ltdb_handle_request(struct ldb_module *module, struct ltdb_context *ac; struct tevent_timer *te; struct timeval tv; - int i; + unsigned int i; ldb = ldb_module_get_ctx(module); diff --git a/source4/libnet/libnet_join.c b/source4/libnet/libnet_join.c index da21108..6c030be 100644 --- a/source4/libnet/libnet_join.c +++ b/source4/libnet/libnet_join.c @@ -27,7 +27,6 @@ #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/nbt_server/dgram/netlogon.c b/source4/nbt_server/dgram/netlogon.c index 8e231cc..81ee4c6 100644 --- a/source4/nbt_server/dgram/netlogon.c +++ b/source4/nbt_server/dgram/netlogon.c @@ -26,7 +26,6 @@ #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" -- Samba Shared Repository