summaryrefslogtreecommitdiffstats
path: root/src/backend.c
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin.dahyabhai@pobox.com>2008-06-02 14:22:47 -0400
committerNalin Dahyabhai <nalin.dahyabhai@pobox.com>2008-06-02 14:22:47 -0400
commitec7f4cfda2c2708ed7ec3522600c95bd32fc43ea (patch)
tree1b3cf1471d0feacee35bfbe2bae72b2ead3dba36 /src/backend.c
parentc9ad0149295a99d832c39e5d8ef43294d06e39ee (diff)
downloadslapi-nis-ec7f4cfda2c2708ed7ec3522600c95bd32fc43ea.tar.gz
slapi-nis-ec7f4cfda2c2708ed7ec3522600c95bd32fc43ea.tar.xz
slapi-nis-ec7f4cfda2c2708ed7ec3522600c95bd32fc43ea.zip
- initial support for returning larger entries over tcp than we can over udp
- make the tcp sizes tunable
Diffstat (limited to 'src/backend.c')
-rw-r--r--src/backend.c75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/backend.c b/src/backend.c
index a634c9f..9dc4a3e 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -37,6 +37,7 @@
#endif
#include <rpc/xdr.h>
+#include <rpcsvc/yp_prot.h>
#include "backend.h"
#include "defaults.h"
@@ -416,12 +417,86 @@ backend_map_config_entry_cb(Slapi_Entry *e, void *callback_data)
return 0;
}
+static void
+backend_read_params(struct plugin_state *state)
+{
+ Slapi_DN *our_dn;
+ Slapi_Entry *our_entry;
+ Slapi_ValueSet *values;
+ Slapi_Value *value;
+ char *actual_attr, *cvalue;
+ int disposition, buffer_flags, ivalue, i;
+ unsigned int uvalue;
+ char *attrs[] = {
+ "max_value_size",
+ "max_dgram_size",
+ NULL,
+ };
+ /* Try to read our name from the top-level configuration node. */
+ our_dn = slapi_sdn_new_dn_byval(state->plugin_base);
+ if (our_dn == NULL) {
+ slapi_log_error(SLAPI_LOG_PLUGIN,
+ state->plugin_desc->spd_id,
+ "backend_read_params: "
+ "error parsing \"%s\"\n", state->plugin_base);
+ return;
+ }
+ slapi_search_internal_get_entry(our_dn, attrs, &our_entry,
+ state->plugin_identity);
+ slapi_sdn_free(&our_dn);
+ our_dn = NULL;
+ if (our_entry == NULL) {
+ slapi_log_error(SLAPI_LOG_PLUGIN,
+ state->plugin_desc->spd_id,
+ "backend_read_params: failure reading "
+ "\"%s\"", state->plugin_base);
+ return;
+ }
+ /* Pull out the attribute values. */
+ for (i = 0; attrs[i] != NULL; i++) {
+ if (slapi_vattr_values_get(our_entry, attrs[i], &values,
+ &disposition, &actual_attr,
+ 0, &buffer_flags) == 0) {
+ if (slapi_valueset_first_value(values, &value) == 0) {
+ if (strcmp(attrs[i], "max_value_size") == 0) {
+ uvalue = slapi_value_get_uint(value);
+ if (uvalue != 0) {
+ state->max_value_size = uvalue;
+ } else {
+ state->max_value_size =
+ DEFAULT_MAX_VALUE_SIZE;
+ }
+ } else
+ if (strcmp(attrs[i], "max_dgram_size") == 0) {
+ uvalue = slapi_value_get_uint(value);
+ if (uvalue != 0) {
+ state->max_dgram_size = uvalue;
+ } else {
+ state->max_dgram_size =
+ DEFAULT_MAX_DGRAM_SIZE;
+ }
+ }
+ }
+ slapi_vattr_values_free(&values, &actual_attr,
+ buffer_flags);
+ } else {
+ slapi_log_error(SLAPI_LOG_PLUGIN,
+ state->plugin_desc->spd_id,
+ "backend_read_params: no \"%s\" value "
+ "for \"%s\", using default\n", attrs[i],
+ state->plugin_base);
+ }
+ }
+ slapi_entry_free(our_entry);
+}
+
/* Scan for the list of configured domains and maps. */
void
backend_startup(struct plugin_state *state)
{
Slapi_PBlock *pb;
char *attrs = NULL;
+ backend_read_params(state);
pb = slapi_pblock_new();
slapi_log_error(SLAPI_LOG_PLUGIN,
state->plugin_desc->spd_id,