5230b2f8f5
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>