summaryrefslogtreecommitdiff
path: root/source4/heimdal/lib/hdb/ndbm.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2005-12-15 20:38:24 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:47:26 -0500
commitfbf106f6701c580f5839da575996de34fc953e1f (patch)
tree3691623409aab4ff0ede4b50cc4fcbfa255814f3 /source4/heimdal/lib/hdb/ndbm.c
parentd8966dcd7e88df9817c81434056628c0beff21e3 (diff)
downloadsamba-fbf106f6701c580f5839da575996de34fc953e1f.tar.gz
samba-fbf106f6701c580f5839da575996de34fc953e1f.tar.bz2
samba-fbf106f6701c580f5839da575996de34fc953e1f.zip
r12269: Update to current lorikeet-heimdal. This changed the way the hdb
interface worked, so hdb-ldb.c and the glue have been updated. Andrew Bartlett (This used to be commit 8fd5224c6b5c17c3a2c04c7366b7e367012db77e)
Diffstat (limited to 'source4/heimdal/lib/hdb/ndbm.c')
-rw-r--r--source4/heimdal/lib/hdb/ndbm.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/source4/heimdal/lib/hdb/ndbm.c b/source4/heimdal/lib/hdb/ndbm.c
index 793d03829d..f4c2497abc 100644
--- a/source4/heimdal/lib/hdb/ndbm.c
+++ b/source4/heimdal/lib/hdb/ndbm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan
+ * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -33,7 +33,7 @@
#include "hdb_locl.h"
-RCSID("$Id: ndbm.c,v 1.36 2005/11/28 23:31:36 lha Exp $");
+RCSID("$Id: ndbm.c,v 1.38 2005/12/13 11:54:10 lha Exp $");
#if HAVE_NDBM
@@ -77,7 +77,7 @@ NDBM_unlock(krb5_context context, HDB *db)
static krb5_error_code
NDBM_seq(krb5_context context, HDB *db,
- unsigned flags, hdb_entry *entry, int first)
+ unsigned flags, hdb_entry_ex *entry, int first)
{
struct ndbm_db *d = (struct ndbm_db *)db->hdb_db;
@@ -99,21 +99,22 @@ NDBM_seq(krb5_context context, HDB *db,
db->hdb_unlock(context, db);
data.data = value.dptr;
data.length = value.dsize;
- if(hdb_value2entry(context, &data, entry))
+ memset(entry, 0, sizeof(*entry));
+ if(hdb_value2entry(context, &data, &entry->entry))
return NDBM_seq(context, db, flags, entry, 0);
if (db->hdb_master_key_set && (flags & HDB_F_DECRYPT)) {
- ret = hdb_unseal_keys (context, db, entry);
+ ret = hdb_unseal_keys (context, db, &entry->entry);
if (ret)
hdb_free_entry (context, entry);
}
- if (entry->principal == NULL) {
- entry->principal = malloc (sizeof(*entry->principal));
- if (entry->principal == NULL) {
+ if (ret == 0 && entry->entry.principal == NULL) {
+ entry->entry.principal = malloc (sizeof(*entry->entry.principal));
+ if (entry->entry.principal == NULL) {
ret = ENOMEM;
hdb_free_entry (context, entry);
krb5_set_error_string(context, "malloc: out of memory");
} else {
- hdb_key2principal (context, &key_data, entry->principal);
+ hdb_key2principal (context, &key_data, entry->entry.principal);
}
}
return ret;
@@ -121,14 +122,14 @@ NDBM_seq(krb5_context context, HDB *db,
static krb5_error_code
-NDBM_firstkey(krb5_context context, HDB *db, unsigned flags, hdb_entry *entry)
+NDBM_firstkey(krb5_context context, HDB *db,unsigned flags,hdb_entry_ex *entry)
{
return NDBM_seq(context, db, flags, entry, 1);
}
static krb5_error_code
-NDBM_nextkey(krb5_context context, HDB *db, unsigned flags, hdb_entry *entry)
+NDBM_nextkey(krb5_context context, HDB *db, unsigned flags,hdb_entry_ex *entry)
{
return NDBM_seq(context, db, flags, entry, 0);
}
@@ -339,8 +340,6 @@ hdb_ndbm_create(krb5_context context, HDB **db,
return ENOMEM;
}
- memset(*db, '\0', sizeof(**db));
-
(*db)->hdb_db = NULL;
(*db)->hdb_name = strdup(filename);
if ((*db)->hdb_name == NULL) {