summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/format.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/format.c b/src/format.c
index a38fe98..62ecd6c 100644
--- a/src/format.c
+++ b/src/format.c
@@ -216,7 +216,7 @@ format_deref(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,
if (refs == NULL) {
/* No references. */
format_free_parsed_args(argv);
- return -1;
+ return 0;
}
/* Retrieve these attributes from the referred-to entries. */
attrs[0] = argv[0];
@@ -227,11 +227,20 @@ format_deref(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,
/* Pull up the referred-to entry. */
refdn = slapi_sdn_new_dn_byval(refs[i]);
if (refdn == NULL) {
+ slapi_log_error(SLAPI_LOG_PLUGIN,
+ state->plugin_desc->spd_id,
+ "deref: internal error reading \"%s\"",
+ refs[i]);
continue;
}
+ ref = NULL;
slapi_search_internal_get_entry(refdn, attrs, &ref,
state->plugin_identity);
if (ref == NULL) {
+ slapi_log_error(SLAPI_LOG_PLUGIN,
+ state->plugin_desc->spd_id,
+ "deref: failure reading entry \"%s\"",
+ slapi_sdn_get_ndn(refdn));
slapi_sdn_free(&refdn);
continue;
}
@@ -317,10 +326,6 @@ format_merge(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,
scratch, sizeof(scratch),
visited_ndns, TRUE);
/* Check that we've got space for this value. */
- slapi_log_error(SLAPI_LOG_PLUGIN,
- state->plugin_desc->spd_id,
- "merge: expanding ->%s<-\n",
- argv[i]);
if (len < 0) {
slapi_log_error(SLAPI_LOG_PLUGIN,
state->plugin_desc->spd_id,
@@ -359,7 +364,7 @@ format_merge(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,
memcpy(outbuf + ret, argv[0], slen);
ret += slen;
}
- /* Append the text of the argument. */
+ /* Append the text of the expansion. */
memcpy(outbuf + ret, scratch, len);
ret += len;
count++;
@@ -520,7 +525,6 @@ format_expand(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,
sizeof(exp) - j,
visited_ndns,
FALSE);
- free(tmp);
if (exp_len < 0) {
/* Miscellaneous failure, FAIL.
*/
@@ -532,6 +536,7 @@ format_expand(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,
tmp);
return -1;
}
+ free(tmp);
if (exp_len + j >= (int) sizeof(exp)) {
/* Out of space, FAIL. */
slapi_log_error(SLAPI_LOG_PLUGIN,