#27 Test azure mirroring
Opened 2 years ago by abbra. Modified 2 years ago
abbra/slapi-nis formatter-engine-api  into  master

file modified
+1 -1
@@ -1,4 +1,4 @@ 

- AC_INIT(slapi-nis,0.56.2)

+ AC_INIT(slapi-nis,0.57.0)

  AC_CONFIG_MACRO_DIR([m4])

  AM_INIT_AUTOMAKE(foreign)

  LT_INIT([disable-static])

file modified
+5 -2
@@ -10,8 +10,8 @@ 

  %endif

  

  Name:		slapi-nis

- Version:	0.56.2

- Release:	8%{?dist}

+ Version:	0.57.0

+ Release:	1%{?dist}

  Summary:	NIS Server and Schema Compatibility plugins for Directory Server

  License:	GPLv2

  URL:		http://pagure.io/slapi-nis/
@@ -81,6 +81,9 @@ 

  %{_sbindir}/nisserver-plugin-defs

  

  %changelog

+ * Tue Apr 09 2019 Alexander Bokovoy <abokovoy@redhat.com> - 0.57.0-1

+ - New formatting engine API (internal change)

+ 

  * Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.56.2-8

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

  

file modified
+686 -847
@@ -56,18 +56,24 @@ 

  	struct format_choice *next;

  };

  

- static int format_expand(struct plugin_state *state,

- 			 Slapi_PBlock *pb, Slapi_Entry *e,

+ static int format_expand(struct format_state *st, Slapi_Entry *e,

  			 const char *group, const char *set,

- 			 const char *fmt, const char *disallowed,

- 			 const struct slapi_dn **restrict_subtrees,

- 			 const struct slapi_dn **ignore_subtrees,

+ 			 const char *fmt,

  			 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);

+ 			 struct format_choice **outbuf_choices);

+ 

+ static char *

+ format_format(struct format_state *st, Slapi_Entry *e,

+ 	      const char *group, const char *set,

+ 	      const char *fmt,

+ 	      struct format_choice **choices,

+ 	      unsigned int *data_length);

+ 

+ static char **

+ format_get_data_set_int(struct format_state *st, Slapi_Entry *e,

+ 			const char *group, const char *set,

+ 			const char *fmt,

+ 			unsigned int **data_lengths);

  

  static char *

  xstrndup(const char *start, size_t length)
@@ -288,14 +294,50 @@ 

  }

  

  static int

- format_check_entry_exists(Slapi_PBlock *pb, const char *dn, char *filter,

- 			  void *identity)

+ format_search_get_entry_cb(Slapi_Entry *e, void *cb)

+ {

+ 	Slapi_Entry **ret = cb;

+ 	if (*ret) {

+ 		slapi_entry_free(*ret);

+ 	}

+ 	*ret = slapi_entry_dup(e);

+ 	return 0;

+ }

+ 

+ static int

+ format_search_get_entry(struct format_state *st,

+ 			Slapi_DN *dn, char *filter, char **attrs,

+ 			Slapi_Entry **ret_entry)

+ {

+ 	Slapi_PBlock *pb;

+ 	int ret;

+ 

+ 	*ret_entry = NULL;

+ 	pb = slapi_pblock_new();

+ 	if (pb == NULL) {

+ 		return -1;

+ 	}

+ 	slapi_search_internal_set_pb(pb, slapi_sdn_get_dn(dn), LDAP_SCOPE_BASE,

+ 				     filter ? filter : "(objectClass=*)", attrs,

+ 				     FALSE, NULL, NULL, st->plugin_identity, 0);

+ 	ret = st->search_callback_pb(st, pb, ret_entry,

+ 				     NULL,

+ 				     format_search_get_entry_cb,

+ 				     NULL);

+ 	slapi_pblock_destroy(pb);

+ 	return ret;

+ }

+ 

+ static int

+ format_check_entry_exists(struct format_state *st, const char *dn, char *filter)

  {

  	Slapi_DN *sdn;

  	Slapi_Entry *entry;

  

  	sdn = slapi_sdn_new_dn_byval(dn);

- 	wrap_search_internal_get_entry(pb, sdn, filter, NULL, &entry, identity);

+ 	/* pblock used in wrap_search_internal_get_entry() is a new one, it never

+ 	 * gets generated from the one we pass */

+ 	format_search_get_entry(st, sdn, filter, NULL, &entry);

  	slapi_sdn_free(&sdn);

  	if (entry != NULL) {

  		slapi_entry_free(entry);
@@ -306,29 +348,27 @@ 

  }

  

  static int

- format_check_sdn_location(const Slapi_DN *sdn,

- 			  const struct slapi_dn **restrict_subtrees,

- 			  const struct slapi_dn **ignore_subtrees)

+ format_check_sdn_location(struct format_state *st, const Slapi_DN *sdn)

  {

  	int i;

  

- 	if (restrict_subtrees != NULL) {

- 		for (i = 0; restrict_subtrees[i] != NULL; i++) {

+ 	if (st->config.restrict_subtrees != NULL) {

+ 		for (i = 0; st->config.restrict_subtrees[i] != NULL; i++) {

  			if (slapi_sdn_scope_test(sdn,

- 						 restrict_subtrees[i],

+ 						 st->config.restrict_subtrees[i],

  						 LDAP_SCOPE_SUBTREE) != 0) {

  				break;

  			}

  		}

- 		if (restrict_subtrees[i] == NULL) {

+ 		if (st->config.restrict_subtrees[i] == NULL) {

  			/* Non-empty list, but no match. */

  			return ENOENT;

  		}

  	}

- 	if (ignore_subtrees != NULL) {

- 		for (i = 0; ignore_subtrees[i] != NULL; i++) {

+ 	if (st->config.ignore_subtrees != NULL) {

+ 		for (i = 0; st->config.ignore_subtrees[i] != NULL; i++) {

  			if (slapi_sdn_scope_test(sdn,

- 						 ignore_subtrees[i],

+ 						 st->config.ignore_subtrees[i],

  						 LDAP_SCOPE_SUBTREE) != 0) {

  				return ENOENT;

  			}
@@ -338,29 +378,25 @@ 

  }

  

  static int

- format_check_dn_location(const char *dn,

- 			 const struct slapi_dn **restrict_subtrees,

- 			 const struct slapi_dn **ignore_subtrees)

+ format_check_dn_location(struct format_state *st, const char *dn)

  {

  	int ret = ENOENT;

  	Slapi_DN *sdn;

  

  	sdn = slapi_sdn_new_dn_byref(dn);

  	if (sdn != NULL) {

- 		ret = format_check_sdn_location(sdn,

- 						restrict_subtrees,

- 						ignore_subtrees);

+ 		ret = format_check_sdn_location(st, sdn);

  		slapi_sdn_free(&sdn);

  	}

  	return ret;

  }

  

  static void

- format_maybe_add_sdn_list(Slapi_PBlock *pb,

+ format_maybe_add_sdn_list(struct format_state *st,

  			  struct slapi_dn ***list, struct slapi_dn ***list2,

- 			  const char *dn, char *filter, void *identity)

+ 			  const char *dn, char *filter)

  {

- 	if (format_check_entry_exists(pb, dn, filter, identity) == 0) {

+ 	if (format_check_entry_exists(st, dn, filter) == 0) {

  		format_add_sdn_list(list, list2, dn);

  	}

  }
@@ -909,7 +945,7 @@ 

  	free(argv);

  }

  static int

- format_parse_args(struct plugin_state *state, const char *args,

+ format_parse_args(struct format_state *st, const char *args,

  		  int *pargc, char ***pargv)

  {

  	int i, dq, argc;
@@ -965,33 +1001,28 @@ 

  	return 0;

  }

  

+ 

  /* Choose the first value of the set of results for the first argument, and if

   * we get no results, return the second argument. */

  static int

- format_first(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,

+ format_first(struct format_state *st, Slapi_Entry *e,

  	     const char *group, const char *set,

- 	     const char *args, const char *disallowed,

- 	     const struct slapi_dn **restrict_subtrees,

- 	     const struct slapi_dn **ignore_subtrees,

+ 	     const char *args,

  	     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)

+ 	     struct format_choice **outbuf_choices)

  {

  	int ret, i, argc, first, common_length;

  	char **argv, **values;

  	const char *value_format, *default_value;

  	unsigned int *lengths;

- 	ret = format_parse_args(state, args, &argc, &argv);

+ 	ret = format_parse_args(st, args, &argc, &argv);

  	if (ret != 0) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"first: error parsing arguments\n");

  		return -EINVAL;

  	}

  	if (argc < 1) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"first: error parsing arguments\n");

  		format_free_parsed_args(argv);

  		return -EINVAL;
@@ -1004,30 +1035,23 @@ 

  		default_value = argv[1];

  	}

  	ret = -ENOENT;

- 	values = format_get_data_set(state, pb, e, group, set,

- 				     value_format, disallowed,

- 				     restrict_subtrees, ignore_subtrees,

- 				     rel_attrs, ref_attrs, inref_attrs,

- 				     ref_attr_list, inref_attr_list,

- 				     &lengths);

+ 	values = format_get_data_set_int(st, e, group, set,

+ 					 value_format,

+ 					 &lengths);

  	if (values == NULL) {

  		if (default_value == NULL) {

  			slapi_log_error(SLAPI_LOG_PLUGIN,

- 					state->plugin_desc->spd_id,

+ 					st->plugin_desc->spd_id,

  					"first: no values for ->%s<-, "

  					"and no default value provided\n",

  					value_format);

  			ret = -ENOENT;

  		} else {

- 			i = format_expand(state, pb, e,

+ 			i = format_expand(st, e,

  					  group, set,

- 					  default_value, NULL,

- 					  restrict_subtrees,

- 					  ignore_subtrees,

+ 					  default_value,

  					  outbuf, outbuf_len,

- 					  outbuf_choices,

- 					  rel_attrs, ref_attrs, inref_attrs,

- 					  ref_attr_list, inref_attr_list);

+ 					  outbuf_choices);

  			ret = i;

  		}

  	} else {
@@ -1060,18 +1084,12 @@ 

   * argument, pull out the values for the attribute named by the second

   * argument, and return a list of those values. */

  static int

- format_deref_x(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,

+ format_deref_x(struct format_state *st, Slapi_Entry *e,

  	       const char *fname, const char *group, const char *set,

  	       char *ref_attr, char *target_attr,

- 	       char *filter, const char *disallowed,

- 	       const struct slapi_dn **restrict_subtrees,

- 	       const struct slapi_dn **ignore_subtrees,

+ 	       char *filter,

  	       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)

+ 	       struct format_choice **outbuf_choices)

  {

  	int i, j;

  	Slapi_Entry *ref;
@@ -1084,12 +1102,12 @@ 

  	const struct berval *val;

  	struct berval **choices;

  	/* Note that this map cares about this attribute. */

- 	if (rel_attrs != NULL) {

- 		format_add_attrlist(rel_attrs, ref_attr);

+ 	if (st->config.rel_attrs != NULL) {

+ 		format_add_attrlist(st->config.rel_attrs, ref_attr);

  	}

  	/* Note that the attribute in this entry refers to other entries. */

- 	if (ref_attrs != NULL) {

- 		format_add_attrlist(ref_attrs, ref_attr);

+ 	if (st->config.ref_attrs != NULL) {

+ 		format_add_attrlist(st->config.ref_attrs, ref_attr);

  	}

  	/* Get the values of the reference attribute from this entry. */

  	if (slapi_vattr_values_get(e, ref_attr, &ref_values,
@@ -1114,39 +1132,36 @@ 

  		refdn = slapi_sdn_new_dn_byval(cref);

  		if (refdn == NULL) {

  			slapi_log_error(SLAPI_LOG_PLUGIN,

- 					state->plugin_desc->spd_id,

+ 					st->plugin_desc->spd_id,

  					"%s: internal error parsing name "

  					"\"%s\"\n", fname, cref);

  			continue;

  		}

- 		if (format_check_sdn_location(refdn,

- 					      restrict_subtrees,

- 					      ignore_subtrees) != 0) {

+ 		if (format_check_sdn_location(st, refdn) != 0) {

  			slapi_log_error(SLAPI_LOG_PLUGIN,

- 					state->plugin_desc->spd_id,

+ 					st->plugin_desc->spd_id,

  					"%s: entry \"%s\" is in a location "

  					"where we don't look\n", fname, cref);

  			slapi_sdn_free(&refdn);

  			continue;

  		}

- 		wrap_search_internal_get_entry(pb, refdn, filter, attrs, &ref,

- 					       state->plugin_identity);

+ 		format_search_get_entry(st, refdn, filter, attrs, &ref);

  		if (ref == NULL) {

  			slapi_log_error(SLAPI_LOG_PLUGIN,

- 					state->plugin_desc->spd_id,

+ 					st->plugin_desc->spd_id,

  					"%s: failure reading entry \"%s\"\n",

  					fname, slapi_sdn_get_ndn(refdn));

  			slapi_sdn_free(&refdn);

  			continue;

  		}

  		slapi_log_error(SLAPI_LOG_PLUGIN,

- 				state->plugin_desc->spd_id,

+ 				st->plugin_desc->spd_id,

  				"%s: reading \"%s\" from \"%s\"\n",

  				fname, target_attr, slapi_sdn_get_ndn(refdn));

  		slapi_sdn_free(&refdn);

  		/* Note that this map cares about this attribute. */

- 		if (rel_attrs != NULL) {

- 			format_add_attrlist(rel_attrs, target_attr);

+ 		if (st->config.rel_attrs != NULL) {

+ 			format_add_attrlist(st->config.rel_attrs, target_attr);

  		}

  		/* Pull out the attribute from the referred-to entry. */

  		if (slapi_vattr_values_get(ref, target_attr, &values,
@@ -1182,34 +1197,28 @@ 

  }

  

  static int

- format_deref(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,

+ format_deref(struct format_state *st, Slapi_Entry *e,

  	     const char *group, const char *set,

- 	     const char *args, const char *disallowed,

- 	     const struct slapi_dn **restrict_subtrees,

- 	     const struct slapi_dn **ignore_subtrees,

+ 	     const char *args,

  	     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)

+ 	     struct format_choice **outbuf_choices)

  {

  	int argc, ret;

  	char **argv, *ref_attr, *target_attr;

- 	ret = format_parse_args(state, args, &argc, &argv);

+ 	ret = format_parse_args(st, args, &argc, &argv);

  	if (ret != 0) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"deref: error parsing arguments\n");

  		return -EINVAL;

  	}

  	if (argc != 2) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"deref: requires two arguments\n");

  		format_free_parsed_args(argv);

  		return -EINVAL;

  	}

  	if (outbuf_choices == NULL) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"deref: returns a list, but a list "

  				"would not be appropriate\n");

  		format_free_parsed_args(argv);
@@ -1217,45 +1226,36 @@ 

  	}

  	ref_attr = argv[0];

  	target_attr = argv[1];

- 	ret = format_deref_x(state, pb, e, "deref", group, set,

- 			     ref_attr, target_attr, NULL, disallowed,

- 			     restrict_subtrees, ignore_subtrees,

- 			     outbuf, outbuf_len, outbuf_choices,

- 			     rel_attrs, ref_attrs, inref_attrs,

- 			     ref_attr_list, inref_attr_list);

+ 	ret = format_deref_x(st, e, "deref", group, set,

+ 			     ref_attr, target_attr, NULL,

+ 			     outbuf, outbuf_len, outbuf_choices);

  	format_free_parsed_args(argv);

  	return ret;

  }

  

  static int

- format_deref_f(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,

+ format_deref_f(struct format_state *st, Slapi_Entry *e,

  	       const char *group, const char *set,

- 	       const char *args, const char *disallowed,

- 	       const struct slapi_dn **restrict_subtrees,

- 	       const struct slapi_dn **ignore_subtrees,

+ 	       const char *args,

  	       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)

+ 	       struct format_choice **outbuf_choices)

  {

  	int argc, ret;

  	char **argv, *ref_attr, *filter, *target_attr;

- 	ret = format_parse_args(state, args, &argc, &argv);

+ 	ret = format_parse_args(st, args, &argc, &argv);

  	if (ret != 0) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"deref_f: error parsing arguments\n");

  		return -EINVAL;

  	}

  	if (argc != 3) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"deref_f: requires three arguments\n");

  		format_free_parsed_args(argv);

  		return -EINVAL;

  	}

  	if (outbuf_choices == NULL) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"deref_f: returns a list, but a list "

  				"would not be appropriate\n");

  		format_free_parsed_args(argv);
@@ -1264,12 +1264,9 @@ 

  	ref_attr = argv[0];

  	filter = argv[1];

  	target_attr = argv[2];

- 	ret = format_deref_x(state, pb, e, "deref_f", group, set,

- 			     ref_attr, target_attr, filter, disallowed,

- 			     restrict_subtrees, ignore_subtrees,

- 			     outbuf, outbuf_len, outbuf_choices,

- 			     rel_attrs, ref_attrs, inref_attrs,

- 			     ref_attr_list, inref_attr_list);

+ 	ret = format_deref_x(st, e, "deref_f", group, set,

+ 			     ref_attr, target_attr, filter,

+ 			     outbuf, outbuf_len, outbuf_choices);

  	format_free_parsed_args(argv);

  	return ret;

  }
@@ -1279,18 +1276,11 @@ 

   * at last, pull out the values for the attribute named by the last argument,

   * and return a list of those values. */

  static int

- format_deref_rx(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,

+ format_deref_rx(struct format_state *st, Slapi_Entry *e,

  		const char *fname, const char *group, const char *set,

  		const char **attributes, const char **filters,

- 		const char *disallowed,

- 	        const struct slapi_dn **restrict_subtrees,

- 	        const struct slapi_dn **ignore_subtrees,

  		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)

+ 		struct format_choice **outbuf_choices)

  {

  	int i, j, k;

  	Slapi_Entry *entry;
@@ -1305,16 +1295,17 @@ 

  	struct format_ref_attr_list *list;

  

  	/* Note that this map cares about all of these attributes. */

- 	if (rel_attrs != NULL) {

+ 	if (st->config.rel_attrs != NULL) {

  		for (i = 0; attributes[i] != NULL; i++) {

- 			format_add_attrlist(rel_attrs, attributes[i]);

+ 			format_add_attrlist(st->config.rel_attrs, attributes[i]);

  		}

  	}

  

  	/* Note that this list of attributes is used for pulling up data. */

- 	format_add_ref_attr_list(ref_attr_list, group, set,

+ 	format_add_ref_attr_list(st->config.ref_attr_list, group, set,

  				 attributes, filters);

- 	list = format_find_ref_attr_list(*ref_attr_list, group, set,

+ 	list = format_find_ref_attr_list(*(st->config.ref_attr_list),

+ 					 group, set,

  					 attributes, filters);

  

  	/* Follow the chain: set up the first link. */
@@ -1342,7 +1333,7 @@ 

  			dn = slapi_sdn_get_ndn(these[j]);

  			slapi_sdn_get_parent(these[j], parent);

  			slapi_log_error(SLAPI_LOG_PLUGIN,

- 					state->plugin_desc->spd_id,

+ 					st->plugin_desc->spd_id,

  					"%s: noting parent "

  					"\"%s\" for \"%s\"\n",

  					fname, slapi_sdn_get_ndn(parent),
@@ -1352,31 +1343,28 @@ 

  					    slapi_sdn_get_ndn(parent));

  			/* Check if the referred-to entry is in a location that

  			 * we care about. */

- 			if (format_check_sdn_location(these[j],

- 						      restrict_subtrees,

- 						      ignore_subtrees) != 0) {

+ 			if (format_check_sdn_location(st, these[j]) != 0) {

  				slapi_log_error(SLAPI_LOG_PLUGIN,

- 						state->plugin_desc->spd_id,

+ 						st->plugin_desc->spd_id,

  						"%s: entry \"%s\" is in a location "

  						"where we don't look\n", fname,

  						slapi_sdn_get_ndn(these[j]));

  				continue;

  			}

  			/* Pull up the named entry. */

- 			wrap_search_internal_get_entry(pb, these[j],

- 						       NULL,

- 						       attrs, &entry,

- 						       state->plugin_identity);

+ 			format_search_get_entry(st, these[j],

+ 						NULL,

+ 						attrs, &entry);

  			if (entry == NULL) {

  				slapi_log_error(SLAPI_LOG_PLUGIN,

- 						state->plugin_desc->spd_id,

+ 						st->plugin_desc->spd_id,

  						"%s: error reading entry "

  						"\"%s\"\n", fname,

  						slapi_sdn_get_dn(these[j]));

  				continue;

  			} else {

  				slapi_log_error(SLAPI_LOG_PLUGIN,

- 						state->plugin_desc->spd_id,

+ 						st->plugin_desc->spd_id,

  						"%s: reading entry "

  						"\"%s\" (%d)\n", fname,

  						slapi_sdn_get_dn(these[j]), i);
@@ -1387,7 +1375,7 @@ 

  						   &actual_attr,

  						   0, &buffer_flags) != 0) {

  				slapi_log_error(SLAPI_LOG_PLUGIN,

- 						state->plugin_desc->spd_id,

+ 						st->plugin_desc->spd_id,

  						"%s: entry \"%s\" has no "

  						"values for \"%s\"\n", fname,

  						slapi_entry_get_dn(entry),
@@ -1407,23 +1395,19 @@ 

  					}

  					/* If it's in an area that we're

  					 * ignoring, then ignore it already. */

- 					if (format_check_dn_location(cvalue,

- 								     restrict_subtrees,

- 								     ignore_subtrees) != 0) {

+ 					if (format_check_dn_location(st, cvalue) != 0) {

  						continue;

  					}

  					/* Let's visit the named entry this

  					 * time, in case we're nesting. */

- 					format_maybe_add_sdn_list(pb, &these, &these2,

+ 					format_maybe_add_sdn_list(st, &these, &these2,

  								  cvalue,

- 								  list->links[i + 1].filter_str,

- 								  state->plugin_identity);

+ 								  list->links[i + 1].filter_str);

  					/* We need to visit the named entry

  					 * next time. */

- 					format_maybe_add_sdn_list(pb, &next, &next2,

+ 					format_maybe_add_sdn_list(st, &next, &next2,

  								  cvalue,

- 								  list->links[i + 1].filter_str,

- 								  state->plugin_identity);

+ 								  list->links[i + 1].filter_str);

  				} else {

  					/* Get the value. */

  					bval = slapi_value_get_berval(value);
@@ -1433,7 +1417,7 @@ 

  					}

  					format_add_bv_list(&choices, bval);

  					slapi_log_error(SLAPI_LOG_PLUGIN,

- 							state->plugin_desc->spd_id,

+ 							st->plugin_desc->spd_id,

  							"%s: found value "

  							"\"%.*s\" in \"%s\"\n",

  							fname,
@@ -1467,82 +1451,66 @@ 

  }

  

  static int

- format_deref_r(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,

+ format_deref_r(struct format_state *st, Slapi_Entry *e,

  	       const char *group, const char *set,

- 	       const char *args, const char *disallowed,

- 	       const struct slapi_dn **restrict_subtrees,

- 	       const struct slapi_dn **ignore_subtrees,

+ 	       const char *args,

  	       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)

+ 	       struct format_choice **outbuf_choices)

  {

  	int ret, argc;

  	char **argv;

- 	ret = format_parse_args(state, args, &argc, &argv);

+ 	ret = format_parse_args(st, args, &argc, &argv);

  	if (ret != 0) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"deref_r: error parsing arguments\n");

  		return -EINVAL;

  	}

  	if (argc < 2) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"deref_r: requires at least two arguments\n");

  		format_free_parsed_args(argv);

  		return -EINVAL;

  	}

  	if (outbuf_choices == NULL) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"deref_r: returns a list, but a list "

  				"would not be appropriate\n");

  		format_free_parsed_args(argv);

  		return -EINVAL;

  	}

- 	ret = format_deref_rx(state, pb, e, "deref_r",

+ 	ret = format_deref_rx(st, e, "deref_r",

  			      group, set,

  			      (const char **) argv, NULL,

- 			      disallowed,

- 			      restrict_subtrees, ignore_subtrees,

  			      outbuf, outbuf_len,

- 			      outbuf_choices,

- 			      rel_attrs, ref_attrs, inref_attrs,

- 			      ref_attr_list, inref_attr_list);

+ 			      outbuf_choices);

  	format_free_parsed_args(argv);

  	return ret;

  }

  

  static int

- format_deref_rf(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,

+ format_deref_rf(struct format_state *st, Slapi_Entry *e,

  		const char *group, const char *set,

- 		const char *args, const char *disallowed,

- 		const struct slapi_dn **restrict_subtrees,

- 		const struct slapi_dn **ignore_subtrees,

+ 		const char *args,

  		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)

+ 		struct format_choice **outbuf_choices)

  {

  	int ret, argc, n, i;

  	char **argv, **attrs, **filters;

- 	ret = format_parse_args(state, args, &argc, &argv);

+ 	ret = format_parse_args(st, args, &argc, &argv);

  	if (ret != 0) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"deref_rf: error parsing arguments\n");

  		return -EINVAL;

  	}

  	if (argc < 3) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"deref_rf: requires at least three "

  				"arguments\n");

  		format_free_parsed_args(argv);

  		return -EINVAL;

  	}

  	if (outbuf_choices == NULL) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"deref_rf: returns a list, but a list "

  				"would not be appropriate\n");

  		format_free_parsed_args(argv);
@@ -1552,7 +1520,7 @@ 

  	n = (argc + 1) / 2;

  	attrs = malloc(sizeof(char *) * (n + 1));

  	if (attrs == NULL) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"deref_rf: out of memory\n");

  		format_free_parsed_args(argv);

  		return -ENOMEM;
@@ -1560,7 +1528,7 @@ 

  	memset(attrs, 0, sizeof(char *) * (n + 1));

  	filters = malloc(sizeof(char *) * (n + 1));

  	if (filters == NULL) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"deref_rf: out of memory\n");

  		free(attrs);

  		format_free_parsed_args(argv);
@@ -1573,15 +1541,11 @@ 

  			filters[i + 1] = argv[i * 2 + 1];

  		}

  	}

- 	ret = format_deref_rx(state, pb, e, "deref_rf",

+ 	ret = format_deref_rx(st, e, "deref_rf",

  			      group, set,

  			      (const char **) attrs, (const char **) filters,

- 			      disallowed,

- 			      restrict_subtrees, ignore_subtrees,

  			      outbuf, outbuf_len,

- 			      outbuf_choices,

- 			      rel_attrs, ref_attrs, inref_attrs,

- 			      ref_attr_list, inref_attr_list);

+ 			      outbuf_choices);

  	free(filters);

  	free(attrs);

  	format_free_parsed_args(argv);
@@ -1593,7 +1557,7 @@ 

   * the values for the attribute named by the third argument, and return a list

   * of those values. */

  struct format_referred_cbdata {

- 	struct plugin_state *state;

+ 	struct format_state *st;

  	char *attr;

  	struct berval **choices;

  };
@@ -1610,7 +1574,7 @@ 

  	cbdata = callback_data;

  

  	slapi_log_error(SLAPI_LOG_PLUGIN,

- 			cbdata->state->plugin_desc->spd_id,

+ 			cbdata->st->plugin_desc->spd_id,

  			"referred: examining \"%s\" in \%s\"\n",

  			cbdata->attr, slapi_entry_get_ndn(e));

  
@@ -1619,7 +1583,7 @@ 

  				   &disposition, &actual_attr,

  				   0, &buffer_flags) != 0) {

  		slapi_log_error(SLAPI_LOG_PLUGIN,

- 				cbdata->state->plugin_desc->spd_id,

+ 				cbdata->st->plugin_desc->spd_id,

  				"referred: no values for \"%s\" in \"%s\"\n",

  				cbdata->attr, slapi_entry_get_ndn(e));

  		return 0;
@@ -1633,7 +1597,7 @@ 

  			continue;

  		}

  		slapi_log_error(SLAPI_LOG_PLUGIN,

- 				cbdata->state->plugin_desc->spd_id,

+ 				cbdata->st->plugin_desc->spd_id,

  				"referred: got %d-byte value for \"%s\"\n",

  				(int) val->bv_len, actual_attr);

  		/* Add it to the list of values we've retrieved. */
@@ -1643,17 +1607,11 @@ 

  	return 0;

  }

  static int

- format_referred(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,

+ format_referred(struct format_state *st, Slapi_Entry *e,

  		const char *group, const char *set,

- 		const char *args, const char *disallowed,

- 		const struct slapi_dn **restrict_subtrees,

- 		const struct slapi_dn **ignore_subtrees,

+ 		const char *args,

  		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)

+ 		struct format_choice **outbuf_choices)

  {

  	int i, ret, argc;

  	Slapi_PBlock *local_pb;
@@ -1661,20 +1619,20 @@ 

  	char *other_set, *set_filter, **set_bases, *use_filter;

  	struct format_referred_cbdata cbdata;

  

- 	ret = format_parse_args(state, args, &argc, &argv);

+ 	ret = format_parse_args(st, args, &argc, &argv);

  	if (ret != 0) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"referred: error parsing arguments\n");

  		return -EINVAL;

  	}

  	if (argc != 3) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"referred: requires 3 arguments\n");

  		format_free_parsed_args(argv);

  		return -EINVAL;

  	}

  	if (outbuf_choices == NULL) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"referred: returns a list, but a list would "

  				"not be appropriate here\n");

  		format_free_parsed_args(argv);
@@ -1685,7 +1643,7 @@ 

  	attr = argv[2];

  

  	/* Set up to search for matches. */

- 	cbdata.state = state;

+ 	cbdata.st = st;

  	cbdata.attr = attr;

  	cbdata.choices = NULL;

  
@@ -1693,27 +1651,27 @@ 

  	 * examine. */

  	set_filter = NULL;

  	set_bases = NULL;

- 	backend_get_set_config(pb, state, group, other_set,

- 			       &set_bases, &set_filter);

+ 	st->get_bases_filter(st, group, other_set,

+ 			     &set_bases, &set_filter);

  	if (set_bases == NULL) {

  		slapi_log_error(SLAPI_LOG_PLUGIN,

- 				state->plugin_desc->spd_id,

+ 				st->plugin_desc->spd_id,

  				"no search bases defined for \"%s\"/\"%s\"?\n",

  				group, other_set);

- 		backend_free_set_config(set_bases, set_filter);

+ 		st->free_bases_filter(st, &set_bases, &set_filter);

  		format_free_parsed_args(argv);

  		return -ENOENT;

  	}

  

  	/* Note that this map cares about both attributes. */

- 	if (rel_attrs != NULL) {

- 		format_add_attrlist(rel_attrs, other_attr);

- 		format_add_attrlist(rel_attrs, attr);

+ 	if (st->config.rel_attrs != NULL) {

+ 		format_add_attrlist(st->config.rel_attrs, other_attr);

+ 		format_add_attrlist(st->config.rel_attrs, attr);

  	}

  

  	/* Note that the attribute in this map refers to this entry. */

- 	if (inref_attrs != NULL) {

- 		format_add_inref_attrs(inref_attrs, group,

+ 	if (st->config.inref_attrs != NULL) {

+ 		format_add_inref_attrs(st->config.inref_attrs, group,

  				       other_set, other_attr);

  	}

  
@@ -1722,9 +1680,9 @@ 

  	tndn = format_escape_for_filter(slapi_entry_get_ndn(e));

  	if (tndn == NULL) {

  		slapi_log_error(SLAPI_LOG_PLUGIN,

- 				state->plugin_desc->spd_id,

+ 				st->plugin_desc->spd_id,

  				"referred: out of memory\n");

- 		backend_free_set_config(set_bases, set_filter);

+ 		st->free_bases_filter(st, &set_bases, &set_filter);

  		format_free_parsed_args(argv);

  		return -ENOMEM;

  	}
@@ -1732,10 +1690,10 @@ 

  	filter = malloc(strlen(use_filter) + strlen(other_attr) +

  			strlen(tndn) + 7);

  	if (filter == NULL) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"referred: out of memory\n");

  		free(tndn);

- 		backend_free_set_config(set_bases, set_filter);

+ 		st->free_bases_filter(st, &set_bases, &set_filter);

  		format_free_parsed_args(argv);

  		return -ENOMEM;

  	}
@@ -1747,26 +1705,28 @@ 

  	attrs[1] = NULL;

  	for (i = 0; (set_bases != NULL) && (set_bases[i] != NULL); i++) {

  		/* Set up the search. */

- 		local_pb = wrap_pblock_new(pb);

+ 		local_pb = slapi_pblock_new();

  		slapi_search_internal_set_pb(local_pb,

  					     set_bases[i], LDAP_SCOPE_SUBTREE,

  					     filter, attrs, FALSE,

  					     NULL, NULL,

- 					     state->plugin_identity, 0);

+ 					     st->plugin_identity, 0);

  		/* Let the callback do the work of saving a value. */

  		slapi_log_error(SLAPI_LOG_PLUGIN,

- 				state->plugin_desc->spd_id,

+ 				st->plugin_desc->spd_id,

  				"searching under \"%s\" for \"%s\"\n",

  				set_bases[i], filter);

- 		slapi_search_internal_callback_pb(local_pb, &cbdata,

- 						  NULL,

- 						  format_referred_entry_cb,

- 						  NULL);

+ 		(void) st->search_callback_pb(st,

+ 					      local_pb,

+ 					      &cbdata,

+ 					      NULL,

+ 					      format_referred_entry_cb,

+ 					      NULL);

  		slapi_pblock_destroy(local_pb);

  	}

  	free(filter);

  

- 	backend_free_set_config(set_bases, set_filter);

+ 	st->free_bases_filter(st, &set_bases, &set_filter);

  	format_free_parsed_args(argv);

  

  	/* Return any values we found. */
@@ -1780,7 +1740,7 @@ 

  

  /* Add the name of this entry to the DN list in the cbdata. */

  struct format_referred_r_entry_cbdata {

- 	struct plugin_state *state;

+ 	struct format_state *st;

  	char *attribute;

  	struct berval ***choices;

  	Slapi_DN ***sdn_list, ***sdn_list2;
@@ -1798,7 +1758,7 @@ 

  	char *actual_attr;

  

  	/* Note that we visited this entry. */

- 	slapi_log_error(SLAPI_LOG_PLUGIN, cbdata->state->plugin_desc->spd_id,

+ 	slapi_log_error(SLAPI_LOG_PLUGIN, cbdata->st->plugin_desc->spd_id,

  			"search matched entry \"%s\"\n", slapi_entry_get_dn(e));

  	format_add_sdn_list(cbdata->sdn_list, cbdata->sdn_list2,

  			    slapi_entry_get_dn(e));
@@ -1812,7 +1772,7 @@ 

  					   &actual_attr,

  					   0, &buffer_flags) != 0) {

  			slapi_log_error(SLAPI_LOG_PLUGIN,

- 					cbdata->state->plugin_desc->spd_id,

+ 					cbdata->st->plugin_desc->spd_id,

  					"referred_r: entry \"%s\" has no "

  					"values for \"%s\"\n",

  					slapi_sdn_get_dn(sdn),
@@ -1830,7 +1790,7 @@ 

  				}

  				format_add_bv_list(cbdata->choices, bval);

  				slapi_log_error(SLAPI_LOG_PLUGIN,

- 						cbdata->state->plugin_desc->spd_id,

+ 						cbdata->st->plugin_desc->spd_id,

  						"referred_r: found value "

  						"\"%.*s\" in \"%s\"\n",

  						(int) bval->bv_len,
@@ -1850,17 +1810,11 @@ 

   * get to the last argument, at which point we return the value of the

   * attribute named by the final argument. */

  static int

- format_referred_r(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,

+ format_referred_r(struct format_state *st, Slapi_Entry *e,

  		  const char *group, const char *set,

- 		  const char *args, const char *disallowed,

- 		  const struct slapi_dn **restrict_subtrees,

- 		  const struct slapi_dn **ignore_subtrees,

+ 		  const char *args,

  		  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)

+ 		  struct format_choice **outbuf_choices)

  {

  	int i, j, k, ret, argc, attrs_list_length;

  	Slapi_PBlock *local_pb;
@@ -1873,27 +1827,27 @@ 

  	char *set_filter, **set_bases;

  	const char **attr_links, *ndn;

  

- 	ret = format_parse_args(state, args, &argc, &argv);

+ 	ret = format_parse_args(st, args, &argc, &argv);

  	if (ret != 0) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"referred_r: error parsing arguments\n");

  		return -EINVAL;

  	}

  	if (argc < 3) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"referred_r: requires at least 3 arguments\n");

  		format_free_parsed_args(argv);

  		return -EINVAL;

  	}

  	if ((argc % 2) != 1) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"referred_r: requires an odd number of "

  				"arguments\n");

  		format_free_parsed_args(argv);

  		return -EINVAL;

  	}

  	if (outbuf_choices == NULL) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"referred_r: returns a list, but a list would "

  				"not be appropriate here\n");

  		format_free_parsed_args(argv);
@@ -1906,7 +1860,7 @@ 

  	attrs_list_length = (argc + 1) / 2;

  	attr_links = malloc((attrs_list_length + 1) * sizeof(char *));

  	if (attr_links == NULL) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"referred_r: out of memory\n");

  		format_free_parsed_args(argv);

  		return -ENOMEM;
@@ -1921,33 +1875,35 @@ 

  	attr_links[i] = NULL;

  

  	/* Note that this map cares about these attributes. */

- 	if (rel_attrs != NULL) {

- 		format_add_attrlist(rel_attrs, attr);

+ 	if (st->config.rel_attrs != NULL) {

+ 		format_add_attrlist(st->config.rel_attrs, attr);

  		for (i = 0; attr_links[i] != NULL; i++) {

- 			format_add_attrlist(rel_attrs, attr_links[i]);

+ 			format_add_attrlist(st->config.rel_attrs, attr_links[i]);

  		}

  	}

  

  	/* Note this list of attributes. */

- 	format_add_ref_attr_list(inref_attr_list, group, set, attr_links, NULL);

- 	list = format_find_ref_attr_list(*inref_attr_list, group, set,

+ 	format_add_ref_attr_list(st->config.inref_attr_list, group, set, attr_links, NULL);

+ 	list = format_find_ref_attr_list(*(st->config.inref_attr_list), group, set,

  					 attr_links, NULL);

  	free(attr_links);

  

  	/* Get the searching parameters for the set which contains the entry,

  	 * and all of the referred-to sets, and save them for use at the last

  	 * link in the chain. */

- 	backend_get_set_config(pb, state, group, set,

- 			       &set_bases, &set_filter);

+ 	/* wrap_pblock_new() ignores its argument */

+ 	st->get_bases_filter(st, group, set,

+ 			     &set_bases, &set_filter);

  	for (i = 0; (set_bases != NULL) && (set_bases[i] != NULL); i++) {

  		format_add_sdn_list(&(list->links[0].base_sdn_list),

  				    &(list->links[0].base_sdn_list2),

  				    set_bases[i]);

  	}

- 	backend_free_set_config(set_bases, set_filter);

+ 	st->free_bases_filter(st, &set_bases, &set_filter);

  	for (i = 0; i < list->n_links - 1; i++) {

- 		backend_get_set_config(pb, state, group, argv[i * 2],

- 				       &set_bases, &set_filter);

+ 		/* wrap_pblock_new() ignores its argument */

+ 		st->get_bases_filter(st, group, argv[i * 2],

+ 				     &set_bases, &set_filter);

  		for (j = 0;

  		     (set_bases != NULL) && (set_bases[j] != NULL);

  		     j++) {
@@ -1955,7 +1911,7 @@ 

  					    &(list->links[i + 1].base_sdn_list2),

  					    set_bases[j]);

  		}

- 		backend_free_set_config(set_bases, set_filter);

+ 		st->free_bases_filter(st, &set_bases, &set_filter);

  	}

  

  	/* Walk the chain, searching for entries which refer to entries at
@@ -2001,29 +1957,30 @@ 

  				ndn = slapi_sdn_get_dn(these_bases[k]);

  				/* Search for referrers under this tree. */

  				slapi_log_error(SLAPI_LOG_PLUGIN,

- 						state->plugin_desc->spd_id,

+ 						st->plugin_desc->spd_id,

  						"referred_r: searching under %s"

  						" for \"%s\" (link=1.%d)\n",

  						ndn, filter, i);

- 				local_pb = wrap_pblock_new(pb);

+ 				local_pb = slapi_pblock_new();

  				slapi_search_internal_set_pb(local_pb,

  							     ndn,

  							     LDAP_SCOPE_SUBTREE,

  							     filter, attrs,

  							     FALSE,

  							     NULL, NULL,

- 							     state->plugin_identity,

+ 							     st->plugin_identity,

  							     0);

- 				entry_cbdata.state = state;

+ 				entry_cbdata.st = st;

  				entry_cbdata.attribute = attr;

  				entry_cbdata.choices = &choices;

  				entry_cbdata.sdn_list = &these_entries;

  				entry_cbdata.sdn_list2 = &these_entries2;

- 				slapi_search_internal_callback_pb(local_pb,

- 								  &entry_cbdata,

- 								  NULL,

- 								  format_referred_r_entry_cb,

- 								  NULL);

+ 				(void) st->search_callback_pb(st,

+ 							      local_pb,

+ 							      &entry_cbdata,

+ 							      NULL,

+ 							      format_referred_r_entry_cb,

+ 							      NULL);

  				slapi_pblock_destroy(local_pb);

  			}

  			free(filter);
@@ -2042,29 +1999,30 @@ 

  				ndn = slapi_sdn_get_dn(next_bases[k]);

  				/* Search for referrers under that tree. */

  				slapi_log_error(SLAPI_LOG_PLUGIN,

- 						state->plugin_desc->spd_id,

+ 						st->plugin_desc->spd_id,

  						"referred_r: searching under %s"

  						" for \"%s\" (link=2.%d)\n",

  						ndn, filter, i);

- 				local_pb = wrap_pblock_new(pb);

+ 				local_pb = slapi_pblock_new();

  				slapi_search_internal_set_pb(local_pb,

  							     ndn,

  							     LDAP_SCOPE_SUBTREE,

  							     filter, attrs,

  							     FALSE,

  							     NULL, NULL,

- 							     state->plugin_identity,

+ 							     st->plugin_identity,

  							     0);

- 				entry_cbdata.state = state;

+ 				entry_cbdata.st = st;

  				entry_cbdata.attribute = attr;

  				entry_cbdata.choices = &choices;

  				entry_cbdata.sdn_list = &next_entries;

  				entry_cbdata.sdn_list2 = &next_entries2;

- 				slapi_search_internal_callback_pb(local_pb,

- 								  &entry_cbdata,

- 								  NULL,

- 								  format_referred_r_entry_cb,

- 								  NULL);

+ 				(void) st->search_callback_pb(st,

+ 							      local_pb,

+ 							      &entry_cbdata,

+ 							      NULL,

+ 							      format_referred_r_entry_cb,

+ 							      NULL);

  				slapi_pblock_destroy(local_pb);

  			}

  			free(filter);
@@ -2093,31 +2051,25 @@ 

  /* Evaluate each argument's list of results, after the first, in turn, and

   * merge them, using the first argument as a separator. */

  static int

- format_merge(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,

+ format_merge(struct format_state *st, Slapi_Entry *e,

  	     const char *group, const char *set,

- 	     const char *args, const char *disallowed,

- 	     const struct slapi_dn **restrict_subtrees,

- 	     const struct slapi_dn **ignore_subtrees,

+ 	     const char *args,

  	     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)

+ 	     struct format_choice **outbuf_choices)

  {

  	int ret, i, j, argc, slen, count;

  	unsigned int *lengths;

  	char **argv, **values;

  	const char *sep;

  

- 	ret = format_parse_args(state, args, &argc, &argv);

+ 	ret = format_parse_args(st, args, &argc, &argv);

  	if (ret != 0) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"merge: error parsing arguments\n");

  		return -EINVAL;

  	}

  	if (argc < 1) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"merge: requires at least one argument\n");

  		format_free_parsed_args(argv);

  		return -EINVAL;
@@ -2126,17 +2078,14 @@ 

  	slen = strlen(sep);

  	for (i = 1, ret = 0, count = 0; i < argc; i++) {

  		/* Expand this argument. */

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"merge: expanding ->%s<-\n", argv[i]);

- 		values = format_get_data_set(state, pb, e, group, set,

- 					     argv[i], disallowed,

- 					     restrict_subtrees, ignore_subtrees,

- 					     rel_attrs, ref_attrs, inref_attrs,

- 					     ref_attr_list, inref_attr_list,

- 					     &lengths);

+ 		values = format_get_data_set_int(st, e, group, set,

+ 						 argv[i],

+ 						 &lengths);

  		if (values == NULL) {

  			slapi_log_error(SLAPI_LOG_PLUGIN,

- 					state->plugin_desc->spd_id,

+ 					st->plugin_desc->spd_id,

  					"merge: no values for ->%s<-\n",

  					argv[i]);

  			continue;
@@ -2146,7 +2095,7 @@ 

  			if (ret + lengths[j] + (count ? slen : 0) >

  			    (unsigned int) outbuf_len) {

  				slapi_log_error(SLAPI_LOG_PLUGIN,

- 						state->plugin_desc->spd_id,

+ 						st->plugin_desc->spd_id,

  						"merge: out of space\n");

  				format_free_data_set(values, lengths);

  				format_free_parsed_args(argv);
@@ -2154,7 +2103,7 @@ 

  			}

  			/* Log this value. */

  			slapi_log_error(SLAPI_LOG_PLUGIN,

- 					state->plugin_desc->spd_id,

+ 					st->plugin_desc->spd_id,

  					"merge: got %d-byte value for ->%s<\n",

  					lengths[j], argv[i]);

  			/* If this isn't the first result, fill in the
@@ -2179,20 +2128,11 @@ 

   * of the default_arg'th argument if given, or return everything if no

   * default_arg'th argument was given. */

  static int

- format_match_generic(struct plugin_state *state,

- 		     Slapi_PBlock *pb, Slapi_Entry *e,

+ format_match_generic(struct format_state *st, Slapi_Entry *e,

  		     const char *group, const char *set,

  		     const char *args, int min_args, int default_arg,

- 		     const char *disallowed,

- 		     const struct slapi_dn **restrict_subtrees,

- 		     const struct slapi_dn **ignore_subtrees,

  		     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,

  		     const char *fnname,

  		     char * (*match_fn)(const char *pattern, const char *value,

  					char **argv))
@@ -2201,8 +2141,8 @@ 

  	int i, count, argc, ret, len;

  	unsigned int *lengths, default_length;

  

- 	plugin_id = state->plugin_desc->spd_id;

- 	ret = format_parse_args(state, args, &argc, &argv);

+ 	plugin_id = st->plugin_desc->spd_id;

+ 	ret = format_parse_args(st, args, &argc, &argv);

  	if (ret != 0) {

  		slapi_log_error(SLAPI_LOG_PLUGIN, plugin_id,

  				"%s: error parsing arguments\n", fnname);
@@ -2219,12 +2159,9 @@ 

  	matches = NULL;

  	count = 0;

  	lengths = NULL;

- 	values = format_get_data_set(state, pb, e, group, set,

- 				     argv[0], disallowed,

- 				     restrict_subtrees, ignore_subtrees,

- 				     rel_attrs, ref_attrs, inref_attrs,

- 				     ref_attr_list, inref_attr_list,

- 				     &lengths);

+ 	values = format_get_data_set_int(st, e, group, set,

+ 					 argv[0],

+ 					 &lengths);

  	if (values != NULL) {

  		for (i = 0; values[i] != NULL; i++) {

  			continue;
@@ -2273,18 +2210,11 @@ 

  		 * many matches to store. */

  		default_value = NULL;

  		if ((default_arg >= 0) && (argv[default_arg] != NULL)) {

- 			default_value = format_get_data(state, pb, e,

- 							group, set,

- 							argv[default_arg],

- 							disallowed,

- 							restrict_subtrees,

- 							ignore_subtrees,

- 							rel_attrs,

- 							ref_attrs,

- 							inref_attrs,

- 							ref_attr_list,

- 							inref_attr_list,

- 							&default_length);

+ 			default_value = format_format(st, e,

+ 						      group, set,

+ 						      argv[default_arg],

+ 						      NULL,

+ 						      &default_length);

  		}

  		if (default_arg < 0) {

  			/* Return all of the matches as a list. */
@@ -2384,47 +2314,25 @@ 

  	return (fnmatch(pattern, value, 0) == 0) ? strdup(value) : NULL;

  }

  static int

- format_match(struct plugin_state *state,

- 	     Slapi_PBlock *pb, Slapi_Entry *e,

+ format_match(struct format_state *st, Slapi_Entry *e,

  	     const char *group, const char *set,

- 	     const char *args, const char *disallowed,

- 	     const struct slapi_dn **restrict_subtrees,

- 	     const struct slapi_dn **ignore_subtrees,

+ 	     const char *args,

  	     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)

+ 	     struct format_choice **outbuf_choices)

  {

- 	return format_match_generic(state, pb, e, group, set, args, 2, 2,

- 				    disallowed,

- 				    restrict_subtrees, ignore_subtrees,

+ 	return format_match_generic(st, e, group, set, args, 2, 2,

  				    outbuf, outbuf_len, outbuf_choices,

- 				    rel_attrs, ref_attrs, inref_attrs,

- 				    ref_attr_list, inref_attr_list,

  				    "format_match", format_match_cb);

  }

  static int

- format_mmatch(struct plugin_state *state,

- 	      Slapi_PBlock *pb, Slapi_Entry *e,

+ format_mmatch(struct format_state *st, Slapi_Entry *e,

  	      const char *group, const char *set,

- 	      const char *args, const char *disallowed,

- 	      const struct slapi_dn **restrict_subtrees,

- 	      const struct slapi_dn **ignore_subtrees,

+ 	      const char *args,

  	      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)

+ 	      struct format_choice **outbuf_choices)

  {

- 	return format_match_generic(state, pb, e, group, set, args, 2, -1,

- 				    disallowed,

- 				    restrict_subtrees, ignore_subtrees,

+ 	return format_match_generic(st, e, group, set, args, 2, -1,

  				    outbuf, outbuf_len, outbuf_choices,

- 				    rel_attrs, ref_attrs, inref_attrs,

- 				    ref_attr_list, inref_attr_list,

  				    "format_mmatch", format_match_cb);

  }

  
@@ -2450,47 +2358,25 @@ 

  	return format_regmatch_base_cb(pattern, 0, value, argv);

  }

  static int

- format_regmatch(struct plugin_state *state,

- 		Slapi_PBlock *pb, Slapi_Entry *e,

+ format_regmatch(struct format_state *st, Slapi_Entry *e,

  		const char *group, const char *set,

- 		const char *args, const char *disallowed,

- 		const struct slapi_dn **restrict_subtrees,

- 		const struct slapi_dn **ignore_subtrees,

+ 		const char *args,

  		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)

+ 		struct format_choice **outbuf_choices)

  {

- 	return format_match_generic(state, pb, e, group, set, args, 2, 2,

- 				    disallowed,

- 				    restrict_subtrees, ignore_subtrees,

+ 	return format_match_generic(st, e, group, set, args, 2, 2,

  				    outbuf, outbuf_len, outbuf_choices,

- 				    rel_attrs, ref_attrs, inref_attrs,

- 				    ref_attr_list, inref_attr_list,

  				    "format_regmatch", format_regmatch_cb);

  }

  static int

- format_mregmatch(struct plugin_state *state,

- 		 Slapi_PBlock *pb, Slapi_Entry *e,

+ format_mregmatch(struct format_state *st, Slapi_Entry *e,

  		 const char *group, const char *set,

- 		 const char *args, const char *disallowed,

- 		 const struct slapi_dn **restrict_subtrees,

- 		 const struct slapi_dn **ignore_subtrees,

+ 		 const char *args,

  		 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)

+ 		 struct format_choice **outbuf_choices)

  {

- 	return format_match_generic(state, pb, e, group, set, args, 2, -1,

- 				    disallowed,

- 				    restrict_subtrees, ignore_subtrees,

+ 	return format_match_generic(st, e, group, set, args, 2, -1,

  				    outbuf, outbuf_len, outbuf_choices,

- 				    rel_attrs, ref_attrs, inref_attrs,

- 				    ref_attr_list, inref_attr_list,

  				    "format_mregmatch", format_regmatch_cb);

  }

  static char *
@@ -2499,47 +2385,25 @@ 

  	return format_regmatch_base_cb(pattern, REG_ICASE, value, argv);

  }

  static int

- format_regmatchi(struct plugin_state *state,

- 		 Slapi_PBlock *pb, Slapi_Entry *e,

+ format_regmatchi(struct format_state *st, Slapi_Entry *e,

  		 const char *group, const char *set,

- 		 const char *args, const char *disallowed,

- 		 const struct slapi_dn **restrict_subtrees,

- 		 const struct slapi_dn **ignore_subtrees,

+ 		 const char *args,

  		 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)

+ 		 struct format_choice **outbuf_choices)

  {

- 	return format_match_generic(state, pb, e, group, set, args, 2, 2,

- 				    disallowed,

- 				    restrict_subtrees, ignore_subtrees,

+ 	return format_match_generic(st, e, group, set, args, 2, 2,

  				    outbuf, outbuf_len, outbuf_choices,

- 				    rel_attrs, ref_attrs, inref_attrs,

- 				    ref_attr_list, inref_attr_list,

  				    "format_regmatchi", format_regmatchi_cb);

  }

  static int

- format_mregmatchi(struct plugin_state *state,

- 		  Slapi_PBlock *pb, Slapi_Entry *e,

+ format_mregmatchi(struct format_state *st, Slapi_Entry *e,

  		  const char *group, const char *set,

- 		  const char *args, const char *disallowed,

- 		  const struct slapi_dn **restrict_subtrees,

- 		  const struct slapi_dn **ignore_subtrees,

+ 		  const char *args,

  		  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)

+ 		  struct format_choice **outbuf_choices)

  {

- 	return format_match_generic(state, pb, e, group, set, args, 2, -1,

- 				    disallowed,

- 				    restrict_subtrees, ignore_subtrees,

+ 	return format_match_generic(st, e, group, set, args, 2, -1,

  				    outbuf, outbuf_len, outbuf_choices,

- 				    rel_attrs, ref_attrs, inref_attrs,

- 				    ref_attr_list, inref_attr_list,

  				    "format_mregmatchi", format_regmatchi_cb);

  }

  
@@ -2658,47 +2522,25 @@ 

  	return format_regsub_base_cb(pattern, 0, value, argv);

  }

  static int

- format_regsub(struct plugin_state *state,

- 	      Slapi_PBlock *pb, Slapi_Entry *e,

+ format_regsub(struct format_state *st, Slapi_Entry *e,

  	      const char *group, const char *set,

- 	      const char *args, const char *disallowed,

- 	      const struct slapi_dn **restrict_subtrees,

- 	      const struct slapi_dn **ignore_subtrees,

+ 	      const char *args,

  	      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)

+ 	      struct format_choice **outbuf_choices)

  {

- 	return format_match_generic(state, pb, e, group, set, args, 3, 3,

- 				    disallowed,

- 				    restrict_subtrees, ignore_subtrees,

+ 	return format_match_generic(st, e, group, set, args, 3, 3,

  				    outbuf, outbuf_len, outbuf_choices,

- 				    rel_attrs, ref_attrs, inref_attrs,

- 				    ref_attr_list, inref_attr_list,

  				    "format_regsub", format_regsub_cb);

  }

  static int

- format_mregsub(struct plugin_state *state,

- 	       Slapi_PBlock *pb, Slapi_Entry *e,

+ format_mregsub(struct format_state *st, Slapi_Entry *e,

  	       const char *group, const char *set,

- 	       const char *args, const char *disallowed,

- 	       const struct slapi_dn **restrict_subtrees,

- 	       const struct slapi_dn **ignore_subtrees,

+ 	       const char *args,

  	       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)

+ 	       struct format_choice **outbuf_choices)

  {

- 	return format_match_generic(state, pb, e, group, set, args, 3, -1,

- 				    disallowed,

- 				    restrict_subtrees, ignore_subtrees,

+ 	return format_match_generic(st, e, group, set, args, 3, -1,

  				    outbuf, outbuf_len, outbuf_choices,

- 				    rel_attrs, ref_attrs, inref_attrs,

- 				    ref_attr_list, inref_attr_list,

  				    "format_mregsub", format_regsub_cb);

  }

  static char *
@@ -2707,47 +2549,25 @@ 

  	return format_regsub_base_cb(pattern, REG_ICASE, value, argv);

  }

  static int

- format_regsubi(struct plugin_state *state,

- 	       Slapi_PBlock *pb, Slapi_Entry *e,

+ format_regsubi(struct format_state *st, Slapi_Entry *e,

  	       const char *group, const char *set,

- 	       const char *args, const char *disallowed,

- 	       const struct slapi_dn **restrict_subtrees,

- 	       const struct slapi_dn **ignore_subtrees,

+ 	       const char *args,

  	       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)

+ 	       struct format_choice **outbuf_choices)

  {

- 	return format_match_generic(state, pb, e, group, set, args, 3, 3,

- 				    disallowed,

- 				    restrict_subtrees, ignore_subtrees,

+ 	return format_match_generic(st, e, group, set, args, 3, 3,

  				    outbuf, outbuf_len, outbuf_choices,

- 				    rel_attrs, ref_attrs, inref_attrs,

- 				    ref_attr_list, inref_attr_list,

  				    "format_regsubi", format_regsubi_cb);

  }

  static int

- format_mregsubi(struct plugin_state *state,

- 		Slapi_PBlock *pb, Slapi_Entry *e,

+ format_mregsubi(struct format_state *st, Slapi_Entry *e,

  		const char *group, const char *set,

- 		const char *args, const char *disallowed,

- 		const struct slapi_dn **restrict_subtrees,

- 		const struct slapi_dn **ignore_subtrees,

+ 		const char *args,

  		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)

+ 		struct format_choice **outbuf_choices)

  {

- 	return format_match_generic(state, pb, e, group, set, args, 3, -1,

- 				    disallowed,

- 				    restrict_subtrees, ignore_subtrees,

+ 	return format_match_generic(st, e, group, set, args, 3, -1,

  				    outbuf, outbuf_len, outbuf_choices,

- 				    rel_attrs, ref_attrs, inref_attrs,

- 				    ref_attr_list, inref_attr_list,

  				    "format_mregsubi", format_regsubi_cb);

  }

  
@@ -2757,17 +2577,11 @@ 

   * exactly we needed to do the comparison check (specifically,

   * case-sensitivity). */

  static int

- format_ifeq(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,

+ format_ifeq(struct format_state *st, Slapi_Entry *e,

  	    const char *group, const char *set,

- 	    const char *args, const char *disallowed,

- 	    const struct slapi_dn **restrict_subtrees,

- 	    const struct slapi_dn **ignore_subtrees,

+ 	    const char *args,

  	    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)

+ 	    struct format_choice **outbuf_choices)

  {

  	int ret, argc, i;

  	unsigned int *lengths;
@@ -2776,20 +2590,20 @@ 

  	struct berval bv;

  	Slapi_Value *value;

  

- 	ret = format_parse_args(state, args, &argc, &argv);

+ 	ret = format_parse_args(st, args, &argc, &argv);

  	if (ret != 0) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"ifeq: error parsing arguments\n");

  		return -EINVAL;

  	}

  	if (argc < 1) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"ifeq: error parsing arguments\n");

  		format_free_parsed_args(argv);

  		return -EINVAL;

  	}

  	if (argc != 4) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"ifeq: expected four arguments (got %d)\n",

  				argc);

  		format_free_parsed_args(argv);
@@ -2797,24 +2611,21 @@ 

  	}

  

  	/* Note that this map cares about the tested attribute. */

- 	if (rel_attrs != NULL) {

- 		format_add_attrlist(rel_attrs, argv[0]);

+ 	if (st->config.rel_attrs != NULL) {

+ 		format_add_attrlist(st->config.rel_attrs, argv[0]);

  	}

  

  	/* Evaluate the value expression to get a list of candidate values. */

- 	values = format_get_data_set(state, pb, e, group, set,

- 				     argv[1], disallowed,

- 				     restrict_subtrees, ignore_subtrees,

- 				     rel_attrs, ref_attrs, inref_attrs,

- 				     ref_attr_list, inref_attr_list,

- 				     &lengths);

+ 	values = format_get_data_set_int(st, e, group, set,

+ 					 argv[1],

+ 					 &lengths);

  	if (values == NULL) {

- 		slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 		slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  				"ifeq: error evaluating \"%s\"\n", argv[1]);

  		format_free_parsed_args(argv);

- 		/* Shouldn't be necessary, since format_get_data_set() should

- 		 * only ever return a NULL lengths list when it returns NULL,

- 		 * but it'll make tools happy. */

+ 		/* Shouldn't be necessary, since format_get_data_set_int()

+ 		 * should only ever return a NULL lengths list when it returns

+ 		 * NULL, but it'll make tools happy. */

  		free(lengths);

  		return -EINVAL;

  	}
@@ -2837,7 +2648,7 @@ 

  		}

  	}

  	slapi_value_free(&value);

- 	slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,

+ 	slapi_log_error(SLAPI_LOG_PLUGIN, st->plugin_desc->spd_id,

  			"ifeq: \"%s\" %s \"%s\"\n",

  			argv[0], matched ? "matches" : "doesn't match",

  			argv[1]);
@@ -2845,14 +2656,10 @@ 

  

  	/* Evaluate the argument which corresponds to the output expression and

  	 * return its values. */

- 	ret = format_expand(state, pb, e, group, set,

- 			    argv[matched ? 2 : 3], disallowed,

- 			    restrict_subtrees,

- 			    ignore_subtrees,

+ 	ret = format_expand(st, e, group, set,

+ 			    argv[matched ? 2 : 3],

  			    outbuf, outbuf_len,

- 			    outbuf_choices,

- 			    rel_attrs, ref_attrs, inref_attrs,

- 			    ref_attr_list, inref_attr_list);

+ 			    outbuf_choices);

  	format_free_parsed_args(argv);

  	return ret;

  }
@@ -2860,29 +2667,23 @@ 

  /* If the expression given as the first argument returns any values, return

   * them.  Otherwise, return the second expression. */

  static int

- format_default(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e,

+ format_default(struct format_state *st, Slapi_Entry *e,

  	       const char *group, const char *set,

- 	       const char *args, const char *disallowed,

- 	       const struct slapi_dn **restrict_subtrees,

- 	       const struct slapi_dn **ignore_subtrees,

+ 	       const char *args,

  	       char *outbuf, int outbuf_len,