store the kvno % 256 as the byte and the complete 32 bit kvno after
the end of the current keytab entry git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10871 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997 - 2001 Kungliga Tekniska H<>gskolan
|
||||
* Copyright (c) 1997 - 2002 Kungliga Tekniska H<>gskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -262,6 +262,7 @@ krb5_kt_compare(krb5_context context,
|
||||
/*
|
||||
* Retrieve the keytab entry for `principal, kvno, enctype' into `entry'
|
||||
* from the keytab `id'.
|
||||
* kvno == 0 is a wildcard and gives the keytab with the highest vno.
|
||||
* Return 0 or an error.
|
||||
*/
|
||||
|
||||
@@ -287,7 +288,10 @@ krb5_kt_get_entry(krb5_context context,
|
||||
entry->vno = 0;
|
||||
while (krb5_kt_next_entry(context, id, &tmp, &cursor) == 0) {
|
||||
if (krb5_kt_compare(context, &tmp, principal, 0, enctype)) {
|
||||
if (kvno == tmp.vno) {
|
||||
/* the file keytab might only store the lower 8 bits of
|
||||
the kvno, so only compare those bits */
|
||||
if (kvno == tmp.vno
|
||||
|| (tmp.vno < 256 && kvno % 256 == tmp.vno)) {
|
||||
krb5_kt_copy_entry_contents (context, &tmp, entry);
|
||||
krb5_kt_free_entry (context, &tmp);
|
||||
krb5_kt_end_seq_get(context, id, &cursor);
|
||||
@@ -310,16 +314,19 @@ krb5_kt_get_entry(krb5_context context,
|
||||
krb5_kt_get_name (context, id, kt_name, sizeof(kt_name));
|
||||
|
||||
krb5_set_error_string (context,
|
||||
"failed to find %s in keytab %s",
|
||||
princ, kt_name);
|
||||
"failed to find %s%s%d%s in keytab %s",
|
||||
princ,
|
||||
kvno ? "(" : "",
|
||||
kvno,
|
||||
kvno ? ")" : "",
|
||||
kt_name);
|
||||
return KRB5_KT_NOTFOUND;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy the contents of `in' into `out'.
|
||||
* Return 0 or an error.
|
||||
*/
|
||||
* Return 0 or an error. */
|
||||
|
||||
krb5_error_code
|
||||
krb5_kt_copy_entry_contents(krb5_context context,
|
||||
|
Reference in New Issue
Block a user