Discard old keys in MIT dump files in hprop
commit5230b2f8f532cd82c516f1a9c2cbcb8795fb580d
authorRuss Allbery <rra@stanford.edu>
Fri, 29 Jan 2010 06:21:50 +0000 (28 22:21 -0800)
committerLove Hornquist Astrand <lha@h5l.org>
Tue, 16 Mar 2010 18:48:15 +0000 (16 11:48 -0700)
tree90bca4aaad64d8618df4ca577a01db5b88c53ee6
parent69ea9b38e9487b38ac6a7101dd32811c74fb7fcd
Discard old keys in MIT dump files in hprop

An MIT dump file may contain multiple key sets for one principal, with
different kvnos.  The Heimdal database can only represent a single
kvno, and previously the kvno was set to the last key found in the entry
and all keys were added to the entry.  Since kvnos are given from high
to low in the database dump, this would result in the principal getting
the kvno of the oldest key and all keys stored without regard for kvno.

Instead, ignore all keys with kvnos lower than the first kvno we see and
only store keys with a kvno matching it.  If we see a key with a kvno
higher than the first kvno we see, exit with an error since that case is
not currently handled (and should not happen in a typical MIT database
dump).

Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
kdc/mit_dump.c