(akf_next_entry): set timetsamp, always go the a predicatble position

on error


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7702 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
2000-01-02 00:45:38 +00:00
parent 875d3eb4a1
commit 32a12060f5

View File

@@ -200,6 +200,7 @@ akf_next_entry(krb5_context context,
krb5_keytab_entry *entry, krb5_keytab_entry *entry,
krb5_kt_cursor *cursor) krb5_kt_cursor *cursor)
{ {
krb5_error_code error;
struct akf_data *d = id->data; struct akf_data *d = id->data;
int32_t kvno; int32_t kvno;
off_t pos; off_t pos;
@@ -210,24 +211,37 @@ akf_next_entry(krb5_context context,
if ((pos - 4) / (4 + 8) >= d->num_entries) if ((pos - 4) / (4 + 8) >= d->num_entries)
return KRB5_KT_END; return KRB5_KT_END;
ret = krb5_ret_int32(cursor->sp, &kvno); ret = krb5_make_principal (context, &entry->principal,
d->realm, "afs", d->cell, NULL);
if (ret) if (ret)
return ret; goto out;
ret = krb5_ret_int32(cursor->sp, &kvno);
if (ret) {
krb5_free_principal (context, entry->principal);
goto out;
}
entry->vno = (int8_t) kvno; entry->vno = (int8_t) kvno;
krb5_make_principal (context, &entry->principal,
d->realm, "afs", d->cell, NULL);
entry->keyblock.keytype = ETYPE_DES_CBC_MD5; entry->keyblock.keytype = ETYPE_DES_CBC_MD5;
entry->keyblock.keyvalue.length = 8; entry->keyblock.keyvalue.length = 8;
entry->keyblock.keyvalue.data = malloc (8); entry->keyblock.keyvalue.data = malloc (8);
if (entry->keyblock.keyvalue.data == NULL) {
krb5_free_principal (context, entry->principal);
ret = ENOMEM;
goto out;
}
ret = cursor->sp->fetch(cursor->sp, entry->keyblock.keyvalue.data, 8); ret = cursor->sp->fetch(cursor->sp, entry->keyblock.keyvalue.data, 8);
if(ret != 8) if(ret != 8)
return (ret < 0)? errno : KRB5_KT_END; ret = (ret < 0) ? errno : KRB5_KT_END;
entry->timestamp = time(NULL);
out:
cursor->sp->seek(cursor->sp, pos + 4 + 8, SEEK_SET); cursor->sp->seek(cursor->sp, pos + 4 + 8, SEEK_SET);
return 0; return ret;
} }
static krb5_error_code static krb5_error_code