preauthuserdbcommon.c: Move token-getting code to below callback.
[hcoop/debian/courier-authlib.git] / bdbobj / bdbobj3.c
CommitLineData
d9898ee8 1/*
2** Copyright 1998 - 1999 Double Precision, Inc. See COPYING for
3** distribution information.
4*/
5
6#include <string.h>
7#include <stdlib.h>
8#include "bdbobj.h"
9
10int bdbobj_delete(struct bdbobj *obj, const char *key, size_t keylen)
11{
12DBT dkey, val;
13
14 if (!obj->has_dbf) return (0);
15
16 memset(&dkey, 0, sizeof(dkey));
17 memset(&val, 0, sizeof(val));
18 dkey.data=(void *)key;
19 dkey.size=keylen;
20
21#if DB_VERSION_MAJOR < 2
22 if ( (*obj->dbf->del)(obj->dbf, &dkey, 0)) return (-1);
23#else
24 if ( (*obj->dbf->del)(obj->dbf, 0, &dkey, 0)) return (-1);
25#endif
26 return (0);
27}