summaryrefslogtreecommitdiffstats
path: root/src/format.c
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin.dahyabhai@pobox.com>2009-05-07 18:22:36 -0400
committerNalin Dahyabhai <nalin.dahyabhai@pobox.com>2009-05-07 18:22:36 -0400
commitc535808403106babe0277cff92eedf932133f0c3 (patch)
treebb927ba7d6b24f959900f4e8a35cb2655f45bcf1 /src/format.c
parentde4f530bd67e5f415d03053a582fe34cc0155dfe (diff)
downloadslapi-nis-c535808403106babe0277cff92eedf932133f0c3.tar.gz
slapi-nis-c535808403106babe0277cff92eedf932133f0c3.tar.xz
slapi-nis-c535808403106babe0277cff92eedf932133f0c3.zip
- log more details
Diffstat (limited to 'src/format.c')
-rw-r--r--src/format.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/src/format.c b/src/format.c
index 3cc1b64..dbe9ed9 100644
--- a/src/format.c
+++ b/src/format.c
@@ -2266,8 +2266,8 @@ format_collect(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,
for (i = 0; choices[i] != NULL; i++) {
slapi_log_error(SLAPI_LOG_PLUGIN,
state->plugin_desc->spd_id,
- "collect: returning \"%.*s\" for "
- "\"%s\"\n",
+ "collect: returning \"%.*s\" as a "
+ "value for \"%s\"\n",
choices[i]->bv_len,
choices[i]->bv_val,
slapi_entry_get_dn(e));
@@ -3162,8 +3162,6 @@ format_expand(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,
ref_attrs, inref_attrs,
ref_attr_list,
inref_attr_list);
- free(params);
- params = NULL;
if (used < 0) {
/* Error in function, FAIL. */
slapi_log_error(SLAPI_LOG_PLUGIN,
@@ -3174,8 +3172,12 @@ format_expand(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,
fnname, params,
strerror(-used));
free(fnname);
+ free(params);
+ params = NULL;
return used;
}
+ free(params);
+ params = NULL;
free(fnname);
fnname = NULL;
if (used + j >= outbuf_len) {
@@ -3340,7 +3342,7 @@ format_get_data_set(struct plugin_state *state, Slapi_Entry *e,
struct format_choice *choices, *this_choice;
struct berval *val;
char **ret, *template;
- int combinations, groupsize, i, j, k, offset, length;
+ int combinations, groupsize, i, j, k, offset, length, prev_offset;
unsigned int template_len;
choices = NULL;
template = format_format(state, e, group, set, fmt, disallowed,
@@ -3355,18 +3357,37 @@ format_get_data_set(struct plugin_state *state, Slapi_Entry *e,
}
/* Figure out how many results we're going to have. */
combinations = 1;
- for (this_choice = choices;
+ for (this_choice = choices, prev_offset = 0;
this_choice != NULL;
this_choice = this_choice->next) {
+ if ((this_choice->offset - template) > prev_offset) {
+ slapi_log_error(SLAPI_LOG_PLUGIN,
+ state->plugin_desc->spd_id,
+ "choice: fixed \"%.*s\" at %d\n",
+ (int) (this_choice->offset - template) -
+ prev_offset,
+ template + prev_offset,
+ prev_offset);
+ prev_offset = this_choice->offset - template;
+ }
for (i = 0; i < this_choice->n_values; i++) {
slapi_log_error(SLAPI_LOG_PLUGIN,
state->plugin_desc->spd_id,
- "choice: %ld at %ld\n",
- (long) this_choice->values[i]->bv_len,
- (long) this_choice->offset);
+ "choice: option \"%.*s\" at %ld\n",
+ (int) this_choice->values[i]->bv_len,
+ (char *) this_choice->values[i]->bv_val,
+ (long) (this_choice->offset -
+ template));
}
combinations *= this_choice->n_values;
}
+ if (template[prev_offset] != '\0') {
+ slapi_log_error(SLAPI_LOG_PLUGIN,
+ state->plugin_desc->spd_id,
+ "choice: fixed \"%s\" at %d\n",
+ template + prev_offset,
+ prev_offset);
+ }
if (combinations == 0) {
format_free_choices(choices);
*data_lengths = NULL;