summaryrefslogtreecommitdiffstats
path: root/crypto/heimdal/lib/hdb/ndbm.c
diff options
context:
space:
mode:
authorassar <assar@FreeBSD.org>2001-02-13 16:46:19 +0000
committerassar <assar@FreeBSD.org>2001-02-13 16:46:19 +0000
commit3a971fe69aad52dfd248901ae796e64a96ae3e37 (patch)
treeac7b5c62510ffa9f0316643bcb19a3fed3d5bef7 /crypto/heimdal/lib/hdb/ndbm.c
parent2934fc23653f64b32f4db32233d7eda11ca274f0 (diff)
parentebfe6dc471c206300fd82c7c0fd145f683aa52f6 (diff)
downloadFreeBSD-src-3a971fe69aad52dfd248901ae796e64a96ae3e37.zip
FreeBSD-src-3a971fe69aad52dfd248901ae796e64a96ae3e37.tar.gz
This commit was generated by cvs2svn to compensate for changes in r72445,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'crypto/heimdal/lib/hdb/ndbm.c')
-rw-r--r--crypto/heimdal/lib/hdb/ndbm.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/crypto/heimdal/lib/hdb/ndbm.c b/crypto/heimdal/lib/hdb/ndbm.c
index 79ca978..b4335f9 100644
--- a/crypto/heimdal/lib/hdb/ndbm.c
+++ b/crypto/heimdal/lib/hdb/ndbm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1998, 1999 Kungliga Tekniska Högskolan
+ * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -33,9 +33,9 @@
#include "hdb_locl.h"
-RCSID("$Id: ndbm.c,v 1.26 1999/12/02 17:05:05 joda Exp $");
+RCSID("$Id: ndbm.c,v 1.30 2001/01/30 01:24:00 assar Exp $");
-#ifdef HAVE_NDBM_H
+#if defined(HAVE_NDBM_H) || defined(HAVE_GDBM_NDBM_H)
struct ndbm_db {
DBM *db;
@@ -75,7 +75,7 @@ NDBM_seq(krb5_context context, HDB *db,
struct ndbm_db *d = (struct ndbm_db *)db->db;
datum key, value;
krb5_data key_data, data;
- krb5_error_code ret;
+ krb5_error_code ret = 0;
if(first)
key = dbm_firstkey(d->db);
@@ -93,13 +93,21 @@ NDBM_seq(krb5_context context, HDB *db,
data.length = value.dsize;
if(hdb_value2entry(context, &data, entry))
return NDBM_seq(context, db, flags, entry, 0);
- if (db->master_key_set && (flags & HDB_F_DECRYPT))
- hdb_unseal_keys (db, entry);
+ if (db->master_key_set && (flags & HDB_F_DECRYPT)) {
+ ret = hdb_unseal_keys (context, db, entry);
+ if (ret)
+ hdb_free_entry (context, entry);
+ }
if (entry->principal == NULL) {
entry->principal = malloc (sizeof(*entry->principal));
- hdb_key2principal (context, &key_data, entry->principal);
+ if (entry->principal == NULL) {
+ ret = ENOMEM;
+ hdb_free_entry (context, entry);
+ } else {
+ hdb_key2principal (context, &key_data, entry->principal);
+ }
}
- return 0;
+ return ret;
}
@@ -312,5 +320,4 @@ hdb_ndbm_create(krb5_context context, HDB **db,
return 0;
}
-
#endif
OpenPOWER on IntegriCloud