1*ebfedea0SLionel Sambuc /* $NetBSD: db.c,v 1.1.1.1 2011/04/13 18:14:41 elric Exp $ */
2*ebfedea0SLionel Sambuc
3*ebfedea0SLionel Sambuc /*
4*ebfedea0SLionel Sambuc * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan
5*ebfedea0SLionel Sambuc * (Royal Institute of Technology, Stockholm, Sweden).
6*ebfedea0SLionel Sambuc * All rights reserved.
7*ebfedea0SLionel Sambuc *
8*ebfedea0SLionel Sambuc * Redistribution and use in source and binary forms, with or without
9*ebfedea0SLionel Sambuc * modification, are permitted provided that the following conditions
10*ebfedea0SLionel Sambuc * are met:
11*ebfedea0SLionel Sambuc *
12*ebfedea0SLionel Sambuc * 1. Redistributions of source code must retain the above copyright
13*ebfedea0SLionel Sambuc * notice, this list of conditions and the following disclaimer.
14*ebfedea0SLionel Sambuc *
15*ebfedea0SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright
16*ebfedea0SLionel Sambuc * notice, this list of conditions and the following disclaimer in the
17*ebfedea0SLionel Sambuc * documentation and/or other materials provided with the distribution.
18*ebfedea0SLionel Sambuc *
19*ebfedea0SLionel Sambuc * 3. Neither the name of the Institute nor the names of its contributors
20*ebfedea0SLionel Sambuc * may be used to endorse or promote products derived from this software
21*ebfedea0SLionel Sambuc * without specific prior written permission.
22*ebfedea0SLionel Sambuc *
23*ebfedea0SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
24*ebfedea0SLionel Sambuc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25*ebfedea0SLionel Sambuc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26*ebfedea0SLionel Sambuc * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
27*ebfedea0SLionel Sambuc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28*ebfedea0SLionel Sambuc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29*ebfedea0SLionel Sambuc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30*ebfedea0SLionel Sambuc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31*ebfedea0SLionel Sambuc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32*ebfedea0SLionel Sambuc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33*ebfedea0SLionel Sambuc * SUCH DAMAGE.
34*ebfedea0SLionel Sambuc */
35*ebfedea0SLionel Sambuc
36*ebfedea0SLionel Sambuc #include "hdb_locl.h"
37*ebfedea0SLionel Sambuc
38*ebfedea0SLionel Sambuc #if HAVE_DB1
39*ebfedea0SLionel Sambuc
40*ebfedea0SLionel Sambuc #if defined(HAVE_DB_185_H)
41*ebfedea0SLionel Sambuc #include <db_185.h>
42*ebfedea0SLionel Sambuc #elif defined(HAVE_DB_H)
43*ebfedea0SLionel Sambuc #include <db.h>
44*ebfedea0SLionel Sambuc #endif
45*ebfedea0SLionel Sambuc
46*ebfedea0SLionel Sambuc static krb5_error_code
DB_close(krb5_context context,HDB * db)47*ebfedea0SLionel Sambuc DB_close(krb5_context context, HDB *db)
48*ebfedea0SLionel Sambuc {
49*ebfedea0SLionel Sambuc DB *d = (DB*)db->hdb_db;
50*ebfedea0SLionel Sambuc (*d->close)(d);
51*ebfedea0SLionel Sambuc return 0;
52*ebfedea0SLionel Sambuc }
53*ebfedea0SLionel Sambuc
54*ebfedea0SLionel Sambuc static krb5_error_code
DB_destroy(krb5_context context,HDB * db)55*ebfedea0SLionel Sambuc DB_destroy(krb5_context context, HDB *db)
56*ebfedea0SLionel Sambuc {
57*ebfedea0SLionel Sambuc krb5_error_code ret;
58*ebfedea0SLionel Sambuc
59*ebfedea0SLionel Sambuc ret = hdb_clear_master_key (context, db);
60*ebfedea0SLionel Sambuc free(db->hdb_name);
61*ebfedea0SLionel Sambuc free(db);
62*ebfedea0SLionel Sambuc return ret;
63*ebfedea0SLionel Sambuc }
64*ebfedea0SLionel Sambuc
65*ebfedea0SLionel Sambuc static krb5_error_code
DB_lock(krb5_context context,HDB * db,int operation)66*ebfedea0SLionel Sambuc DB_lock(krb5_context context, HDB *db, int operation)
67*ebfedea0SLionel Sambuc {
68*ebfedea0SLionel Sambuc DB *d = (DB*)db->hdb_db;
69*ebfedea0SLionel Sambuc int fd = (*d->fd)(d);
70*ebfedea0SLionel Sambuc if(fd < 0) {
71*ebfedea0SLionel Sambuc krb5_set_error_message(context, HDB_ERR_CANT_LOCK_DB,
72*ebfedea0SLionel Sambuc "Can't lock database: %s", db->hdb_name);
73*ebfedea0SLionel Sambuc return HDB_ERR_CANT_LOCK_DB;
74*ebfedea0SLionel Sambuc }
75*ebfedea0SLionel Sambuc return hdb_lock(fd, operation);
76*ebfedea0SLionel Sambuc }
77*ebfedea0SLionel Sambuc
78*ebfedea0SLionel Sambuc static krb5_error_code
DB_unlock(krb5_context context,HDB * db)79*ebfedea0SLionel Sambuc DB_unlock(krb5_context context, HDB *db)
80*ebfedea0SLionel Sambuc {
81*ebfedea0SLionel Sambuc DB *d = (DB*)db->hdb_db;
82*ebfedea0SLionel Sambuc int fd = (*d->fd)(d);
83*ebfedea0SLionel Sambuc if(fd < 0) {
84*ebfedea0SLionel Sambuc krb5_set_error_message(context, HDB_ERR_CANT_LOCK_DB,
85*ebfedea0SLionel Sambuc "Can't unlock database: %s", db->hdb_name);
86*ebfedea0SLionel Sambuc return HDB_ERR_CANT_LOCK_DB;
87*ebfedea0SLionel Sambuc }
88*ebfedea0SLionel Sambuc return hdb_unlock(fd);
89*ebfedea0SLionel Sambuc }
90*ebfedea0SLionel Sambuc
91*ebfedea0SLionel Sambuc
92*ebfedea0SLionel Sambuc static krb5_error_code
DB_seq(krb5_context context,HDB * db,unsigned flags,hdb_entry_ex * entry,int flag)93*ebfedea0SLionel Sambuc DB_seq(krb5_context context, HDB *db,
94*ebfedea0SLionel Sambuc unsigned flags, hdb_entry_ex *entry, int flag)
95*ebfedea0SLionel Sambuc {
96*ebfedea0SLionel Sambuc DB *d = (DB*)db->hdb_db;
97*ebfedea0SLionel Sambuc DBT key, value;
98*ebfedea0SLionel Sambuc krb5_data key_data, data;
99*ebfedea0SLionel Sambuc int code;
100*ebfedea0SLionel Sambuc
101*ebfedea0SLionel Sambuc code = db->hdb_lock(context, db, HDB_RLOCK);
102*ebfedea0SLionel Sambuc if(code == -1) {
103*ebfedea0SLionel Sambuc krb5_set_error_message(context, HDB_ERR_DB_INUSE, "Database %s in use", db->hdb_name);
104*ebfedea0SLionel Sambuc return HDB_ERR_DB_INUSE;
105*ebfedea0SLionel Sambuc }
106*ebfedea0SLionel Sambuc code = (*d->seq)(d, &key, &value, flag);
107*ebfedea0SLionel Sambuc db->hdb_unlock(context, db); /* XXX check value */
108*ebfedea0SLionel Sambuc if(code == -1) {
109*ebfedea0SLionel Sambuc code = errno;
110*ebfedea0SLionel Sambuc krb5_set_error_message(context, code, "Database %s seq error: %s",
111*ebfedea0SLionel Sambuc db->hdb_name, strerror(code));
112*ebfedea0SLionel Sambuc return code;
113*ebfedea0SLionel Sambuc }
114*ebfedea0SLionel Sambuc if(code == 1) {
115*ebfedea0SLionel Sambuc krb5_clear_error_message(context);
116*ebfedea0SLionel Sambuc return HDB_ERR_NOENTRY;
117*ebfedea0SLionel Sambuc }
118*ebfedea0SLionel Sambuc
119*ebfedea0SLionel Sambuc key_data.data = key.data;
120*ebfedea0SLionel Sambuc key_data.length = key.size;
121*ebfedea0SLionel Sambuc data.data = value.data;
122*ebfedea0SLionel Sambuc data.length = value.size;
123*ebfedea0SLionel Sambuc memset(entry, 0, sizeof(*entry));
124*ebfedea0SLionel Sambuc if (hdb_value2entry(context, &data, &entry->entry))
125*ebfedea0SLionel Sambuc return DB_seq(context, db, flags, entry, R_NEXT);
126*ebfedea0SLionel Sambuc if (db->hdb_master_key_set && (flags & HDB_F_DECRYPT)) {
127*ebfedea0SLionel Sambuc code = hdb_unseal_keys (context, db, &entry->entry);
128*ebfedea0SLionel Sambuc if (code)
129*ebfedea0SLionel Sambuc hdb_free_entry (context, entry);
130*ebfedea0SLionel Sambuc }
131*ebfedea0SLionel Sambuc if (code == 0 && entry->entry.principal == NULL) {
132*ebfedea0SLionel Sambuc entry->entry.principal = malloc(sizeof(*entry->entry.principal));
133*ebfedea0SLionel Sambuc if (entry->entry.principal == NULL) {
134*ebfedea0SLionel Sambuc code = ENOMEM;
135*ebfedea0SLionel Sambuc krb5_set_error_message(context, code, "malloc: out of memory");
136*ebfedea0SLionel Sambuc hdb_free_entry (context, entry);
137*ebfedea0SLionel Sambuc } else {
138*ebfedea0SLionel Sambuc hdb_key2principal(context, &key_data, entry->entry.principal);
139*ebfedea0SLionel Sambuc }
140*ebfedea0SLionel Sambuc }
141*ebfedea0SLionel Sambuc return code;
142*ebfedea0SLionel Sambuc }
143*ebfedea0SLionel Sambuc
144*ebfedea0SLionel Sambuc
145*ebfedea0SLionel Sambuc static krb5_error_code
DB_firstkey(krb5_context context,HDB * db,unsigned flags,hdb_entry_ex * entry)146*ebfedea0SLionel Sambuc DB_firstkey(krb5_context context, HDB *db, unsigned flags, hdb_entry_ex *entry)
147*ebfedea0SLionel Sambuc {
148*ebfedea0SLionel Sambuc return DB_seq(context, db, flags, entry, R_FIRST);
149*ebfedea0SLionel Sambuc }
150*ebfedea0SLionel Sambuc
151*ebfedea0SLionel Sambuc
152*ebfedea0SLionel Sambuc static krb5_error_code
DB_nextkey(krb5_context context,HDB * db,unsigned flags,hdb_entry_ex * entry)153*ebfedea0SLionel Sambuc DB_nextkey(krb5_context context, HDB *db, unsigned flags, hdb_entry_ex *entry)
154*ebfedea0SLionel Sambuc {
155*ebfedea0SLionel Sambuc return DB_seq(context, db, flags, entry, R_NEXT);
156*ebfedea0SLionel Sambuc }
157*ebfedea0SLionel Sambuc
158*ebfedea0SLionel Sambuc static krb5_error_code
DB_rename(krb5_context context,HDB * db,const char * new_name)159*ebfedea0SLionel Sambuc DB_rename(krb5_context context, HDB *db, const char *new_name)
160*ebfedea0SLionel Sambuc {
161*ebfedea0SLionel Sambuc int ret;
162*ebfedea0SLionel Sambuc char *old, *new;
163*ebfedea0SLionel Sambuc
164*ebfedea0SLionel Sambuc asprintf(&old, "%s.db", db->hdb_name);
165*ebfedea0SLionel Sambuc asprintf(&new, "%s.db", new_name);
166*ebfedea0SLionel Sambuc ret = rename(old, new);
167*ebfedea0SLionel Sambuc free(old);
168*ebfedea0SLionel Sambuc free(new);
169*ebfedea0SLionel Sambuc if(ret)
170*ebfedea0SLionel Sambuc return errno;
171*ebfedea0SLionel Sambuc
172*ebfedea0SLionel Sambuc free(db->hdb_name);
173*ebfedea0SLionel Sambuc db->hdb_name = strdup(new_name);
174*ebfedea0SLionel Sambuc return 0;
175*ebfedea0SLionel Sambuc }
176*ebfedea0SLionel Sambuc
177*ebfedea0SLionel Sambuc static krb5_error_code
DB__get(krb5_context context,HDB * db,krb5_data key,krb5_data * reply)178*ebfedea0SLionel Sambuc DB__get(krb5_context context, HDB *db, krb5_data key, krb5_data *reply)
179*ebfedea0SLionel Sambuc {
180*ebfedea0SLionel Sambuc DB *d = (DB*)db->hdb_db;
181*ebfedea0SLionel Sambuc DBT k, v;
182*ebfedea0SLionel Sambuc int code;
183*ebfedea0SLionel Sambuc
184*ebfedea0SLionel Sambuc k.data = key.data;
185*ebfedea0SLionel Sambuc k.size = key.length;
186*ebfedea0SLionel Sambuc code = db->hdb_lock(context, db, HDB_RLOCK);
187*ebfedea0SLionel Sambuc if(code)
188*ebfedea0SLionel Sambuc return code;
189*ebfedea0SLionel Sambuc code = (*d->get)(d, &k, &v, 0);
190*ebfedea0SLionel Sambuc db->hdb_unlock(context, db);
191*ebfedea0SLionel Sambuc if(code < 0) {
192*ebfedea0SLionel Sambuc code = errno;
193*ebfedea0SLionel Sambuc krb5_set_error_message(context, code, "Database %s get error: %s",
194*ebfedea0SLionel Sambuc db->hdb_name, strerror(code));
195*ebfedea0SLionel Sambuc return code;
196*ebfedea0SLionel Sambuc }
197*ebfedea0SLionel Sambuc if(code == 1) {
198*ebfedea0SLionel Sambuc krb5_clear_error_message(context);
199*ebfedea0SLionel Sambuc return HDB_ERR_NOENTRY;
200*ebfedea0SLionel Sambuc }
201*ebfedea0SLionel Sambuc
202*ebfedea0SLionel Sambuc krb5_data_copy(reply, v.data, v.size);
203*ebfedea0SLionel Sambuc return 0;
204*ebfedea0SLionel Sambuc }
205*ebfedea0SLionel Sambuc
206*ebfedea0SLionel Sambuc static krb5_error_code
DB__put(krb5_context context,HDB * db,int replace,krb5_data key,krb5_data value)207*ebfedea0SLionel Sambuc DB__put(krb5_context context, HDB *db, int replace,
208*ebfedea0SLionel Sambuc krb5_data key, krb5_data value)
209*ebfedea0SLionel Sambuc {
210*ebfedea0SLionel Sambuc DB *d = (DB*)db->hdb_db;
211*ebfedea0SLionel Sambuc DBT k, v;
212*ebfedea0SLionel Sambuc int code;
213*ebfedea0SLionel Sambuc
214*ebfedea0SLionel Sambuc k.data = key.data;
215*ebfedea0SLionel Sambuc k.size = key.length;
216*ebfedea0SLionel Sambuc v.data = value.data;
217*ebfedea0SLionel Sambuc v.size = value.length;
218*ebfedea0SLionel Sambuc code = db->hdb_lock(context, db, HDB_WLOCK);
219*ebfedea0SLionel Sambuc if(code)
220*ebfedea0SLionel Sambuc return code;
221*ebfedea0SLionel Sambuc code = (*d->put)(d, &k, &v, replace ? 0 : R_NOOVERWRITE);
222*ebfedea0SLionel Sambuc db->hdb_unlock(context, db);
223*ebfedea0SLionel Sambuc if(code < 0) {
224*ebfedea0SLionel Sambuc code = errno;
225*ebfedea0SLionel Sambuc krb5_set_error_message(context, code, "Database %s put error: %s",
226*ebfedea0SLionel Sambuc db->hdb_name, strerror(code));
227*ebfedea0SLionel Sambuc return code;
228*ebfedea0SLionel Sambuc }
229*ebfedea0SLionel Sambuc if(code == 1) {
230*ebfedea0SLionel Sambuc krb5_clear_error_message(context);
231*ebfedea0SLionel Sambuc return HDB_ERR_EXISTS;
232*ebfedea0SLionel Sambuc }
233*ebfedea0SLionel Sambuc return 0;
234*ebfedea0SLionel Sambuc }
235*ebfedea0SLionel Sambuc
236*ebfedea0SLionel Sambuc static krb5_error_code
DB__del(krb5_context context,HDB * db,krb5_data key)237*ebfedea0SLionel Sambuc DB__del(krb5_context context, HDB *db, krb5_data key)
238*ebfedea0SLionel Sambuc {
239*ebfedea0SLionel Sambuc DB *d = (DB*)db->hdb_db;
240*ebfedea0SLionel Sambuc DBT k;
241*ebfedea0SLionel Sambuc krb5_error_code code;
242*ebfedea0SLionel Sambuc k.data = key.data;
243*ebfedea0SLionel Sambuc k.size = key.length;
244*ebfedea0SLionel Sambuc code = db->hdb_lock(context, db, HDB_WLOCK);
245*ebfedea0SLionel Sambuc if(code)
246*ebfedea0SLionel Sambuc return code;
247*ebfedea0SLionel Sambuc code = (*d->del)(d, &k, 0);
248*ebfedea0SLionel Sambuc db->hdb_unlock(context, db);
249*ebfedea0SLionel Sambuc if(code == 1) {
250*ebfedea0SLionel Sambuc code = errno;
251*ebfedea0SLionel Sambuc krb5_set_error_message(context, code, "Database %s put error: %s",
252*ebfedea0SLionel Sambuc db->hdb_name, strerror(code));
253*ebfedea0SLionel Sambuc return code;
254*ebfedea0SLionel Sambuc }
255*ebfedea0SLionel Sambuc if(code < 0)
256*ebfedea0SLionel Sambuc return errno;
257*ebfedea0SLionel Sambuc return 0;
258*ebfedea0SLionel Sambuc }
259*ebfedea0SLionel Sambuc
260*ebfedea0SLionel Sambuc static krb5_error_code
DB_open(krb5_context context,HDB * db,int flags,mode_t mode)261*ebfedea0SLionel Sambuc DB_open(krb5_context context, HDB *db, int flags, mode_t mode)
262*ebfedea0SLionel Sambuc {
263*ebfedea0SLionel Sambuc char *fn;
264*ebfedea0SLionel Sambuc krb5_error_code ret;
265*ebfedea0SLionel Sambuc
266*ebfedea0SLionel Sambuc asprintf(&fn, "%s.db", db->hdb_name);
267*ebfedea0SLionel Sambuc if (fn == NULL) {
268*ebfedea0SLionel Sambuc krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
269*ebfedea0SLionel Sambuc return ENOMEM;
270*ebfedea0SLionel Sambuc }
271*ebfedea0SLionel Sambuc db->hdb_db = dbopen(fn, flags, mode, DB_BTREE, NULL);
272*ebfedea0SLionel Sambuc free(fn);
273*ebfedea0SLionel Sambuc /* try to open without .db extension */
274*ebfedea0SLionel Sambuc if(db->hdb_db == NULL && errno == ENOENT)
275*ebfedea0SLionel Sambuc db->hdb_db = dbopen(db->hdb_name, flags, mode, DB_BTREE, NULL);
276*ebfedea0SLionel Sambuc if(db->hdb_db == NULL) {
277*ebfedea0SLionel Sambuc ret = errno;
278*ebfedea0SLionel Sambuc krb5_set_error_message(context, ret, "dbopen (%s): %s",
279*ebfedea0SLionel Sambuc db->hdb_name, strerror(ret));
280*ebfedea0SLionel Sambuc return ret;
281*ebfedea0SLionel Sambuc }
282*ebfedea0SLionel Sambuc if((flags & O_ACCMODE) == O_RDONLY)
283*ebfedea0SLionel Sambuc ret = hdb_check_db_format(context, db);
284*ebfedea0SLionel Sambuc else
285*ebfedea0SLionel Sambuc ret = hdb_init_db(context, db);
286*ebfedea0SLionel Sambuc if(ret == HDB_ERR_NOENTRY) {
287*ebfedea0SLionel Sambuc krb5_clear_error_message(context);
288*ebfedea0SLionel Sambuc return 0;
289*ebfedea0SLionel Sambuc }
290*ebfedea0SLionel Sambuc if (ret) {
291*ebfedea0SLionel Sambuc DB_close(context, db);
292*ebfedea0SLionel Sambuc krb5_set_error_message(context, ret, "hdb_open: failed %s database %s",
293*ebfedea0SLionel Sambuc (flags & O_ACCMODE) == O_RDONLY ?
294*ebfedea0SLionel Sambuc "checking format of" : "initialize",
295*ebfedea0SLionel Sambuc db->hdb_name);
296*ebfedea0SLionel Sambuc }
297*ebfedea0SLionel Sambuc return ret;
298*ebfedea0SLionel Sambuc }
299*ebfedea0SLionel Sambuc
300*ebfedea0SLionel Sambuc krb5_error_code
hdb_db_create(krb5_context context,HDB ** db,const char * filename)301*ebfedea0SLionel Sambuc hdb_db_create(krb5_context context, HDB **db,
302*ebfedea0SLionel Sambuc const char *filename)
303*ebfedea0SLionel Sambuc {
304*ebfedea0SLionel Sambuc *db = calloc(1, sizeof(**db));
305*ebfedea0SLionel Sambuc if (*db == NULL) {
306*ebfedea0SLionel Sambuc krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
307*ebfedea0SLionel Sambuc return ENOMEM;
308*ebfedea0SLionel Sambuc }
309*ebfedea0SLionel Sambuc
310*ebfedea0SLionel Sambuc (*db)->hdb_db = NULL;
311*ebfedea0SLionel Sambuc (*db)->hdb_name = strdup(filename);
312*ebfedea0SLionel Sambuc if ((*db)->hdb_name == NULL) {
313*ebfedea0SLionel Sambuc free(*db);
314*ebfedea0SLionel Sambuc *db = NULL;
315*ebfedea0SLionel Sambuc krb5_set_error_message(context, ENOMEM, "malloc: out of memory");
316*ebfedea0SLionel Sambuc return ENOMEM;
317*ebfedea0SLionel Sambuc }
318*ebfedea0SLionel Sambuc (*db)->hdb_master_key_set = 0;
319*ebfedea0SLionel Sambuc (*db)->hdb_openp = 0;
320*ebfedea0SLionel Sambuc (*db)->hdb_capability_flags = HDB_CAP_F_HANDLE_ENTERPRISE_PRINCIPAL;
321*ebfedea0SLionel Sambuc (*db)->hdb_open = DB_open;
322*ebfedea0SLionel Sambuc (*db)->hdb_close = DB_close;
323*ebfedea0SLionel Sambuc (*db)->hdb_fetch_kvno = _hdb_fetch_kvno;
324*ebfedea0SLionel Sambuc (*db)->hdb_store = _hdb_store;
325*ebfedea0SLionel Sambuc (*db)->hdb_remove = _hdb_remove;
326*ebfedea0SLionel Sambuc (*db)->hdb_firstkey = DB_firstkey;
327*ebfedea0SLionel Sambuc (*db)->hdb_nextkey= DB_nextkey;
328*ebfedea0SLionel Sambuc (*db)->hdb_lock = DB_lock;
329*ebfedea0SLionel Sambuc (*db)->hdb_unlock = DB_unlock;
330*ebfedea0SLionel Sambuc (*db)->hdb_rename = DB_rename;
331*ebfedea0SLionel Sambuc (*db)->hdb__get = DB__get;
332*ebfedea0SLionel Sambuc (*db)->hdb__put = DB__put;
333*ebfedea0SLionel Sambuc (*db)->hdb__del = DB__del;
334*ebfedea0SLionel Sambuc (*db)->hdb_destroy = DB_destroy;
335*ebfedea0SLionel Sambuc return 0;
336*ebfedea0SLionel Sambuc }
337*ebfedea0SLionel Sambuc
338*ebfedea0SLionel Sambuc #endif /* HAVE_DB1 */
339