diff options
author | Stefan Metzmacher <metze@samba.org> | 2006-11-30 10:03:54 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:28:40 -0500 |
commit | 6045b6f314be519cfb7faeeef6b3daaac673582f (patch) | |
tree | f32f2a119fe0f78322553fd35e90dce934a8b823 | |
parent | 9da0c020571d901569e552224bfedd8bedbf43ba (diff) | |
download | samba-6045b6f314be519cfb7faeeef6b3daaac673582f.tar.gz samba-6045b6f314be519cfb7faeeef6b3daaac673582f.tar.bz2 samba-6045b6f314be519cfb7faeeef6b3daaac673582f.zip |
r19964: make debuging easier and report usefull error messages
metze
(This used to be commit f129d78256d965d52e80aedfa76c7c079e611c5f)
-rw-r--r-- | source4/lib/ldb/common/attrib_handlers.c | 2 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_index.c | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/source4/lib/ldb/common/attrib_handlers.c b/source4/lib/ldb/common/attrib_handlers.c index f563865c03..7a9fd1f9da 100644 --- a/source4/lib/ldb/common/attrib_handlers.c +++ b/source4/lib/ldb/common/attrib_handlers.c @@ -237,7 +237,7 @@ int ldb_canonicalise_dn(struct ldb_context *ldb, void *mem_ctx, dn = ldb_dn_new(ldb, mem_ctx, (char *)in->data); if ( ! ldb_dn_validate(dn)) { - return -1; + return LDB_ERR_INVALID_DN_SYNTAX; } out->data = (uint8_t *)ldb_dn_alloc_casefold(mem_ctx, dn); diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c index 045be985a4..99288d2b5f 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_index.c +++ b/source4/lib/ldb/ldb_tdb/ldb_index.c @@ -110,6 +110,7 @@ static struct ldb_dn *ltdb_index_key(struct ldb_context *ldb, struct ldb_val v; const struct ldb_attrib_handler *h; char *attr_folded; + int r; attr_folded = ldb_attr_casefold(ldb, attr); if (!attr_folded) { @@ -117,10 +118,13 @@ static struct ldb_dn *ltdb_index_key(struct ldb_context *ldb, } h = ldb_attrib_handler(ldb, attr); - if (h->canonicalise_fn(ldb, ldb, value, &v) != 0) { + r = h->canonicalise_fn(ldb, ldb, value, &v); + if (r != LDB_SUCCESS) { /* canonicalisation can be refused. For example, a attribute that takes wildcards will refuse to canonicalise if the value contains a wildcard */ + ldb_asprintf_errstring(ldb, "Failed to create index key for attribute '%s':%s:%s", + attr, ldb_strerror(r), ldb_errstring(ldb)); talloc_free(attr_folded); return NULL; } @@ -845,7 +849,6 @@ static int ltdb_index_add1(struct ldb_module *module, const char *dn, dn_key = ltdb_index_key(ldb, el->name, &el->values[v_idx]); if (!dn_key) { talloc_free(msg); - errno = ENOMEM; return -1; } talloc_steal(msg, dn_key); |