Skip Menu |
 

To: krb5-bugs@MIT.EDU
Subject: v4 ticket file format incompatibilities
From: Ken Raeburn <raeburn@MIT.EDU>
Date: Mon, 30 Dec 2002 15:48:02 -0500

See attached message. The issue_date value is stored as a "long" in
the current krb5 tree. This also causes problems when mixing apps
compiled for sparcv7 and sparcv9, or (presumably, but unconfirmed)
ia32 and ia64. jhawk suggests investigating whether the library can
be made to support both formats, and I agree.

Looking for the four zero-valued bytes (before or after the issue
date, depending on host byte order) is probably all it would take
(until 2038, and then we get other problems), though we should still
think about what format should be used for writing on various
platforms to ease the transition.

Ken
Download (untitled)
message/rfc822 4.6KiB
Return-Path: <krbdev-admin@MIT.EDU>
Received: from pacific-carrier-annex.mit.edu by po9.mit.edu (8.9.2/4.7) id
MAA10570; Fri, 27 Dec 2002 12:20:57 -0500 (EST)
Received: from pch.mit.edu (PCH.MIT.EDU [18.7.21.90])
by pacific-carrier-annex.mit.edu (8.9.2/8.9.2) with ESMTP id MAA22855;
Fri, 27 Dec 2002 12:19:20 -0500 (EST)
Received: from pch.mit.edu (localhost [127.0.0.1])
by pch.mit.edu (8.9.3+Sun/8.9.3) with ESMTP id MAA00012;
Fri, 27 Dec 2002 12:19:17 -0500 (EST)
Received: from pacific-carrier-annex.mit.edu (PACIFIC-CARRIER-ANNEX.MIT.EDU
[18.7.21.83])
by pch.mit.edu (8.9.3+Sun/8.9.3) with ESMTP id MAA00005
for <krbdev@PCH.mit.edu>; Fri, 27 Dec 2002 12:18:33 -0500 (EST)
Received: from mailhub-1.iastate.edu (mailhub-1.iastate.edu [129.186.140.3])
by pacific-carrier-annex.mit.edu (8.9.2/8.9.2) with ESMTP id MAA22676
for <krbdev@mit.edu>; Fri, 27 Dec 2002 12:18:33 -0500 (EST)
Received: from mailout-1.iastate.edu (mailout-1.iastate.edu [129.186.140.1])
by mailhub-1.iastate.edu (8.9.3/8.9.3) with SMTP id LAA23145
for <krbdev@mit.edu>; Fri, 27 Dec 2002 11:18:32 -0600
Received: from pvtest.ait.iastate.edu(129.186.145.229) by
mailout-1.iastate.edu via csmap
id 26803; Fri, 27 Dec 2002 11:34:18 -0600 (CST)
Received: from localhost (john@localhost)
by pvtest.ait.iastate.edu (8.8.8/8.8.5) with SMTP id LAA01917
for <krbdev@mit.edu>; Fri, 27 Dec 2002 11:18:32 -0600 (CST)
Message-Id: <200212271718.LAA01917@pvtest.ait.iastate.edu>
To: krbdev@mit.edu
Subject: format of V4 ticketfile created by V5 differs?
From: John Hascall <john@iastate.edu>
Sender: krbdev-admin@MIT.EDU
Errors-To: krbdev-admin@MIT.EDU
X-BeenThere: krbdev@mit.edu
X-Mailman-Version: 2.0
Precedence: bulk
List-Help: <mailto:krbdev-request@mit.edu?subject=help>
List-Post: <mailto:krbdev@mit.edu>
List-Subscribe: <http://mailman.mit.edu/mailman/listinfo/krbdev>,
<mailto:krbdev-request@mit.edu?subject=subscribe>
List-Id: Kerberos Developers Mailing List <krbdev.mit.edu>
List-Unsubscribe: <http://mailman.mit.edu/mailman/listinfo/krbdev>,
<mailto:krbdev-request@mit.edu?subject=unsubscribe>
List-Archive: <http://mailman.mit.edu/pipermail/krbdev/>
X-Original-Date: Fri, 27 Dec 2002 11:18:32 CST
Date: Fri, 27 Dec 2002 11:18:32 CST
Lines: 59
Xref: all-in-one list.mit.krbdev:6808 all.2002-12:3398
MIME-Version: 1.0


I've noticed that the format of the V4 ticketfile created by the
V5 "compatibility routines" (1.2.6) differs from the format created
by our original V4 apps (and I guess I don't know which is "correct").
From our perspective, there are an extra 4 bytes of zeros at end
of each ticket created by the V5 apps/routines, for example:

Show quoted text
> od -c /var/dss/kerberos/tkt/tkt_3e0c7aa506fd5b
0000000 j o h n \0 \0 k r b t g t \0 I A S
0000020 T A T E . E D U \0 I A S T A T E
0000040 . E D U \0 343 s a v k 026 016 253 x \0 \0
0000060 \0 002 \0 \0 \0 8 \0 \0 \0 l , / 343 304 0
0000100 303 245 245 201 220 z 360 274 < 237 ; 312 273 { \n 263
0000120 & M 002 005 ) 225 216 Y 263 363 335 217 327 326 351 031
0000140 237 352 210 022 005 262 250 230 332 022 321 Y . 202 374 ^
0000160 027 l x \f > \0 \0 \0 \0 a c c t s r v
^^^^^^^^^^^^^^ \___start of 2nd ticket
\____here____/

this seems to be because of the way that krb_save_credentials() and
tf_save_cred() are declared, for example:

KRB5_DLLIMP int KRB5_CALLCONV krb_save_credentials
PROTOTYPE((char FAR *service, char FAR *instance, char FAR *realm,
C_Block session, int lifetime, int kvno,
KTEXT ticket, long issue_date));
^^^^
(8 bytes on this machine!)

I noted that CREDENTIALS.issue_date is defined as a KRB4_32 type,
so if I change them both like this:

KRB5_DLLIMP int KRB5_CALLCONV krb_save_credentials
PROTOTYPE((char FAR *service, char FAR *instance, char FAR *realm,
C_Block session, int lifetime, int kvno,
KTEXT ticket, KRB4_32 issue_date));
^^^^^^^
(4 bytes everywhere)

and change the end of tf_save_cred() from this:

if (write(fd, (char *) &issue_date, sizeof(long))
!= sizeof(long))

to this:

if (write(fd, (char *) &issue_date, sizeof(issue_date))
!= sizeof(issue_date))

and recompile, then everything seems to work together properly.
Is this correct?



John

Show quoted text
_______________________________________________
krbdev mailing list krbdev@mit.edu
http://mailman.mit.edu/mailman/listinfo/krbdev
Date: Fri, 5 Sep 2003 18:02:25 -0400
From: Nalin Dahyabhai <nalin@redhat.com>
To: krb5-bugs@mit.edu
Subject: 64-bit cleanliness in lib/krb4/tf_util.c
Hi, I've stumbled onto a 64-bit cleanliness problem in tf_util.c's
versions of tf_get_cred() and tf_save_cred(). The issue date in the
credential structure is written to and read from the file as a long.

If a 64-bit system can also run 32-bit binaries, the 32-bit library and
the 64-bit library (or rather, apps which link against them) won't be
able to share the same file. I'm attaching a patch which works on my
test system (though now that I think about it some more, the code could
as easily read and write the issue_date field in the credentials
structure directly instead of using a temporary).

Thanks,

Nalin

Message body is not shown because sender requested not to inline it.

To: rt@krbdev.mit.edu
Cc:
Subject: Re: [krbdev.mit.edu #1818] 64-bit cleanliness in lib/krb4/tf_util.c
From: Sam Hartman <hartmans@mit.edu>
Date: Sun, 07 Sep 2003 15:08:55 -0400
RT-Send-Cc:
Show quoted text
>>>>> "nalin@redhat" == nalin@redhat com via RT <rt-comment@krbdev.mit.edu> writes:

nalin@redhat> Hi, I've stumbled onto a 64-bit cleanliness problem
nalin@redhat> in tf_util.c's versions of tf_get_cred() and
nalin@redhat> tf_save_cred(). The issue date in the credential
nalin@redhat> structure is written to and read from the file as a
nalin@redhat> long.

Unfortunately, this is not a bug, but rather the behavior people seem
to expect. Or at least the people with 64-bit systems don't want to
see this change because it would break existing ticket files.

The current claim is that the ticket-file format is dependent on
sizeof long and thus is dependent on the ABI of the library in
question. If you wanted a sane authentication system you wouldn't be
using krb4.


There has been some discussion of adding support to read both formats
on all systems but I don't think code has been written.

This is a duplicate of another report with a much longer explanation
of the issue; I don't remember which report right now, but will try to
find it and link the two tickets.
From: hartmans@mit.edu
Subject: CVS Commit
Patch from Alejandro R. Sedeno and Jeffrey Hutzelman to allow krb4 to
read 32-bit and 64-bit ticket files on 32-bit and 64-bit systems.
Previously the ticket file format depended on the ABI. Significant
backward compatibility is maintained; the patch works by writing
alignment records that are valid (but meaningless) ticket file entries
but that allow systems to get realigned. As a consequence an old
library will see additional meaningless ticket file entries when it
reads a ticket file produced by the new code. These entries are
harmless and will be ignored.

Commit By: hartmans



Revision: 18076
Changed Files:
U trunk/src/lib/krb4/krb4int.h
U trunk/src/lib/krb4/memcache.c
U trunk/src/lib/krb4/save_creds.c
U trunk/src/lib/krb4/tf_util.c