[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
diff's for reading cachefile's of type 1
Here's a little patch to enable reading of ticket cachefiles of version 1
(0x501) DCE 1.2.2 from IBM uses that for some stupid reason.
This is against version 0.1d of heimdal.
diff -ru dist/lib/krb5/fcache.c site/lib/krb5/fcache.c
--- dist/lib/krb5/fcache.c Wed Mar 24 23:26:06 1999
+++ site/lib/krb5/fcache.c Fri Apr 16 11:19:15 1999
@@ -49,6 +49,8 @@
int version;
}krb5_fcache;
+#define KRB5_FCC_FVNO_1 0x501
+#define KRB5_FCC_FVNO_2 0x502
#define KRB5_FCC_FVNO_3 0x503
#define KRB5_FCC_FVNO_4 0x504
@@ -230,7 +232,7 @@
}
static krb5_error_code
-fcc_read_cred (int fd,
+fcc_read_cred (krb5_cc_cursor *cursor,
krb5_creds *creds)
{
int ret = 0;
@@ -238,7 +240,7 @@
int32_t dummy32;
krb5_storage *sp;
- sp = krb5_storage_from_fd(fd);
+ sp = cursor->sp;
ret = krb5_ret_principal (sp, &creds->client);
if(ret) goto cleanup;
@@ -262,7 +264,6 @@
ret = krb5_ret_data (sp, &creds->second_ticket);
cleanup:
- krb5_storage_free(sp);
return ret;
}
@@ -282,6 +283,7 @@
sp = krb5_storage_from_fd(fd);
krb5_ret_int16(sp, &tag);
fcache->version = tag;
+ sp->version = tag;
switch (tag) {
case KRB5_FCC_FVNO_4 : {
int16_t length;
@@ -308,6 +310,8 @@
}
break;
}
+ case KRB5_FCC_FVNO_1 :
+ case KRB5_FCC_FVNO_2 :
case KRB5_FCC_FVNO_3 :
break;
default :
@@ -352,8 +356,8 @@
ret = init_fcc (context, f, &sp, &cursor->u.fd);
if (ret)
return ret;
+ cursor->sp = sp;
krb5_ret_principal (sp, &principal);
- krb5_storage_free(sp);
krb5_free_principal (context, principal);
return 0;
}
@@ -364,7 +368,7 @@
krb5_cc_cursor *cursor,
krb5_creds *creds)
{
- return fcc_read_cred (cursor->u.fd, creds);
+ return fcc_read_cred (cursor, creds);
}
static krb5_error_code
@@ -372,6 +376,7 @@
krb5_ccache id,
krb5_cc_cursor *cursor)
{
+ krb5_storage_free(cursor->sp);
return close (cursor->u.fd);
}
diff -ru dist/lib/krb5/krb5.h site/lib/krb5/krb5.h
--- dist/lib/krb5/krb5.h Thu Apr 1 20:23:14 1999
+++ site/lib/krb5/krb5.h Fri Apr 16 11:49:52 1999
@@ -232,11 +232,21 @@
krb5_data data;
}krb5_ccache_data;
+typedef struct krb5_storage {
+ void *data;
+ size_t (*fetch)(struct krb5_storage*, void*, size_t);
+ size_t (*store)(struct krb5_storage*, void*, size_t);
+ off_t (*seek)(struct krb5_storage*, off_t, int);
+ void (*free)(struct krb5_storage*);
+ krb5_kvno version;
+} krb5_storage;
+
typedef struct krb5_cc_cursor {
union {
int fd;
void *v;
} u;
+ krb5_storage *sp;
}krb5_cc_cursor;
typedef struct krb5_ccache_data *krb5_ccache;
@@ -389,14 +399,6 @@
struct krb5_rcache_data;
typedef struct krb5_rcache_data *krb5_rcache;
typedef Authenticator krb5_donot_reply;
-
-typedef struct krb5_storage {
- void *data;
- size_t (*fetch)(struct krb5_storage*, void*, size_t);
- size_t (*store)(struct krb5_storage*, void*, size_t);
- off_t (*seek)(struct krb5_storage*, off_t, int);
- void (*free)(struct krb5_storage*);
-} krb5_storage;
typedef struct krb5_keytab_entry {
krb5_principal principal;
diff -ru dist/lib/krb5/store.c site/lib/krb5/store.c
--- dist/lib/krb5/store.c Mon Mar 29 21:23:20 1999
+++ site/lib/krb5/store.c Fri Apr 16 11:26:58 1999
@@ -42,6 +42,8 @@
/* This is a bit XXX, but used quite many places */
+#define KRB5_FCC_FVNO_1 0x501
+
size_t
_krb5_put_int(void *buffer, unsigned long value, size_t size)
{
@@ -325,14 +327,22 @@
if(p == NULL)
return ENOMEM;
- if((ret = krb5_ret_int32(sp, &type))){
- free(p);
- return ret;
+ if (sp->version == KRB5_FCC_FVNO_1) {
+ type = KRB5_NT_UNKNOWN;
+ } else {
+ if((ret = krb5_ret_int32(sp, &type))){
+ free(p);
+ return ret;
+ }
}
if((ret = krb5_ret_int32(sp, &ncomp))){
free(p);
return ret;
}
+ if (sp->version == KRB5_FCC_FVNO_1) {
+ ncomp--;
+ }
+
p->name.name_type = type;
p->name.name_string.len = ncomp;
ret = krb5_ret_string(sp, &p->realm);
Ake Sandgren, Dep. of Comp. Sci. & HPC2N, Umea University, S-90187 Umea, Sweden
Internet: ake@{cs,hpc2n}.umu.se Phone: +46 90 7866134 Fax: +46 90 7866126
WWW: http://www.cs.umu.se/~ake