1 /* Copyright (c) 2003 by International Business Machines, Inc.
3 * International Business Machines, Inc. (hereinafter called IBM) grants
4 * permission under its copyrights to use, copy, modify, and distribute this
5 * Software with or without fee, provided that the above copyright notice and
6 * all paragraphs of this notice appear in all copies, and that the name of IBM
7 * not be used in connection with the marketing of any product incorporating
8 * the Software or modifications thereof, without specific, written prior
11 * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
12 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
13 * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
14 * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
15 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
16 * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
23 #include <ac/socket.h>
24 #include <ac/string.h>
29 #include "../back-ldap/back-ldap.h"
30 #include "back-meta.h"
32 #undef ldap_debug /* silence a warning in ldap-int.h */
34 #include "../../../libraries/libldap/ldap-int.h"
54 enum type_of_result err;
61 struct berval* query_uuid,
62 struct exception* result)
64 struct query_info info;
68 struct timeval time_in;
69 struct timeval time_out;
72 slap_callback cb = {callback_null_response,
73 callback_null_sresult, remove_func, NULL};
74 sprintf(filter_str, "(queryid=%s)", query_uuid->bv_val);
75 filter = str2filter(filter_str);
76 info.uuid = query_uuid;
80 cb.sc_private = &info;
82 op.o_tag = LDAP_REQ_SEARCH;
83 op.o_protocol = LDAP_VERSION3;
84 op.o_ndn = conn->c_ndn;
86 op.o_time = slap_get_time();
87 op.o_do_not_cache = 1;
89 be->be_search( be, conn, &op, NULL, &(be->be_nsuffix[0]),
90 LDAP_SCOPE_SUBTREE, LDAP_DEREF_NEVER, 0, 0,
91 filter, NULL, NULL, 0 );
92 result->type = info.err;
93 result->rc = info.deleted;
103 AttributeName *attrs,
108 slap_callback *tmp = op->o_callback;
109 struct query_info* info = tmp->sc_private;
110 #if 0 /* ??? pdn is not used anywhere */
115 struct timeval time_in;
116 struct timeval time_out;
121 size = get_entry_size(entry, 0, NULL);
123 for (attr = entry->e_attrs; attr!= NULL; attr = attr->a_next) {
124 if (attr->a_desc == slap_schema.si_ad_queryid) {
125 for (count=0; attr->a_vals[count].bv_val; count++)
132 info->err = REMOVE_ERR;
136 #if 0 /* ??? pdn is not used anywhere */
137 dnPretty2(NULL, &entry->e_nname, &pdn);
141 LDAP_LOG( BACK_META, DETAIL1,
142 "DELETING ENTRY SIZE=%d TEMPLATE=%s\n",
143 size, attr->a_vals[0].bv_val, 0 );
145 Debug( LDAP_DEBUG_ANY, "DELETING ENTRY SIZE=%d TEMPLATE=%s\n",
146 size, attr->a_vals[0].bv_val, 0 );
149 if (be->be_delete (be, conn, op, &entry->e_name, &entry->e_nname)) {
150 info->err = REMOVE_ERR;
157 mod = (Modifications*)malloc(sizeof(Modifications));
158 mod->sml_op = LDAP_MOD_DELETE;
159 mod->sml_type.bv_len = sizeof("queryid");
160 mod->sml_type.bv_val = "queryid";
161 mod->sml_desc = slap_schema.si_ad_queryid;
162 mod->sml_bvalues = (struct berval*) malloc( 2 * sizeof( struct berval) );
163 ber_dupbv(mod->sml_bvalues, info->uuid);
164 mod->sml_bvalues[1].bv_val = NULL;
165 mod->sml_bvalues[1].bv_len = 0;
166 mod->sml_next = NULL;
168 LDAP_LOG( BACK_META, DETAIL1,
169 "REMOVING TEMP ATTR : TEMPLATE=%s\n",
170 attr->a_vals[0].bv_val, 0, 0 );
172 Debug( LDAP_DEBUG_ANY, "REMOVING TEMP ATTR : TEMPLATE=%s\n",
173 attr->a_vals[0].bv_val, 0, 0 );
175 if (be->be_modify(be, conn, op, &(entry->e_name), &(entry->e_nname), mod)) {
176 info->err = REMOVE_ERR;
178 info->freed += LDIF_SIZE_NEEDED(9, (strlen(info->uuid->bv_val)));
183 #endif /* LDAP_CACHING */