]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE14-64bit-ticket-file-20070809
authorRainer Toebbicke <rtb@pclella.cern.ch>
Thu, 9 Aug 2007 15:59:54 +0000 (15:59 +0000)
committerDerrick Brashear <shadow@dementia.org>
Thu, 9 Aug 2007 15:59:54 +0000 (15:59 +0000)
fix the ticket files we write on 64 bit

(cherry picked from commit 6811175f37ba51691556d64309d59dbff8a1a29c)

src/auth/ktc.c
src/kauth/krb_tf.c

index 7b6bac4fbe84863d31c69d3645aab058b194aaea..15776210e7accd4020a48aa21cf194b9d38399e5 100644 (file)
@@ -1163,6 +1163,7 @@ afs_tf_get_cred(principal, token)
 {
     int k_errno;
     int kvno, lifetime;
+    long mit_compat;           /* MIT Kerberos 5 with Krb4 uses a "long" for issue_date */
 
     if (fd < 0) {
        return TKT_FIL_INI;
@@ -1199,10 +1200,10 @@ afs_tf_get_cred(principal, token)
        /* don't try to read a silly amount into ticket->dat */
        token->ticketLen > MAXKTCTICKETLEN
        || tf_read((char *)(token->ticket), token->ticketLen) < 1
-       || tf_read((char *)&(token->startTime),
-                  sizeof(token->startTime)) < 1) {
+       || tf_read((char *)&mit_compat, sizeof(mit_compat)) < 1) {
        return TKT_FIL_FMT;
     }
+    token->startTime = mit_compat;
     token->endTime = life_to_time(token->startTime, lifetime);
     token->kvno = kvno;
     return 0;
@@ -1330,6 +1331,7 @@ afs_tf_save_cred(aserver, atoken, aclient)
     off_t start;
     int lifetime, kvno;
     int count;                 /* count for write */
+    long mit_compat;           /* MIT Kerberos 5 with Krb4 uses a "long" for issue_date */
 
     if (fd < 0) {              /* fd is ticket file as set by afs_tf_init */
        return TKT_FIL_INI;
@@ -1399,8 +1401,9 @@ afs_tf_save_cred(aserver, atoken, aclient)
     if (write(fd, atoken->ticket, count) != count)
        goto bad;
     /* Issue date */
-    if (write(fd, (char *)&atoken->startTime, sizeof(afs_int32))
-       != sizeof(afs_int32))
+    mit_compat = atoken->startTime;
+    if (write(fd, (char *)&mit_compat, sizeof(mit_compat))
+       != sizeof(mit_compat))
        goto bad;
 
     /* Actually, we should check each write for success */
index 5e75d8f02b8d4b7a951aea0a234c05a0be5f0671..f6f4c80790fa9231b4ef2f04354235baad0b9593 100644 (file)
@@ -84,6 +84,7 @@ krb_write_ticket_file(realm)
     char *tf_name;
     struct ktc_principal client, server;
     struct ktc_token token;
+    long mit_compat;   /* MIT Kerberos 5 with Krb4 uses a "long" for issue_date */
 
     if ((strlen(realm) >= sizeof(client.cell)))
        return KABADNAME;
@@ -149,8 +150,9 @@ krb_write_ticket_file(realm)
     if (write(fd, (char *)(token.ticket), count) != count)
        goto bad;
     /* Issue date */
-    if (write(fd, (char *)&token.startTime, sizeof(afs_int32))
-       != sizeof(afs_int32))
+    mit_compat = token.startTime;
+    if (write(fd, (char *)&mit_compat, sizeof(mit_compat))
+       != sizeof(mit_compat))
        goto bad;
     close(fd);
     return 0;