summaryrefslogtreecommitdiffstats
path: root/crypto/heimdal/lib/hdb/db.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/db.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/db.c')
-rw-r--r--crypto/heimdal/lib/hdb/db.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/crypto/heimdal/lib/hdb/db.c b/crypto/heimdal/lib/hdb/db.c
index 4699437..6f9c688 100644
--- a/crypto/heimdal/lib/hdb/db.c
+++ b/crypto/heimdal/lib/hdb/db.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: db.c,v 1.25 1999/12/02 17:05:04 joda Exp $");
+RCSID("$Id: db.c,v 1.28 2001/01/30 01:24:00 assar Exp $");
-#ifdef HAVE_DB_H
+#if defined(HAVE_DB_H) && DB_VERSION_MAJOR < 3
static krb5_error_code
DB_close(krb5_context context, HDB *db)
@@ -102,13 +102,21 @@ DB_seq(krb5_context context, HDB *db,
data.length = value.size;
if (hdb_value2entry(context, &data, entry))
return DB_seq(context, db, flags, entry, R_NEXT);
- if (db->master_key_set && (flags & HDB_F_DECRYPT))
- hdb_unseal_keys (db, entry);
- if (entry->principal == NULL) {
+ if (db->master_key_set && (flags & HDB_F_DECRYPT)) {
+ code = hdb_unseal_keys (context, db, entry);
+ if (code)
+ hdb_free_entry (context, entry);
+ }
+ if (code == 0 && entry->principal == NULL) {
entry->principal = malloc(sizeof(*entry->principal));
- hdb_key2principal(context, &key_data, entry->principal);
+ if (entry->principal == NULL) {
+ code = ENOMEM;
+ hdb_free_entry (context, entry);
+ } else {
+ hdb_key2principal(context, &key_data, entry->principal);
+ }
}
- return 0;
+ return code;
}
OpenPOWER on IntegriCloud