diff options
-rw-r--r-- | src/back-shr.c | 4 | ||||
-rw-r--r-- | src/format.c | 104 | ||||
-rw-r--r-- | src/format.h | 2 |
3 files changed, 55 insertions, 55 deletions
diff --git a/src/back-shr.c b/src/back-shr.c index 26cfa30..f6384f9 100644 --- a/src/back-shr.c +++ b/src/back-shr.c @@ -673,8 +673,8 @@ backend_shr_update_references_cb(const char *group, const char *set, inref_attrs = backend_set_config_get_inref_attrs(set_data); for (i = 0; (inref_attrs != NULL) && (inref_attrs[i] != NULL); i++) { /* We're only processing inref attributes for this map. */ - if ((strcmp(inref_attrs[i]->domain, group) != 0) || - (strcmp(inref_attrs[i]->map, set) != 0)) { + if ((strcmp(inref_attrs[i]->group, group) != 0) || + (strcmp(inref_attrs[i]->set, set) != 0)) { continue; } /* Extract the named attribute from the entry. */ diff --git a/src/format.c b/src/format.c index f238194..70e8722 100644 --- a/src/format.c +++ b/src/format.c @@ -57,7 +57,7 @@ struct format_choice { static int format_expand(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, - const char *domain, const char *map, + const char *group, const char *set, const char *fmt, const char *disallowed, char *outbuf, int outbuf_len, struct format_choice **outbuf_choices, @@ -93,13 +93,13 @@ format_dup_inref_attrs(struct format_inref_attr **attrs) for (i = 0, j = 0; i < elements; i++) { ret[j] = malloc(sizeof(**attrs)); if (ret[j] != NULL) { - ret[j]->domain = - strdup(attrs[i]->domain); - ret[j]->map = strdup(attrs[i]->map); + ret[j]->group = + strdup(attrs[i]->group); + ret[j]->set = strdup(attrs[i]->set); ret[j]->attribute = strdup(attrs[i]->attribute); - if ((ret[j]->domain != NULL) && - (ret[j]->map != NULL) && + if ((ret[j]->group != NULL) && + (ret[j]->set != NULL) && (ret[j]->attribute != NULL)) { j++; } @@ -112,7 +112,7 @@ format_dup_inref_attrs(struct format_inref_attr **attrs) } void format_add_inref_attrs(struct format_inref_attr ***attrs, - const char *domain, const char *map, + const char *group, const char *set, const char *attribute) { struct format_inref_attr **ret; @@ -121,8 +121,8 @@ format_add_inref_attrs(struct format_inref_attr ***attrs, ret = NULL; if (*attrs != NULL) { for (i = 0; (*attrs)[i] != NULL; i++) { - if ((strcmp((*attrs)[i]->domain, domain) == 0) && - (strcmp((*attrs)[i]->map, map) == 0) && + if ((strcmp((*attrs)[i]->group, group) == 0) && + (strcmp((*attrs)[i]->set, set) == 0) && (strcmp((*attrs)[i]->attribute, attribute) == 0)) { return; } @@ -134,8 +134,8 @@ format_add_inref_attrs(struct format_inref_attr ***attrs, memcpy(ret, *attrs, elements * sizeof(**attrs)); ret[elements] = malloc(sizeof(**ret)); if (ret[elements] != NULL) { - ret[elements]->domain = strdup(domain); - ret[elements]->map = strdup(map); + ret[elements]->group = strdup(group); + ret[elements]->set = strdup(set); ret[elements]->attribute = strdup(attribute); ret[elements + 1] = NULL; } @@ -150,8 +150,8 @@ format_free_inref_attrs(struct format_inref_attr **attrs) int i; if (attrs != NULL) { for (i = 0; attrs[i] != NULL; i++) { - free(attrs[i]->domain); - free(attrs[i]->map); + free(attrs[i]->group); + free(attrs[i]->set); free(attrs[i]->attribute); free(attrs[i]); } @@ -302,7 +302,7 @@ format_parse_args(struct plugin_state *state, const char *args, /* Echo the parameter text. */ static int format_echo(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, - const char *domain, const char *map, + const char *group, const char *set, const char *args, const char *disallowed, char *outbuf, int outbuf_len, struct format_choice **outbuf_choices, char ***ref_attrs, struct format_inref_attr ***inref_attrs) @@ -342,7 +342,7 @@ format_echo(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, /* Choose the first value of the attribute in the entry. */ static int format_first(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, - const char *domain, const char *map, + const char *group, const char *set, const char *args, const char *disallowed, char *outbuf, int outbuf_len, struct format_choice **outbuf_choices, @@ -396,7 +396,7 @@ format_first(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, * joined by a separator given as the first argument. */ static int format_list(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, - const char *domain, const char *map, + const char *group, const char *set, const char *args, const char *disallowed, char *outbuf, int outbuf_len, struct format_choice **outbuf_choices, char ***ref_attrs, struct format_inref_attr ***inref_attrs) @@ -476,7 +476,7 @@ format_list(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, * argument, and create a list separated by the first argument. */ static int format_deref(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, - const char *domain, const char *map, + const char *group, const char *set, const char *args, const char *disallowed, char *outbuf, int outbuf_len, struct format_choice **outbuf_choices, @@ -703,7 +703,7 @@ format_referred_entry_cb(Slapi_Entry *e, void *callback_data) } static int format_referred(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, - const char *domain, const char *map, + const char *group, const char *set, const char *args, const char *disallowed, char *outbuf, int outbuf_len, struct format_choice **outbuf_choices, @@ -751,7 +751,7 @@ format_referred(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, /* Retrieve the map-specific paramters. */ map_filter = NULL; map_bases = NULL; - backend_get_map_config(state, domain, argv[1], &map_bases, &map_filter); + backend_get_map_config(state, group, argv[1], &map_bases, &map_filter); if (map_filter == NULL) { map_filter = "(objectClass=*)"; } @@ -759,12 +759,12 @@ format_referred(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id, "no search bases defined for \"%s\"/\"%s\"?\n", - domain, argv[1]); + group, argv[1]); } /* Note that the attribute in this map refers to this entry. */ if (inref_attrs != NULL) { - format_add_inref_attrs(inref_attrs, domain, argv[1], argv[2]); + format_add_inref_attrs(inref_attrs, group, argv[1], argv[2]); } tndn = format_escape_for_filter(slapi_entry_get_ndn(e)); @@ -826,7 +826,7 @@ format_referred(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, * first argument as a separator. */ static int format_merge(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, - const char *domain, const char *map, + const char *group, const char *set, const char *args, const char *disallowed, char *outbuf, int outbuf_len, struct format_choice **outbuf_choices, @@ -853,7 +853,7 @@ format_merge(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id, "merge: expanding ->%s<-\n", argv[i]); these_choices = NULL; - len = format_expand(state, pb, e, domain, map, + len = format_expand(state, pb, e, group, set, argv[i], disallowed, outbuf + ret + (count ? slen : 0), outbuf_len - (ret + (count ? slen : 0)), @@ -905,7 +905,7 @@ format_merge(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, static int format_match_generic(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, - const char *domain, const char *map, + const char *group, const char *set, const char *args, int min_args, int default_arg, const char *disallowed, char *outbuf, int outbuf_len, @@ -1073,13 +1073,13 @@ format_match_cb(const char *pattern, const char *value, char **argv) static int format_match(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, - const char *domain, const char *map, + const char *group, const char *set, const char *args, const char *disallowed, char *outbuf, int outbuf_len, struct format_choice **outbuf_choices, char ***ref_attrs, struct format_inref_attr ***inref_attrs) { - return format_match_generic(state, pb, e, domain, map, args, 2, 2, + return format_match_generic(state, pb, e, group, set, args, 2, 2, disallowed, outbuf, outbuf_len, outbuf_choices, ref_attrs, inref_attrs, @@ -1104,13 +1104,13 @@ format_regmatch_cb(const char *pattern, const char *value, char **argv) static int format_regmatch(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, - const char *domain, const char *map, + const char *group, const char *set, const char *args, const char *disallowed, char *outbuf, int outbuf_len, struct format_choice **outbuf_choices, char ***ref_attrs, struct format_inref_attr ***inref_attrs) { - return format_match_generic(state, pb, e, domain, map, args, 2, 2, + return format_match_generic(state, pb, e, group, set, args, 2, 2, disallowed, outbuf, outbuf_len, outbuf_choices, ref_attrs, inref_attrs, @@ -1228,13 +1228,13 @@ format_regsub_cb(const char *pattern, const char *value, char **argv) static int format_regsub(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, - const char *domain, const char *map, + const char *group, const char *set, const char *args, const char *disallowed, char *outbuf, int outbuf_len, struct format_choice **outbuf_choices, char ***ref_attrs, struct format_inref_attr ***inref_attrs) { - return format_match_generic(state, pb, e, domain, map, args, 3, 3, + return format_match_generic(state, pb, e, group, set, args, 3, 3, disallowed, outbuf, outbuf_len, outbuf_choices, ref_attrs, inref_attrs, @@ -1250,7 +1250,7 @@ format_lookup_fn(const char *fnname) const char *name; int (*fct_ptr)(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, - const char *domain, const char *map, + const char *group, const char *set, const char *args, const char *disallowed, char *outbuf, int outbuf_len, struct format_choice **outbuf_choices, @@ -1559,7 +1559,7 @@ format_trim_value(struct plugin_state *state, char *input, static int format_expand_simple(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, - const char *domain, const char *map, + const char *group, const char *set, const char *fmt, const char *disallowed, char *outbuf, int outbuf_len, struct format_choice **outbuf_choices, @@ -1663,7 +1663,7 @@ format_expand_simple(struct plugin_state *state, /* Supply the default value, expanding it if * needed. */ i = format_expand(state, pb, e, - domain, map, + group, set, default_value, NULL, outbuf, outbuf_len, outbuf_choices, @@ -1688,7 +1688,7 @@ format_expand_simple(struct plugin_state *state, if (alternate_value != NULL) { /* Supply the alternate value. */ i = format_expand(state, pb, e, - domain, map, alternate_value, NULL, + group, set, alternate_value, NULL, outbuf, outbuf_len, outbuf_choices, ref_attrs, inref_attrs); free(tmp); @@ -1725,7 +1725,7 @@ format_expand_simple(struct plugin_state *state, * specifier and evaluate it, otherwise return it. */ static int format_expand(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, - const char *domain, const char *map, + const char *group, const char *set, const char *fmt, const char *disallowed, char *outbuf, int outbuf_len, struct format_choice **outbuf_choices, @@ -1737,7 +1737,7 @@ format_expand(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, const char *paramstart, *paramend; int (*formatfn)(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, - const char *domain, const char *map, + const char *group, const char *set, const char *args, const char *disallowed, char *outbuf, int outbuf_len, struct format_choice **outbuf_choices, @@ -1792,8 +1792,8 @@ format_expand(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, /* Expand the simple expression. */ used = format_expand_simple(state, pb, e, - domain, - map, + group, + set, subexp, disallowed, outbuf + j, @@ -1897,7 +1897,7 @@ format_expand(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, } /* Call the "function". */ used = (*formatfn)(state, pb, e, - domain, map, + group, set, params, disallowed, outbuf + j, outbuf_len - j, outbuf_choices, @@ -1951,7 +1951,7 @@ format_expand(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, static char * format_format(struct plugin_state *state, Slapi_Entry *e, - const char *domain, const char *map, + const char *group, const char *set, const char *fmt, const char *disallowed, struct format_choice **choices, char ***ref_attrs, struct format_inref_attr ***inref_attrs) @@ -1976,7 +1976,7 @@ format_format(struct plugin_state *state, Slapi_Entry *e, return NULL; } - i = format_expand(state, pb, e, domain, map, + i = format_expand(state, pb, e, group, set, fmt, disallowed, buf, buflen, choices, ref_attrs, inref_attrs); @@ -2035,12 +2035,12 @@ format_free_data(char *data) } char * format_get_data(struct plugin_state *state, Slapi_Entry *e, - const char *domain, const char *map, + const char *group, const char *set, const char *fmt, const char *disallowed, char ***ref_attrs, struct format_inref_attr ***inref_attrs) { - return format_format(state, e, domain, map, fmt, disallowed, + return format_format(state, e, group, set, fmt, disallowed, NULL, ref_attrs, inref_attrs); } @@ -2057,16 +2057,16 @@ format_free_data_set(char **data) } char ** format_get_data_set(struct plugin_state *state, Slapi_Entry *e, - const char *domain, const char *map, + const char *group, const char *set, const char *fmt, const char *disallowed, char ***ref_attrs, struct format_inref_attr ***inref_attrs) { struct format_choice *choices, *this_choice; char **ret, *template, *s; - int combinations, group, i, j, k, offset, length, template_len; + int combinations, groupsize, i, j, k, offset, length, template_len; choices = NULL; - template = format_format(state, e, domain, map, fmt, disallowed, + template = format_format(state, e, group, set, fmt, disallowed, &choices, ref_attrs, inref_attrs); if (template == NULL) { format_free_choices(choices); @@ -2092,14 +2092,14 @@ format_get_data_set(struct plugin_state *state, Slapi_Entry *e, /* Work out all of the results. */ for (i = 0, j = 0; i < combinations; i++) { /* First figure out how long this result will be. */ - group = combinations; + groupsize = combinations; length = template_len; for (this_choice = choices; this_choice != NULL; this_choice = this_choice->next) { /* Add the length of the value used here. */ - group /= this_choice->n_values; - s = this_choice->values[(i / group) % + groupsize /= this_choice->n_values; + s = this_choice->values[(i / groupsize) % this_choice->n_values]; length += strlen(s); } @@ -2111,7 +2111,7 @@ format_get_data_set(struct plugin_state *state, Slapi_Entry *e, /* Build the result's value. */ offset = 0; k = 0; - group = combinations; + groupsize = combinations; for (this_choice = choices; this_choice != NULL; this_choice = this_choice->next) { @@ -2122,8 +2122,8 @@ format_get_data_set(struct plugin_state *state, Slapi_Entry *e, memcpy(ret[j] + k, template + offset, length); k += length; offset += length; - group /= this_choice->n_values; - s = this_choice->values[(i / group) % + groupsize /= this_choice->n_values; + s = this_choice->values[(i / groupsize) % this_choice->n_values]; length = strlen(s); memcpy(ret[j] + k, s, length); diff --git a/src/format.h b/src/format.h index 54c795f..3fcf8f9 100644 --- a/src/format.h +++ b/src/format.h @@ -25,7 +25,7 @@ struct slapi_entry; struct plugin_state; struct format_inref_attr { - char *domain, *map, *attribute; + char *group, *set, *attribute; }; void format_free_attr_list(char **attr_list); |