summaryrefslogtreecommitdiffstats
path: root/src/format.c
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin.dahyabhai@pobox.com>2009-05-07 16:24:27 -0400
committerNalin Dahyabhai <nalin.dahyabhai@pobox.com>2009-05-07 16:24:27 -0400
commit1066dffe368e20ae43b1e6191a9138598da4f816 (patch)
tree172df0a0fd544255c6646c166ab85c967c56dd19 /src/format.c
parentebd466d34ccd21f4d47246d2f831c00cf4bde9d4 (diff)
downloadslapi-nis-1066dffe368e20ae43b1e6191a9138598da4f816.tar.gz
slapi-nis-1066dffe368e20ae43b1e6191a9138598da4f816.tar.xz
slapi-nis-1066dffe368e20ae43b1e6191a9138598da4f816.zip
- make sure that %referred() and %deref() don't return empty strings
Diffstat (limited to 'src/format.c')
-rw-r--r--src/format.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/format.c b/src/format.c
index c32ad83..3cc1b64 100644
--- a/src/format.c
+++ b/src/format.c
@@ -918,9 +918,9 @@ format_deref(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,
if (slapi_vattr_values_get(e, ref_attr, &ref_values,
&ref_disposition, &actual_ref_attr,
0, &ref_buffer_flags) != 0) {
- /* No references means we're done. */
+ /* No references means we're done, no answers to give. */
format_free_parsed_args(argv);
- return 0;
+ return -ENOENT;
}
/* Retrieve these attributes from the referred-to entries. */
attrs[0] = ref_attr;
@@ -1280,7 +1280,7 @@ format_referred(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,
backend_free_set_config(set_bases, set_filter);
slapi_pblock_destroy(local_pb);
format_free_parsed_args(argv);
- return 0;
+ return -ENOENT;
}
/* Note that the attribute in this map refers to this entry. */
@@ -1337,16 +1337,18 @@ format_referred(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,
}
free(filter);
+ backend_free_set_config(set_bases, set_filter);
+ slapi_pblock_destroy(local_pb);
+ format_free_parsed_args(argv);
+
/* Return any values we found. */
if (cbdata.choices != NULL) {
format_add_choice(outbuf_choices, outbuf, cbdata.choices);
format_free_bv_list(cbdata.choices);
+ return 0;
+ } else {
+ return -ENOENT;
}
-
- backend_free_set_config(set_bases, set_filter);
- slapi_pblock_destroy(local_pb);
- format_free_parsed_args(argv);
- return 0;
}
/* Add the name of this entry to the DN list in the cbdata. */