svn commit: samba r20459 - in
branches/SAMBA_4_0/source/lib/ldb/modules: .
abartlet at samba.org
abartlet at samba.org
Tue Jan 2 03:39:01 GMT 2007
Author: abartlet
Date: 2007-01-02 03:39:01 +0000 (Tue, 02 Jan 2007)
New Revision: 20459
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20459
Log:
LDB map cleanup:
- Replace 'return 0' with return LDB_SUCCESS in more places.
- Do not return NULL attribute values, these are not permitted.
Instead, fail the whole conversion.
- Cleanup old comments.
Andrew Bartlett
Modified:
branches/SAMBA_4_0/source/lib/ldb/modules/ldb_map_outbound.c
Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/modules/ldb_map_outbound.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/modules/ldb_map_outbound.c 2007-01-02 03:37:07 UTC (rev 20458)
+++ branches/SAMBA_4_0/source/lib/ldb/modules/ldb_map_outbound.c 2007-01-02 03:39:01 UTC (rev 20459)
@@ -229,8 +229,7 @@
return NULL;
}
- el->num_values = old->num_values;
- el->values = talloc_array(el, struct ldb_val, el->num_values);
+ el->values = talloc_array(el, struct ldb_val, old->num_values);
if (el->values == NULL) {
talloc_free(el);
map_oom(module);
@@ -244,8 +243,14 @@
return NULL;
}
- for (i = 0; i < el->num_values; i++) {
+ for (i = 0; i < old->num_values; i++) {
el->values[i] = ldb_val_map_remote(module, el->values, map, &old->values[i]);
+ /* Conversions might fail, in which case bail */
+ if (!el->values[i].data) {
+ talloc_free(el);
+ return NULL;
+ }
+ el->num_values++;
}
return el;
@@ -262,7 +267,7 @@
/* We handle wildcards in ldb_msg_el_merge_wildcard */
if (ldb_attr_cmp(attr_name, "*") == 0) {
- return 0;
+ return LDB_SUCCESS;
}
map = map_attr_find_local(data, attr_name);
@@ -270,7 +275,7 @@
/* Unknown attribute in remote message:
* skip, attribute was probably auto-generated */
if (map == NULL) {
- return 0;
+ return LDB_SUCCESS;
}
switch (map->type) {
@@ -291,7 +296,7 @@
switch (map->type) {
case MAP_IGNORE:
- return 0;
+ return LDB_SUCCESS;
case MAP_CONVERT:
if (map->u.convert.convert_remote == NULL) {
@@ -299,7 +304,7 @@
"Skipping attribute '%s': "
"'convert_remote' not set\n",
attr_name);
- return 0;
+ return LDB_SUCCESS;
}
/* fall through */
case MAP_KEEP:
@@ -318,7 +323,7 @@
"Skipping attribute '%s': "
"'generate_local' not set\n",
attr_name);
- return 0;
+ return LDB_SUCCESS;
}
el = map->u.generate.generate_local(module, local, attr_name, remote);
@@ -330,7 +335,7 @@
}
if (el == NULL) {
- return LDB_ERR_OPERATIONS_ERROR;
+ return LDB_ERR_NO_SUCH_ATTRIBUTE;
}
return ldb_msg_replace(local, el);
@@ -376,7 +381,7 @@
}
}
- return 0;
+ return LDB_SUCCESS;
}
/* Mapping messages
@@ -394,7 +399,7 @@
}
}
- return 0;
+ return LDB_SUCCESS;
}
/* Merge a local and a remote message into a single local one. */
@@ -432,7 +437,7 @@
}
}
- return 0;
+ return LDB_SUCCESS;
}
/* Mapping search results
@@ -942,10 +947,6 @@
const char **local_attrs;
int ret;
- /* Clear initial lists of partitioned attributes */
-
- /* Clear initial lists of partitioned attributes */
-
/* There is no tree, just partition the searched attributes */
if (tree == NULL) {
ret = map_attrs_partition(module, ac,
More information about the samba-cvs
mailing list