aboutsummaryrefslogtreecommitdiff
path: root/src/lib/krb5/ccache/stdio
diff options
context:
space:
mode:
authorChris Provenzano <proven@mit.edu>1995-09-06 03:44:03 +0000
committerChris Provenzano <proven@mit.edu>1995-09-06 03:44:03 +0000
commit350a5ce8a6310421c8b3046928538074300979a0 (patch)
tree79ae84f510af393fc9ca0217e52088f4e8f66c04 /src/lib/krb5/ccache/stdio
parent6ba25276589cda3bd8b37ac489833c701dad8569 (diff)
downloadkrb5-350a5ce8a6310421c8b3046928538074300979a0.zip
krb5-350a5ce8a6310421c8b3046928538074300979a0.tar.gz
krb5-350a5ce8a6310421c8b3046928538074300979a0.tar.bz2
* scc.h : Add another KRB5_SCC_FVNO but don't up the default.
* scc_gennew.c, scc_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) * scc_read.c, scc_write.c : Remove krb5_enctype references, and replace with krb5_keytype where appropriate git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6684 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/krb5/ccache/stdio')
-rw-r--r--src/lib/krb5/ccache/stdio/ChangeLog9
-rw-r--r--src/lib/krb5/ccache/stdio/scc.h5
-rw-r--r--src/lib/krb5/ccache/stdio/scc_gennew.c10
-rw-r--r--src/lib/krb5/ccache/stdio/scc_maybe.c26
-rw-r--r--src/lib/krb5/ccache/stdio/scc_read.c8
-rw-r--r--src/lib/krb5/ccache/stdio/scc_write.c5
6 files changed, 49 insertions, 14 deletions
diff --git a/src/lib/krb5/ccache/stdio/ChangeLog b/src/lib/krb5/ccache/stdio/ChangeLog
index e49515f..9f797ce 100644
--- a/src/lib/krb5/ccache/stdio/ChangeLog
+++ b/src/lib/krb5/ccache/stdio/ChangeLog
@@ -1,4 +1,13 @@
+Tue Sep 05 22:58:52 1995
+
+ * scc.h : Add another KRB5_SCC_FVNO but don't up the default.
+ * scc_gennew.c, scc_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)
+ * scc_read.c, scc_write.c : Remove krb5_enctype references, and
+ replace with krb5_keytype where appropriate
+
Tue Aug 29 13:36:39 EDT 1995 Paul Park (pjpark@mit.edu)
* scc_reslv.c - Set magic number in successfully resolved ccache.
diff --git a/src/lib/krb5/ccache/stdio/scc.h b/src/lib/krb5/ccache/stdio/scc.h
index 6af8be9..6212adc 100644
--- a/src/lib/krb5/ccache/stdio/scc.h
+++ b/src/lib/krb5/ccache/stdio/scc.h
@@ -46,9 +46,10 @@
* some overriding compatibility reasons not to do so.
*/
-#define KRB5_SCC_FVNO_1 0x0501 /* krb v5, scc v1 */
+#define KRB5_SCC_FVNO_1 0x0501 /* krb v5, scc v1 */
#define KRB5_SCC_FVNO_2 0x0502 /* krb v5, scc v2 */
-#define KRB5_SCC_FVNO_3 0x0503 /* krb v5, scc v2 */
+#define KRB5_SCC_FVNO_3 0x0503 /* krb v5, scc v3 */
+#define KRB5_SCC_FVNO_4 0x0504 /* krb v5, scc v4 */
#define KRB5_SCC_DEFAULT_FVNO KRB5_SCC_FVNO_3
diff --git a/src/lib/krb5/ccache/stdio/scc_gennew.c b/src/lib/krb5/ccache/stdio/scc_gennew.c
index 7e4e8db..1baf361 100644
--- a/src/lib/krb5/ccache/stdio/scc_gennew.c
+++ b/src/lib/krb5/ccache/stdio/scc_gennew.c
@@ -106,6 +106,16 @@ krb5_scc_generate_new (context, id)
(void) remove(((krb5_scc_data *) lid->data)->filename);
goto err_out;
}
+ /* For version 4 we save a length for the rest of the header */
+ if (KRB5_SCC_DEFAULT_FVNO == KRB5_SCC_FVNO_4) {
+ unsigned char scc_flen[2] = { 0, 0 };
+ if (!fwrite((char *)scc_flen, sizeof(scc_flen), 1, f)) {
+ retcode = krb5_scc_interpret(context, errno);
+ (void) fclose(f);
+ (void) remove(((krb5_scc_data *) lid->data)->filename);
+ goto err_out;
+ }
+ }
if (fclose(f) == EOF) {
retcode = krb5_scc_interpret(context, errno);
(void) remove(((krb5_scc_data *) lid->data)->filename);
diff --git a/src/lib/krb5/ccache/stdio/scc_maybe.c b/src/lib/krb5/ccache/stdio/scc_maybe.c
index f6e008d..706b10b 100644
--- a/src/lib/krb5/ccache/stdio/scc_maybe.c
+++ b/src/lib/krb5/ccache/stdio/scc_maybe.c
@@ -164,12 +164,30 @@ krb5_scc_open_file (context, id, mode)
data->version = (fvno_bytes[0] << 8) + fvno_bytes[1];
if ((data->version != KRB5_SCC_FVNO_1) &&
(data->version != KRB5_SCC_FVNO_2) &&
- (data->version != KRB5_SCC_FVNO_3)) {
+ (data->version != KRB5_SCC_FVNO_3) &&
+ (data->version != KRB5_SCC_FVNO_4)) {
(void) krb5_unlock_file(context, fileno(f));
(void) fclose(f);
return KRB5_CCACHE_BADVNO;
}
- }
- data->file = f;
- return 0;
+ if (data->version == KRB5_SCC_FVNO_4) {
+ char buf[1024];
+ int len;
+
+ if (!fread((char *)fvno_bytes, sizeof(fvno_bytes), 1, f)) {
+ (void) krb5_unlock_file(context, fileno(f));
+ (void) fclose(f);
+ return KRB5_CCACHE_BADVNO;
+ }
+ if (len = (fvno_bytes[0] << 8) + fvno_bytes[1]) {
+ if (!fread(buf, len, 1, f)) {
+ (void) krb5_unlock_file(context, fileno(f));
+ (void) fclose(f);
+ return KRB5_CCACHE_BADVNO;
+ }
+ }
+ }
+ }
+ data->file = f;
+ return 0;
}
diff --git a/src/lib/krb5/ccache/stdio/scc_read.c b/src/lib/krb5/ccache/stdio/scc_read.c
index 88bf620..633e9e1 100644
--- a/src/lib/krb5/ccache/stdio/scc_read.c
+++ b/src/lib/krb5/ccache/stdio/scc_read.c
@@ -199,12 +199,10 @@ krb5_scc_read_keyblock(context, id, keyblock)
kret = krb5_scc_read_ui_2(context, id, &ui2);
keyblock->keytype = ui2;
CHECK(kret);
- if ((data->version == KRB5_SCC_FVNO_1) ||
- (data->version == KRB5_SCC_FVNO_2))
- keyblock->etype = ETYPE_UNKNOWN;
- else {
+ if (data->version == KRB5_SCC_FVNO_3) {
+ /* This works because the old etype is the same as the new keytype. */
kret = krb5_scc_read_ui_2(context, id, &ui2);
- keyblock->etype = ui2;
+ keyblock->keytype = ui2;
CHECK(kret);
}
diff --git a/src/lib/krb5/ccache/stdio/scc_write.c b/src/lib/krb5/ccache/stdio/scc_write.c
index 9226bb1..4347b5e 100644
--- a/src/lib/krb5/ccache/stdio/scc_write.c
+++ b/src/lib/krb5/ccache/stdio/scc_write.c
@@ -150,9 +150,8 @@ krb5_scc_store_keyblock(context, id, keyblock)
ret = krb5_scc_store_ui_2(context, id, keyblock->keytype);
CHECK(ret);
- if ((data->version != KRB5_SCC_FVNO_1) &&
- (data->version != KRB5_SCC_FVNO_2)) {
- ret = krb5_scc_store_ui_2(context, id, keyblock->etype);
+ if (data->version == KRB5_SCC_FVNO_3) {
+ ret = krb5_scc_store_ui_2(context, id, keyblock->keytype);
CHECK(ret);
}
ret = krb5_scc_store_int32(context, id, keyblock->length);