diff options
author | Nalin Dahyabhai <nalin@redhat.com> | 2012-01-10 14:51:26 -0500 |
---|---|---|
committer | Nalin Dahyabhai <nalin@redhat.com> | 2012-01-10 14:51:26 -0500 |
commit | 6cc8311b8c73bc55635d0e7aedee530c66eaa04d (patch) | |
tree | c1cea5091dd296d8a6f4f8f77d430d4f649a582b /src | |
parent | 982244674489c01e3575409561b94337a75e2639 (diff) | |
download | slapi-nis-6cc8311b8c73bc55635d0e7aedee530c66eaa04d.tar.gz slapi-nis-6cc8311b8c73bc55635d0e7aedee530c66eaa04d.tar.xz slapi-nis-6cc8311b8c73bc55635d0e7aedee530c66eaa04d.zip |
- use an internal sequence number to disable the skip-boring-updates logic, and test that while our results don't change, we did actually do processing
Diffstat (limited to 'src')
-rw-r--r-- | src/format.c | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/src/format.c b/src/format.c index 9c25d4c..cb014eb 100644 --- a/src/format.c +++ b/src/format.c @@ -3006,6 +3006,53 @@ format_unique(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, return ret; } +/* Produce an internal sequence number. */ +static int +format_internal_sequence_number(struct plugin_state *state, + Slapi_PBlock *pb, Slapi_Entry *e, + const char *group, const char *set, + const char *args, const char *disallowed, + char *outbuf, int outbuf_len, + struct format_choice **outbuf_choices, + char ***rel_attrs, + char ***ref_attrs, + struct format_inref_attr ***inref_attrs, + struct format_ref_attr_list ***ref_attr_list, + struct format_ref_attr_list ***inref_attr_list) +{ + static int sequence; + char *buf; + int ret, i, j, argc; + char **argv, **values; + const char *value_format, *default_value; + unsigned int *lengths; + struct berval **choices, bv; + + choices = NULL; + buf = malloc(3 * sizeof(sequence)); + if (buf != NULL) { + sprintf(buf, "%d", ++sequence); + bv.bv_val = buf; + bv.bv_len = strlen(buf); + format_add_bv_list(&choices, &bv); + } + if (choices != NULL) { + format_add_choice(outbuf_choices, outbuf, &choices); + ret = 0; + } else { + ret = -ENOENT; + } + if (ret == 0) { + slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id, + "internal_sequence_number: ->%s<-\n", buf); + } else { + slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id, + "internal_sequence_number: error building result\n"); + } + free(buf); + return ret; +} + /* Choose a formatting function by name. */ static void * format_lookup_fn(const char *fnname) @@ -3043,7 +3090,7 @@ format_lookup_fn(const char *fnname) {"collect", format_collect}, {"link", format_link}, {"unique", format_unique}, - /* {"uuid", format_uuid}, */ + {"internal_sequence_number", format_internal_sequence_number}, }; for (i = 0; i < sizeof(fns) / sizeof(fns[0]); i++) { if ((fns[i].name != NULL) && |