1*0a6a1f1dSLionel Sambuc /* $NetBSD: common.c,v 1.1.1.2 2014/04/24 12:45:28 pettai Exp $ */
2ebfedea0SLionel Sambuc
3ebfedea0SLionel Sambuc /*
4ebfedea0SLionel Sambuc * Copyright (c) 1997-2002 Kungliga Tekniska Högskolan
5ebfedea0SLionel Sambuc * (Royal Institute of Technology, Stockholm, Sweden).
6ebfedea0SLionel Sambuc * All rights reserved.
7ebfedea0SLionel Sambuc *
8ebfedea0SLionel Sambuc * Redistribution and use in source and binary forms, with or without
9ebfedea0SLionel Sambuc * modification, are permitted provided that the following conditions
10ebfedea0SLionel Sambuc * are met:
11ebfedea0SLionel Sambuc *
12ebfedea0SLionel Sambuc * 1. Redistributions of source code must retain the above copyright
13ebfedea0SLionel Sambuc * notice, this list of conditions and the following disclaimer.
14ebfedea0SLionel Sambuc *
15ebfedea0SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright
16ebfedea0SLionel Sambuc * notice, this list of conditions and the following disclaimer in the
17ebfedea0SLionel Sambuc * documentation and/or other materials provided with the distribution.
18ebfedea0SLionel Sambuc *
19ebfedea0SLionel Sambuc * 3. Neither the name of the Institute nor the names of its contributors
20ebfedea0SLionel Sambuc * may be used to endorse or promote products derived from this software
21ebfedea0SLionel Sambuc * without specific prior written permission.
22ebfedea0SLionel Sambuc *
23ebfedea0SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
24ebfedea0SLionel Sambuc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25ebfedea0SLionel Sambuc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26ebfedea0SLionel Sambuc * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
27ebfedea0SLionel Sambuc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28ebfedea0SLionel Sambuc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29ebfedea0SLionel Sambuc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30ebfedea0SLionel Sambuc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31ebfedea0SLionel Sambuc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32ebfedea0SLionel Sambuc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33ebfedea0SLionel Sambuc * SUCH DAMAGE.
34ebfedea0SLionel Sambuc */
35ebfedea0SLionel Sambuc
36ebfedea0SLionel Sambuc #include "hdb_locl.h"
37ebfedea0SLionel Sambuc
38ebfedea0SLionel Sambuc int
hdb_principal2key(krb5_context context,krb5_const_principal p,krb5_data * key)39ebfedea0SLionel Sambuc hdb_principal2key(krb5_context context, krb5_const_principal p, krb5_data *key)
40ebfedea0SLionel Sambuc {
41ebfedea0SLionel Sambuc Principal new;
42*0a6a1f1dSLionel Sambuc size_t len = 0;
43ebfedea0SLionel Sambuc int ret;
44ebfedea0SLionel Sambuc
45ebfedea0SLionel Sambuc ret = copy_Principal(p, &new);
46ebfedea0SLionel Sambuc if(ret)
47ebfedea0SLionel Sambuc return ret;
48ebfedea0SLionel Sambuc new.name.name_type = 0;
49ebfedea0SLionel Sambuc
50ebfedea0SLionel Sambuc ASN1_MALLOC_ENCODE(Principal, key->data, key->length, &new, &len, ret);
51ebfedea0SLionel Sambuc if (ret == 0 && key->length != len)
52ebfedea0SLionel Sambuc krb5_abortx(context, "internal asn.1 encoder error");
53ebfedea0SLionel Sambuc free_Principal(&new);
54ebfedea0SLionel Sambuc return ret;
55ebfedea0SLionel Sambuc }
56ebfedea0SLionel Sambuc
57ebfedea0SLionel Sambuc int
hdb_key2principal(krb5_context context,krb5_data * key,krb5_principal p)58ebfedea0SLionel Sambuc hdb_key2principal(krb5_context context, krb5_data *key, krb5_principal p)
59ebfedea0SLionel Sambuc {
60ebfedea0SLionel Sambuc return decode_Principal(key->data, key->length, p, NULL);
61ebfedea0SLionel Sambuc }
62ebfedea0SLionel Sambuc
63ebfedea0SLionel Sambuc int
hdb_entry2value(krb5_context context,const hdb_entry * ent,krb5_data * value)64ebfedea0SLionel Sambuc hdb_entry2value(krb5_context context, const hdb_entry *ent, krb5_data *value)
65ebfedea0SLionel Sambuc {
66*0a6a1f1dSLionel Sambuc size_t len = 0;
67ebfedea0SLionel Sambuc int ret;
68ebfedea0SLionel Sambuc
69ebfedea0SLionel Sambuc ASN1_MALLOC_ENCODE(hdb_entry, value->data, value->length, ent, &len, ret);
70ebfedea0SLionel Sambuc if (ret == 0 && value->length != len)
71ebfedea0SLionel Sambuc krb5_abortx(context, "internal asn.1 encoder error");
72ebfedea0SLionel Sambuc return ret;
73ebfedea0SLionel Sambuc }
74ebfedea0SLionel Sambuc
75ebfedea0SLionel Sambuc int
hdb_value2entry(krb5_context context,krb5_data * value,hdb_entry * ent)76ebfedea0SLionel Sambuc hdb_value2entry(krb5_context context, krb5_data *value, hdb_entry *ent)
77ebfedea0SLionel Sambuc {
78ebfedea0SLionel Sambuc return decode_hdb_entry(value->data, value->length, ent, NULL);
79ebfedea0SLionel Sambuc }
80ebfedea0SLionel Sambuc
81ebfedea0SLionel Sambuc int
hdb_entry_alias2value(krb5_context context,const hdb_entry_alias * alias,krb5_data * value)82ebfedea0SLionel Sambuc hdb_entry_alias2value(krb5_context context,
83ebfedea0SLionel Sambuc const hdb_entry_alias *alias,
84ebfedea0SLionel Sambuc krb5_data *value)
85ebfedea0SLionel Sambuc {
86*0a6a1f1dSLionel Sambuc size_t len = 0;
87ebfedea0SLionel Sambuc int ret;
88ebfedea0SLionel Sambuc
89ebfedea0SLionel Sambuc ASN1_MALLOC_ENCODE(hdb_entry_alias, value->data, value->length,
90ebfedea0SLionel Sambuc alias, &len, ret);
91ebfedea0SLionel Sambuc if (ret == 0 && value->length != len)
92ebfedea0SLionel Sambuc krb5_abortx(context, "internal asn.1 encoder error");
93ebfedea0SLionel Sambuc return ret;
94ebfedea0SLionel Sambuc }
95ebfedea0SLionel Sambuc
96ebfedea0SLionel Sambuc int
hdb_value2entry_alias(krb5_context context,krb5_data * value,hdb_entry_alias * ent)97ebfedea0SLionel Sambuc hdb_value2entry_alias(krb5_context context, krb5_data *value,
98ebfedea0SLionel Sambuc hdb_entry_alias *ent)
99ebfedea0SLionel Sambuc {
100ebfedea0SLionel Sambuc return decode_hdb_entry_alias(value->data, value->length, ent, NULL);
101ebfedea0SLionel Sambuc }
102ebfedea0SLionel Sambuc
103ebfedea0SLionel Sambuc krb5_error_code
_hdb_fetch_kvno(krb5_context context,HDB * db,krb5_const_principal principal,unsigned flags,krb5_kvno kvno,hdb_entry_ex * entry)104ebfedea0SLionel Sambuc _hdb_fetch_kvno(krb5_context context, HDB *db, krb5_const_principal principal,
105ebfedea0SLionel Sambuc unsigned flags, krb5_kvno kvno, hdb_entry_ex *entry)
106ebfedea0SLionel Sambuc {
107ebfedea0SLionel Sambuc krb5_principal enterprise_principal = NULL;
108ebfedea0SLionel Sambuc krb5_data key, value;
109ebfedea0SLionel Sambuc krb5_error_code ret;
110ebfedea0SLionel Sambuc int code;
111ebfedea0SLionel Sambuc
112ebfedea0SLionel Sambuc if (principal->name.name_type == KRB5_NT_ENTERPRISE_PRINCIPAL) {
113ebfedea0SLionel Sambuc if (principal->name.name_string.len != 1) {
114ebfedea0SLionel Sambuc ret = KRB5_PARSE_MALFORMED;
115ebfedea0SLionel Sambuc krb5_set_error_message(context, ret, "malformed principal: "
116ebfedea0SLionel Sambuc "enterprise name with %d name components",
117ebfedea0SLionel Sambuc principal->name.name_string.len);
118ebfedea0SLionel Sambuc return ret;
119ebfedea0SLionel Sambuc }
120ebfedea0SLionel Sambuc ret = krb5_parse_name(context, principal->name.name_string.val[0],
121ebfedea0SLionel Sambuc &enterprise_principal);
122ebfedea0SLionel Sambuc if (ret)
123ebfedea0SLionel Sambuc return ret;
124ebfedea0SLionel Sambuc principal = enterprise_principal;
125ebfedea0SLionel Sambuc }
126ebfedea0SLionel Sambuc
127ebfedea0SLionel Sambuc hdb_principal2key(context, principal, &key);
128ebfedea0SLionel Sambuc if (enterprise_principal)
129ebfedea0SLionel Sambuc krb5_free_principal(context, enterprise_principal);
130ebfedea0SLionel Sambuc code = db->hdb__get(context, db, key, &value);
131ebfedea0SLionel Sambuc krb5_data_free(&key);
132ebfedea0SLionel Sambuc if(code)
133ebfedea0SLionel Sambuc return code;
134ebfedea0SLionel Sambuc code = hdb_value2entry(context, &value, &entry->entry);
135ebfedea0SLionel Sambuc if (code == ASN1_BAD_ID && (flags & HDB_F_CANON) == 0) {
136ebfedea0SLionel Sambuc krb5_data_free(&value);
137ebfedea0SLionel Sambuc return HDB_ERR_NOENTRY;
138ebfedea0SLionel Sambuc } else if (code == ASN1_BAD_ID) {
139ebfedea0SLionel Sambuc hdb_entry_alias alias;
140ebfedea0SLionel Sambuc
141ebfedea0SLionel Sambuc code = hdb_value2entry_alias(context, &value, &alias);
142ebfedea0SLionel Sambuc if (code) {
143ebfedea0SLionel Sambuc krb5_data_free(&value);
144ebfedea0SLionel Sambuc return code;
145ebfedea0SLionel Sambuc }
146ebfedea0SLionel Sambuc hdb_principal2key(context, alias.principal, &key);
147ebfedea0SLionel Sambuc krb5_data_free(&value);
148ebfedea0SLionel Sambuc free_hdb_entry_alias(&alias);
149ebfedea0SLionel Sambuc
150ebfedea0SLionel Sambuc code = db->hdb__get(context, db, key, &value);
151ebfedea0SLionel Sambuc krb5_data_free(&key);
152ebfedea0SLionel Sambuc if (code)
153ebfedea0SLionel Sambuc return code;
154ebfedea0SLionel Sambuc code = hdb_value2entry(context, &value, &entry->entry);
155ebfedea0SLionel Sambuc if (code) {
156ebfedea0SLionel Sambuc krb5_data_free(&value);
157ebfedea0SLionel Sambuc return code;
158ebfedea0SLionel Sambuc }
159ebfedea0SLionel Sambuc }
160ebfedea0SLionel Sambuc krb5_data_free(&value);
161ebfedea0SLionel Sambuc if (db->hdb_master_key_set && (flags & HDB_F_DECRYPT)) {
162ebfedea0SLionel Sambuc code = hdb_unseal_keys (context, db, &entry->entry);
163ebfedea0SLionel Sambuc if (code)
164ebfedea0SLionel Sambuc hdb_free_entry(context, entry);
165ebfedea0SLionel Sambuc }
166ebfedea0SLionel Sambuc return code;
167ebfedea0SLionel Sambuc }
168ebfedea0SLionel Sambuc
169ebfedea0SLionel Sambuc static krb5_error_code
hdb_remove_aliases(krb5_context context,HDB * db,krb5_data * key)170ebfedea0SLionel Sambuc hdb_remove_aliases(krb5_context context, HDB *db, krb5_data *key)
171ebfedea0SLionel Sambuc {
172ebfedea0SLionel Sambuc const HDB_Ext_Aliases *aliases;
173ebfedea0SLionel Sambuc krb5_error_code code;
174ebfedea0SLionel Sambuc hdb_entry oldentry;
175ebfedea0SLionel Sambuc krb5_data value;
176*0a6a1f1dSLionel Sambuc size_t i;
177ebfedea0SLionel Sambuc
178ebfedea0SLionel Sambuc code = db->hdb__get(context, db, *key, &value);
179ebfedea0SLionel Sambuc if (code == HDB_ERR_NOENTRY)
180ebfedea0SLionel Sambuc return 0;
181ebfedea0SLionel Sambuc else if (code)
182ebfedea0SLionel Sambuc return code;
183ebfedea0SLionel Sambuc
184ebfedea0SLionel Sambuc code = hdb_value2entry(context, &value, &oldentry);
185ebfedea0SLionel Sambuc krb5_data_free(&value);
186ebfedea0SLionel Sambuc if (code)
187ebfedea0SLionel Sambuc return code;
188ebfedea0SLionel Sambuc
189ebfedea0SLionel Sambuc code = hdb_entry_get_aliases(&oldentry, &aliases);
190ebfedea0SLionel Sambuc if (code || aliases == NULL) {
191ebfedea0SLionel Sambuc free_hdb_entry(&oldentry);
192ebfedea0SLionel Sambuc return code;
193ebfedea0SLionel Sambuc }
194ebfedea0SLionel Sambuc for (i = 0; i < aliases->aliases.len; i++) {
195ebfedea0SLionel Sambuc krb5_data akey;
196ebfedea0SLionel Sambuc
197ebfedea0SLionel Sambuc hdb_principal2key(context, &aliases->aliases.val[i], &akey);
198ebfedea0SLionel Sambuc code = db->hdb__del(context, db, akey);
199ebfedea0SLionel Sambuc krb5_data_free(&akey);
200ebfedea0SLionel Sambuc if (code) {
201ebfedea0SLionel Sambuc free_hdb_entry(&oldentry);
202ebfedea0SLionel Sambuc return code;
203ebfedea0SLionel Sambuc }
204ebfedea0SLionel Sambuc }
205ebfedea0SLionel Sambuc free_hdb_entry(&oldentry);
206ebfedea0SLionel Sambuc return 0;
207ebfedea0SLionel Sambuc }
208ebfedea0SLionel Sambuc
209ebfedea0SLionel Sambuc static krb5_error_code
hdb_add_aliases(krb5_context context,HDB * db,unsigned flags,hdb_entry_ex * entry)210ebfedea0SLionel Sambuc hdb_add_aliases(krb5_context context, HDB *db,
211ebfedea0SLionel Sambuc unsigned flags, hdb_entry_ex *entry)
212ebfedea0SLionel Sambuc {
213ebfedea0SLionel Sambuc const HDB_Ext_Aliases *aliases;
214ebfedea0SLionel Sambuc krb5_error_code code;
215ebfedea0SLionel Sambuc krb5_data key, value;
216*0a6a1f1dSLionel Sambuc size_t i;
217ebfedea0SLionel Sambuc
218ebfedea0SLionel Sambuc code = hdb_entry_get_aliases(&entry->entry, &aliases);
219ebfedea0SLionel Sambuc if (code || aliases == NULL)
220ebfedea0SLionel Sambuc return code;
221ebfedea0SLionel Sambuc
222ebfedea0SLionel Sambuc for (i = 0; i < aliases->aliases.len; i++) {
223ebfedea0SLionel Sambuc hdb_entry_alias entryalias;
224ebfedea0SLionel Sambuc entryalias.principal = entry->entry.principal;
225ebfedea0SLionel Sambuc
226ebfedea0SLionel Sambuc hdb_principal2key(context, &aliases->aliases.val[i], &key);
227ebfedea0SLionel Sambuc code = hdb_entry_alias2value(context, &entryalias, &value);
228ebfedea0SLionel Sambuc if (code) {
229ebfedea0SLionel Sambuc krb5_data_free(&key);
230ebfedea0SLionel Sambuc return code;
231ebfedea0SLionel Sambuc }
232ebfedea0SLionel Sambuc code = db->hdb__put(context, db, flags, key, value);
233ebfedea0SLionel Sambuc krb5_data_free(&key);
234ebfedea0SLionel Sambuc krb5_data_free(&value);
235ebfedea0SLionel Sambuc if (code)
236ebfedea0SLionel Sambuc return code;
237ebfedea0SLionel Sambuc }
238ebfedea0SLionel Sambuc return 0;
239ebfedea0SLionel Sambuc }
240ebfedea0SLionel Sambuc
241ebfedea0SLionel Sambuc static krb5_error_code
hdb_check_aliases(krb5_context context,HDB * db,hdb_entry_ex * entry)242ebfedea0SLionel Sambuc hdb_check_aliases(krb5_context context, HDB *db, hdb_entry_ex *entry)
243ebfedea0SLionel Sambuc {
244ebfedea0SLionel Sambuc const HDB_Ext_Aliases *aliases;
245*0a6a1f1dSLionel Sambuc int code;
246*0a6a1f1dSLionel Sambuc size_t i;
247ebfedea0SLionel Sambuc
248ebfedea0SLionel Sambuc /* check if new aliases already is used */
249ebfedea0SLionel Sambuc
250ebfedea0SLionel Sambuc code = hdb_entry_get_aliases(&entry->entry, &aliases);
251ebfedea0SLionel Sambuc if (code)
252ebfedea0SLionel Sambuc return code;
253ebfedea0SLionel Sambuc
254ebfedea0SLionel Sambuc for (i = 0; aliases && i < aliases->aliases.len; i++) {
255ebfedea0SLionel Sambuc hdb_entry_alias alias;
256ebfedea0SLionel Sambuc krb5_data akey, value;
257ebfedea0SLionel Sambuc
258ebfedea0SLionel Sambuc hdb_principal2key(context, &aliases->aliases.val[i], &akey);
259ebfedea0SLionel Sambuc code = db->hdb__get(context, db, akey, &value);
260ebfedea0SLionel Sambuc krb5_data_free(&akey);
261ebfedea0SLionel Sambuc if (code == HDB_ERR_NOENTRY)
262ebfedea0SLionel Sambuc continue;
263ebfedea0SLionel Sambuc else if (code)
264ebfedea0SLionel Sambuc return code;
265ebfedea0SLionel Sambuc
266ebfedea0SLionel Sambuc code = hdb_value2entry_alias(context, &value, &alias);
267ebfedea0SLionel Sambuc krb5_data_free(&value);
268ebfedea0SLionel Sambuc
269ebfedea0SLionel Sambuc if (code == ASN1_BAD_ID)
270ebfedea0SLionel Sambuc return HDB_ERR_EXISTS;
271ebfedea0SLionel Sambuc else if (code)
272ebfedea0SLionel Sambuc return code;
273ebfedea0SLionel Sambuc
274ebfedea0SLionel Sambuc code = krb5_principal_compare(context, alias.principal,
275ebfedea0SLionel Sambuc entry->entry.principal);
276ebfedea0SLionel Sambuc free_hdb_entry_alias(&alias);
277ebfedea0SLionel Sambuc if (code == 0)
278ebfedea0SLionel Sambuc return HDB_ERR_EXISTS;
279ebfedea0SLionel Sambuc }
280ebfedea0SLionel Sambuc return 0;
281ebfedea0SLionel Sambuc }
282ebfedea0SLionel Sambuc
283ebfedea0SLionel Sambuc krb5_error_code
_hdb_store(krb5_context context,HDB * db,unsigned flags,hdb_entry_ex * entry)284ebfedea0SLionel Sambuc _hdb_store(krb5_context context, HDB *db, unsigned flags, hdb_entry_ex *entry)
285ebfedea0SLionel Sambuc {
286ebfedea0SLionel Sambuc krb5_data key, value;
287ebfedea0SLionel Sambuc int code;
288ebfedea0SLionel Sambuc
289ebfedea0SLionel Sambuc /* check if new aliases already is used */
290ebfedea0SLionel Sambuc code = hdb_check_aliases(context, db, entry);
291ebfedea0SLionel Sambuc if (code)
292ebfedea0SLionel Sambuc return code;
293ebfedea0SLionel Sambuc
294ebfedea0SLionel Sambuc if(entry->entry.generation == NULL) {
295ebfedea0SLionel Sambuc struct timeval t;
296ebfedea0SLionel Sambuc entry->entry.generation = malloc(sizeof(*entry->entry.generation));
297ebfedea0SLionel Sambuc if(entry->entry.generation == NULL) {
298ebfedea0SLionel Sambuc krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
299ebfedea0SLionel Sambuc return ENOMEM;
300ebfedea0SLionel Sambuc }
301ebfedea0SLionel Sambuc gettimeofday(&t, NULL);
302ebfedea0SLionel Sambuc entry->entry.generation->time = t.tv_sec;
303ebfedea0SLionel Sambuc entry->entry.generation->usec = t.tv_usec;
304ebfedea0SLionel Sambuc entry->entry.generation->gen = 0;
305ebfedea0SLionel Sambuc } else
306ebfedea0SLionel Sambuc entry->entry.generation->gen++;
307ebfedea0SLionel Sambuc
308ebfedea0SLionel Sambuc code = hdb_seal_keys(context, db, &entry->entry);
309ebfedea0SLionel Sambuc if (code)
310ebfedea0SLionel Sambuc return code;
311ebfedea0SLionel Sambuc
312ebfedea0SLionel Sambuc hdb_principal2key(context, entry->entry.principal, &key);
313ebfedea0SLionel Sambuc
314ebfedea0SLionel Sambuc /* remove aliases */
315ebfedea0SLionel Sambuc code = hdb_remove_aliases(context, db, &key);
316ebfedea0SLionel Sambuc if (code) {
317ebfedea0SLionel Sambuc krb5_data_free(&key);
318ebfedea0SLionel Sambuc return code;
319ebfedea0SLionel Sambuc }
320ebfedea0SLionel Sambuc hdb_entry2value(context, &entry->entry, &value);
321ebfedea0SLionel Sambuc code = db->hdb__put(context, db, flags & HDB_F_REPLACE, key, value);
322ebfedea0SLionel Sambuc krb5_data_free(&value);
323ebfedea0SLionel Sambuc krb5_data_free(&key);
324ebfedea0SLionel Sambuc if (code)
325ebfedea0SLionel Sambuc return code;
326ebfedea0SLionel Sambuc
327ebfedea0SLionel Sambuc code = hdb_add_aliases(context, db, flags, entry);
328ebfedea0SLionel Sambuc
329ebfedea0SLionel Sambuc return code;
330ebfedea0SLionel Sambuc }
331ebfedea0SLionel Sambuc
332ebfedea0SLionel Sambuc krb5_error_code
_hdb_remove(krb5_context context,HDB * db,krb5_const_principal principal)333ebfedea0SLionel Sambuc _hdb_remove(krb5_context context, HDB *db, krb5_const_principal principal)
334ebfedea0SLionel Sambuc {
335ebfedea0SLionel Sambuc krb5_data key;
336ebfedea0SLionel Sambuc int code;
337ebfedea0SLionel Sambuc
338ebfedea0SLionel Sambuc hdb_principal2key(context, principal, &key);
339ebfedea0SLionel Sambuc
340ebfedea0SLionel Sambuc code = hdb_remove_aliases(context, db, &key);
341ebfedea0SLionel Sambuc if (code) {
342ebfedea0SLionel Sambuc krb5_data_free(&key);
343ebfedea0SLionel Sambuc return code;
344ebfedea0SLionel Sambuc }
345ebfedea0SLionel Sambuc code = db->hdb__del(context, db, key);
346ebfedea0SLionel Sambuc krb5_data_free(&key);
347ebfedea0SLionel Sambuc return code;
348ebfedea0SLionel Sambuc }
349ebfedea0SLionel Sambuc
350