diff options
| author | Nalin Dahyabhai <nalin@dahyabhai.net> | 2008-05-14 00:49:01 -0400 |
|---|---|---|
| committer | Nalin Dahyabhai <nalin@dahyabhai.net> | 2008-05-14 00:49:01 -0400 |
| commit | 7909b5b808796c12c19b22aaf4c06d54b0d569bb (patch) | |
| tree | cf4e995ec708c96d56d88a0b778b96c42589075a /src | |
| parent | 81d94f08449be8761282b2c86c3d4b2441345d4d (diff) | |
| download | slapi-nis-7909b5b808796c12c19b22aaf4c06d54b0d569bb.tar.gz slapi-nis-7909b5b808796c12c19b22aaf4c06d54b0d569bb.tar.xz slapi-nis-7909b5b808796c12c19b22aaf4c06d54b0d569bb.zip | |
- format_deref:
don't complain if the entry has no DN values to deref
log when we fail to read an entry
- format_merge:
don't double-log expansion attempts
free the parameter list after we log with it
Diffstat (limited to 'src')
| -rw-r--r-- | src/format.c | 19 |
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, |
