Reintegrate changes lost during Macintosh checkin
authorEzra Peisach <epeisach@mit.edu>
Tue, 12 Sep 1995 01:14:12 +0000 (01:14 +0000)
committerEzra Peisach <epeisach@mit.edu>
Tue, 12 Sep 1995 01:14:12 +0000 (01:14 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6763 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/ccache/file/ChangeLog
src/lib/krb5/ccache/file/fcc.h
src/lib/krb5/ccache/file/fcc_gennew.c
src/lib/krb5/ccache/file/fcc_maybe.c
src/lib/krb5/ccache/file/fcc_read.c
src/lib/krb5/ccache/file/fcc_write.c

index ac4bb51d02dfbe1ec45acfc83e4ce53a98a046af..2bde4b58c5e30f46a11851bb550c2c16f4d4c344 100644 (file)
@@ -1,3 +1,12 @@
+Mon Sep 11 21:05:40 1995  Ezra Peisach  <epeisach@kangaroo.mit.edu>
+
+       * fcc_maybe.c (krb5_fcc_open_file): use THREEPARAMOPEN instead of
+       just open.
+
+Wed Sep 06 14:20:57 1995   Chris Provenzano (proven@mit.edu)
+
+         * file_read.c, file_write.c : s/keytype/enctype/g, s/KEYTYPE/ENCTYPE/g
+
 Wed Sept 6 12:00:00 EDT 1995   James Mattly    (mattly@fusion.com)
 
        * fcc_retrv.c: for _MACINTOSH, defined register to null for compiler
@@ -5,6 +14,15 @@ Wed Sept 6 12:00:00 EDT 1995  James Mattly    (mattly@fusion.com)
 
        * fcc_maybe.c: included <stdio.h>
 
+Tue Sep 05 22:58:52 1995
+
+       * fcc.h : Add another KRB5_FCC_FVNO but don't up the default.
+       * fcc_gennew.c, fcc_maybe.c : New version saves a length after 
+               version for whatever we want to put into the ccache before 
+               the first credential (like a time skew)
+        * fcc_read.c, fcc_write.c : Remove krb5_enctype references, and 
+               replace with krb5_keytype where appropriate
+  
 Tue Aug 29 13:36:00 EDT 1995   Paul Park       (pjpark@mit.edu)
        * fcc_reslv.c - Set magic number in successfully resolved ccache.
 
index 980a9c17e34c03837ecc05a0da9285db84c007c3..0e26fa7f696c60f99a19b9a65c366dd233f74244 100644 (file)
@@ -55,6 +55,7 @@
 #define KRB5_FCC_FVNO_1 0x0501         /* krb5 v5, fcc v1 */
 #define KRB5_FCC_FVNO_2 0x0502         /* krb5 v5, fcc v2 */
 #define KRB5_FCC_FVNO_3 0x0503         /* krb5 v5, fcc v3 */
+#define KRB5_FCC_FVNO_4 0x0504         /* krb5 v5, fcc v4 */
 
 #define KRB5_FCC_DEFAULT_FVNO KRB5_FCC_FVNO_3
 
index 13757e9d5193d0a2baf3fb5eaaa9cfd45382a948..93d963b150fc9e6d865b01470012e217213fb48b 100644 (file)
@@ -107,6 +107,7 @@ krb5_fcc_generate_new (context, id)
           goto err_out;
      } else {
          krb5_int16 fcc_fvno = htons(KRB5_FCC_DEFAULT_FVNO);
+         krb5_int16 fcc_flen = 0;
          int errsave, cnt;
 
          /* Ignore user's umask, set mode = 0600 */
@@ -125,6 +126,17 @@ krb5_fcc_generate_new (context, id)
              retcode = (cnt == -1) ? krb5_fcc_interpret(context, errsave) : KRB5_CC_IO;
               goto err_out;
          }
+         /* For version 4 we save a length for the rest of the header */
+         if (KRB5_FCC_DEFAULT_FVNO == KRB5_FCC_FVNO_4) {
+           if ((cnt = write(ret, (char *)&fcc_flen, sizeof(fcc_flen)))
+               != sizeof(fcc_flen)) {
+               errsave = errno;
+               (void) close(ret);
+               (void) unlink(((krb5_fcc_data *) lid->data)->filename);
+               retcode = (cnt == -1) ? krb5_fcc_interpret(context, errsave) : KRB5_CC_IO;
+                goto err_out;
+           }
+         }
          if (close(ret) == -1) {
              errsave = errno;
              (void) unlink(((krb5_fcc_data *) lid->data)->filename);
index 8df018b381aa025d098ef93f232315c85101ed7b..e70645503003959d3ecdf66f212abe053829855a 100644 (file)
@@ -267,15 +267,35 @@ krb5_fcc_open_file (context, id, mode)
             (void) close(fd);
             return KRB5_CCACHE_BADVNO;
         }
-        if ((fcc_fvno != htons(KRB5_FCC_FVNO_3)) &&
+        if ((fcc_fvno != htons(KRB5_FCC_FVNO_4)) &&
+            (fcc_fvno != htons(KRB5_FCC_FVNO_3)) &&
             (fcc_fvno != htons(KRB5_FCC_FVNO_2)) &&
             (fcc_fvno != htons(KRB5_FCC_FVNO_1))) {
             (void) fcc_lock_file(data, fd, UNLOCK_IT);
             (void) close(fd);
             return KRB5_CCACHE_BADVNO;
         }
-        data->version = ntohs(fcc_fvno);
-     }
-     data->fd = fd;
-     return 0;
+       if (fcc_fvno == htons(KRB5_FCC_FVNO_4)) {
+           krb5_ui_2 fcc_flen;
+           char buf[1024];
+           
+           if (read(fd, (char *)&fcc_flen, sizeof(fcc_flen)) 
+               != sizeof(fcc_flen)) {
+                    (void) fcc_lock_file(data, fd, UNLOCK_IT);
+                    (void) close(fd);
+                    return KRB5_CCACHE_BADVNO;
+           }
+           /* Skip past the header info for now */
+           if (fcc_flen = htons(fcc_flen)) {
+               if (read(fd, buf, fcc_flen) != fcc_flen) {
+                    (void) fcc_lock_file(data, fd, UNLOCK_IT);
+                    (void) close(fd);
+                    return KRB5_CCACHE_BADVNO;
+               }
+           }
+       }
+       data->version = ntohs(fcc_fvno);
+    }
+    data->fd = fd;
+    return 0;
 }
index e963d9eb71e3bff8388f461efc10255d61102c96..41395f14f775090079cfd2e4a2ffedbd06a29cac 100644 (file)
@@ -204,14 +204,11 @@ krb5_fcc_read_keyblock(context, id, keyblock)
      keyblock->contents = 0;
 
      kret = krb5_fcc_read_ui_2(context, id, &ui2);
-     keyblock->keytype = ui2;
+     keyblock->enctype = ui2;
      CHECK(kret);
-     if ((data->version == KRB5_FCC_FVNO_1) ||
-        (data->version == KRB5_FCC_FVNO_2))
-            keyblock->etype = ETYPE_UNKNOWN;
-     else {
+     if (data->version == KRB5_FCC_FVNO_3) {
             kret = krb5_fcc_read_ui_2(context, id, &ui2);
-            keyblock->etype = ui2;
+            keyblock->enctype = ui2;
             CHECK(kret);
      }
 
index 38067b5f50c1ea630ca9dd29934bb3b6bc213cad..566789ef2a33d3d69001bc5dc4c4d52995ee377d 100644 (file)
@@ -147,11 +147,10 @@ krb5_fcc_store_keyblock(context, id, keyblock)
      krb5_fcc_data *data = (krb5_fcc_data *)id->data;
      krb5_error_code ret;
 
-     ret = krb5_fcc_store_ui_2(context, id, keyblock->keytype);
+     ret = krb5_fcc_store_ui_2(context, id, keyblock->enctype);
      CHECK(ret);
-     if ((data->version != KRB5_FCC_FVNO_1) &&
-        (data->version != KRB5_FCC_FVNO_2)) {
-        ret = krb5_fcc_store_ui_2(context, id, keyblock->etype);
+     if (data->version == KRB5_FCC_FVNO_3) {
+        ret = krb5_fcc_store_ui_2(context, id, keyblock->enctype);
         CHECK(ret);
      }
      ret = krb5_fcc_store_int32(context, id, keyblock->length);