[261] in Kerberos-V5-bugs
FILE keytab sequential scan patches
daemon@ATHENA.MIT.EDU (Barry Jaspan)
Thu Dec 3 16:03:16 1992
Date: Thu, 3 Dec 92 15:27:38 -0500
From: "Barry Jaspan" <bjaspan@Athena.MIT.EDU>
To: kerberos@Athena.MIT.EDU, krb5-bugs@Athena.MIT.EDU
krb5_ktfile_get_next is declared to take a krb5_kt_cursor * but is
written to treat it as a krb5_kt_cursor. The following patch fixes
this descrepancy. Note that this is *not* an interface change, it is
fixing the code to using the already defined interface.
The patch also fixes the two pieces of code that I know of that uses
this function, as they were both written to pass a krb5_kt_cursor
(since, by experiment, that's what worked). Any other currently
working code that uses this function will have to be fixed.
Finally, the patch fixes a bug in the use of krb5_kt_end_seq_get the
two pieces of code that use the seqntial get code.
Barry Jaspan
Aktis, Inc.
===================================================================
RCS file: lib/keytab/file/RCS/ktf_next.c,v
retrieving revision 5.4
diff -c -r5.4 lib/keytab/file/ktf_next.c
*** 5.4 1991/06/06 09:45:27
--- lib/keytab/file/ktf_next.c 1992/12/03 20:06:14
***************
*** 41,47 ****
krb5_keytab_entry *entry;
krb5_kt_cursor *cursor;
{
! long *fileoff = (long *)cursor;
krb5_keytab_entry *cur_entry;
krb5_error_code kerror;
--- 41,47 ----
krb5_keytab_entry *entry;
krb5_kt_cursor *cursor;
{
! long *fileoff = (long *) *cursor;
krb5_keytab_entry *cur_entry;
krb5_error_code kerror;
===================================================================
RCS file: clients/klist/RCS/klist.c,v
retrieving revision 5.16
diff -c -r5.16 clients/klist/klist.c
*** 5.16 1992/11/20 20:26:24
--- clients/klist/klist.c 1992/12/03 20:09:41
***************
*** 156,162 ****
printf("---- --------------------------------------------------------------------------\n");
}
! while ((code = krb5_kt_next_entry(kt, &entry, cursor)) == 0) {
if (code = krb5_unparse_name(entry.principal, &pname)) {
com_err(progname, code, "while unparsing principal name");
exit(1);
--- 156,162 ----
printf("---- --------------------------------------------------------------------------\n");
}
! while ((code = krb5_kt_next_entry(kt, &entry, &cursor)) == 0) {
if (code = krb5_unparse_name(entry.principal, &pname)) {
com_err(progname, code, "while unparsing principal name");
exit(1);
***************
*** 173,179 ****
com_err(progname, code, "while scanning keytab");
exit(1);
}
! if (code = krb5_kt_end_seq_get(kt, cursor)) {
com_err(progname, code, "while ending keytab scan");
exit(1);
}
--- 173,179 ----
com_err(progname, code, "while scanning keytab");
exit(1);
}
! if (code = krb5_kt_end_seq_get(kt, &cursor)) {
com_err(progname, code, "while ending keytab scan");
exit(1);
}
===================================================================
RCS file: lib/krb425/RCS/rd_req.c,v
retrieving revision 5.13
diff -c -r5.13 lib/krb425/rd_req.c
*** 5.13 1992/11/12 22:09:04
--- lib/krb425/rd_req.c 1992/12/03 20:12:13
***************
*** 109,115 ****
r = krb5_kt_start_seq_get(ktid, &cur);
if (r) return krb425error(r);
! while ((r = krb5_kt_next_entry(ktid, &entry, cur)) == 0) {
if (krb5_princ_size(entry.principal) == 2 &&
strcmp(krb5_princ_component(entry.principal,0)->data,
service) == 0)
--- 109,115 ----
r = krb5_kt_start_seq_get(ktid, &cur);
if (r) return krb425error(r);
! while ((r = krb5_kt_next_entry(ktid, &entry, &cur)) == 0) {
if (krb5_princ_size(entry.principal) == 2 &&
strcmp(krb5_princ_component(entry.principal,0)->data,
service) == 0)
***************
*** 118,128 ****
if (r) {
if (r == KRB5_KT_END)
! krb5_kt_end_seq_get(ktid, cur);
return krb425error(KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN);
}
! r = krb5_kt_end_seq_get(ktid, cur);
if (r) return krb425error(r);
strcpy(buf, krb5_princ_component(entry.principal, 1)->data);
--- 118,128 ----
if (r) {
if (r == KRB5_KT_END)
! krb5_kt_end_seq_get(ktid, &cur);
return krb425error(KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN);
}
! r = krb5_kt_end_seq_get(ktid, &cur);
if (r) return krb425error(r);
strcpy(buf, krb5_princ_component(entry.principal, 1)->data);