diff options
author | nectar <nectar@FreeBSD.org> | 2002-02-19 15:46:56 +0000 |
---|---|---|
committer | nectar <nectar@FreeBSD.org> | 2002-02-19 15:46:56 +0000 |
commit | 69a91bec14ec3ad49d1c8a82c40a796755f9e4a3 (patch) | |
tree | 85ecf91fd00875cec4b93111d3a8ed9eec9cddfe /crypto/heimdal/lib/hdb/common.c | |
parent | 8db4cdb3da4228a5d93635e43825e2e8a2f66db7 (diff) | |
download | FreeBSD-src-69a91bec14ec3ad49d1c8a82c40a796755f9e4a3.zip FreeBSD-src-69a91bec14ec3ad49d1c8a82c40a796755f9e4a3.tar.gz |
Import of Heimdal Kerberos from KTH repository circa 2002/02/17.
Diffstat (limited to 'crypto/heimdal/lib/hdb/common.c')
-rw-r--r-- | crypto/heimdal/lib/hdb/common.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/crypto/heimdal/lib/hdb/common.c b/crypto/heimdal/lib/hdb/common.c index befde78..73bddf2 100644 --- a/crypto/heimdal/lib/hdb/common.c +++ b/crypto/heimdal/lib/hdb/common.c @@ -33,7 +33,7 @@ #include "hdb_locl.h" -RCSID("$Id: common.c,v 1.8 2001/01/30 01:22:17 assar Exp $"); +RCSID("$Id: common.c,v 1.10 2001/07/13 06:30:41 assar Exp $"); int hdb_principal2key(krb5_context context, krb5_principal p, krb5_data *key) @@ -50,6 +50,7 @@ hdb_principal2key(krb5_context context, krb5_principal p, krb5_data *key) len = length_Principal(&new); buf = malloc(len); if(buf == NULL){ + krb5_set_error_string(context, "malloc: out of memory"); ret = ENOMEM; goto out; } @@ -80,8 +81,10 @@ hdb_entry2value(krb5_context context, hdb_entry *ent, krb5_data *value) len = length_hdb_entry(ent); buf = malloc(len); - if(buf == NULL) + if(buf == NULL) { + krb5_set_error_string(context, "malloc: out of memory"); return ENOMEM; + } ret = encode_hdb_entry(buf + len - 1, len, ent, &len); if(ret){ free(buf); @@ -125,6 +128,19 @@ _hdb_store(krb5_context context, HDB *db, unsigned flags, hdb_entry *entry) krb5_data key, value; int code; + if(entry->generation == NULL) { + struct timeval t; + entry->generation = malloc(sizeof(*entry->generation)); + if(entry->generation == NULL) { + krb5_set_error_string(context, "malloc: out of memory"); + return ENOMEM; + } + gettimeofday(&t, NULL); + entry->generation->time = t.tv_sec; + entry->generation->usec = t.tv_usec; + entry->generation->gen = 0; + } else + entry->generation->gen++; hdb_principal2key(context, entry->principal, &key); code = hdb_seal_keys(context, db, entry); if (code) { |