diff options
| author | Nalin Dahyabhai <nalin.dahyabhai@pobox.com> | 2007-11-29 16:59:51 -0500 |
|---|---|---|
| committer | Nalin Dahyabhai <nalin.dahyabhai@pobox.com> | 2007-11-29 16:59:51 -0500 |
| commit | 9e27311aaa9f422f9c1d3afb3be3e0d9d7cc6dc6 (patch) | |
| tree | 4195de615e214f4e51e57f2c7aa01477906e391e /src/plugin.c | |
| parent | 522e1244c3af57289ddcbbc66d843c5dee6a234b (diff) | |
| download | slapi-nis-9e27311aaa9f422f9c1d3afb3be3e0d9d7cc6dc6.tar.gz slapi-nis-9e27311aaa9f422f9c1d3afb3be3e0d9d7cc6dc6.tar.xz slapi-nis-9e27311aaa9f422f9c1d3afb3be3e0d9d7cc6dc6.zip | |
- move some of the plugin internal-search stuff around
Diffstat (limited to 'src/plugin.c')
| -rw-r--r-- | src/plugin.c | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/src/plugin.c b/src/plugin.c index da40b06..b4a662d 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -39,91 +39,6 @@ plugin_description = { .spd_description = "NIS Service Plugin", }; -struct search_stream_data { - struct plugin_state *state; - int client; -}; - -static void -cb_stream_result(int rc, void *callback_data) -{ - struct search_stream_data *data = callback_data; - char buf[sizeof(rc) * 4 + 1]; - slapi_log_error(SLAPI_LOG_PLUGIN, "cb_result", - "returning result %d\n", rc); - sprintf(buf, "%d\n", rc); - write(data->client, buf, strlen(buf)); -} - -static int -cb_stream_entry(Slapi_Entry *e, void *callback_data) -{ - struct search_stream_data *data = callback_data; - Slapi_Attr *attr; - Slapi_ValueSet *values; - Slapi_Value *value; - const char *dn; - const struct berval *val; - int i; - attr = NULL; - if (slapi_entry_attr_find(e, "ou", &attr) == 0) { - dn = slapi_entry_get_dn(e); - slapi_log_error(SLAPI_LOG_PLUGIN, "cb_entry", - "returning entry \"%s\"\n", dn); - write(data->client, "[", 1); - write(data->client, dn, strlen(dn)); - write(data->client, "]\n", 2); - values = NULL; - if (slapi_attr_get_valueset(attr, &values) == 0) { - i = slapi_valueset_first_value(values, &value); - while (i != -1) { - val = slapi_value_get_berval(value); - if (val != NULL) { - write(data->client, - val->bv_val, val->bv_len); - write(data->client, "\n", 1); - } - i = slapi_valueset_next_value(values, i, - &value); - } - } - } - return 0; -} - -static int -cb_stream_referral(char *referral, void *callback_data) -{ - struct search_stream_data *data = callback_data; - slapi_log_error(SLAPI_LOG_PLUGIN, "cb_referral", - "returning referral to \"%s\"\n", referral); - write(data->client, "See also ", 9); - write(data->client, referral, strlen(referral)); - write(data->client, "\n", 1); - return 0; -} - -#if 0 - pblock = slapi_pblock_new(); - slapi_pblock_set(pblock, SLAPI_CONN_DN, ""); - slapi_pblock_set(pblock, SLAPI_CONN_AUTHMETHOD, SLAPD_AUTH_NONE); - slapi_search_internal_set_pb(pblock, - "dc=boston,dc=redhat,dc=com", - LDAP_SCOPE_ONE, - "(objectclass=*)", - attrs, 0, - NULL, - NULL, - state->plugin_identity, - 0); - i = slapi_search_internal_callback_pb(pblock, &data, - cb_stream_result, - cb_stream_entry, - cb_stream_referral); - slapi_pblock_destroy(pblock); - close(client); -#endif - static void * listener_thread(void *p) { |
