aboutsummaryrefslogtreecommitdiff
path: root/src/lib/krb425
diff options
context:
space:
mode:
authorTheodore Tso <tytso@mit.edu>1993-12-15 18:09:04 +0000
committerTheodore Tso <tytso@mit.edu>1993-12-15 18:09:04 +0000
commite2857ae5575f42be082beedf012baf6061d722b0 (patch)
tree7994414f8236bb963405dfdae76f09ba1890caf2 /src/lib/krb425
parent6a8836cc5b94e2a96c5f7312533127da044f3aba (diff)
downloadkrb5-e2857ae5575f42be082beedf012baf6061d722b0.zip
krb5-e2857ae5575f42be082beedf012baf6061d722b0.tar.gz
krb5-e2857ae5575f42be082beedf012baf6061d722b0.tar.bz2
Preprend "FILE:" when converting from V4 ticket file name to V5
credentials cache name. Fixed bug in conversion of Kerberos V5 to V4 principals names. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@3179 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/krb425')
-rw-r--r--src/lib/krb425/get_cred.c14
-rw-r--r--src/lib/krb425/rd_req.c28
2 files changed, 32 insertions, 10 deletions
diff --git a/src/lib/krb425/get_cred.c b/src/lib/krb425/get_cred.c
index 1307f10..e0153b2 100644
--- a/src/lib/krb425/get_cred.c
+++ b/src/lib/krb425/get_cred.c
@@ -93,12 +93,16 @@ CREDENTIALS *c;
}
}
#endif
- set_string(c->pname, ANAME_SZ, krb5_princ_component(creds.client, 1));
- set_string(c->pinst, INST_SZ, krb5_princ_component(creds.client, 2));
-
+ set_string(c->pname, ANAME_SZ, krb5_princ_component(creds.client, 0));
+ if (creds.client->length > 1) {
+ set_string(c->pinst, INST_SZ, krb5_princ_component(creds.client, 1));
+ }
+ else {
+ c->pinst[0] = '\0';
+ }
set_string(c->realm, REALM_SZ, krb5_princ_realm(creds.server));
- set_string(c->service, REALM_SZ, krb5_princ_component(creds.server, 1));
- set_string(c->instance, REALM_SZ, krb5_princ_component(creds.server, 2));
+ set_string(c->service, ANAME_SZ, krb5_princ_component(creds.server, 0));
+* set_string(c->instance, INST_SZ, krb5_princ_component(creds.server, 1));
c->ticket_st.length = creds.ticket.length;
memcpy((char *)c->ticket_st.dat,
diff --git a/src/lib/krb425/rd_req.c b/src/lib/krb425/rd_req.c
index 54b3ad9..64b0850 100644
--- a/src/lib/krb425/rd_req.c
+++ b/src/lib/krb425/rd_req.c
@@ -31,6 +31,7 @@ static char rcsid_rd_req_c[] =
#endif /* !lint & !SABER */
#include "krb425.h"
+#include <sys/param.h>
static krb5_error_code
setkey_key_proc(DECLARG(krb5_pointer,arg),
@@ -62,6 +63,8 @@ char *fn;
krb5_data authe;
extern int gethostname();
int use_set_key = 0;
+ char file_name[MAXPATHLEN];
+ int tmp;
if (from_addr) {
peer.addrtype = ADDRTYPE_INET;
@@ -108,8 +111,15 @@ char *fn;
if (!fn) {
use_set_key = 1;
fn = (char *)0;
- } else if (!*fn)
+ } else if (!*fn) {
fn = (char *)0;
+ } else {
+ strcpy(file_name, "FILE:");
+ strncpy(file_name + 5, fn, MAXPATHLEN-5);
+ file_name[sizeof(file_name)-1] = '\0';
+ fn = file_name;
+ }
+
#ifdef EBUG
EPRINT "Calling krb5_rd_req with:\n");
@@ -175,12 +185,20 @@ char *fn;
r = 0;
#endif
set_string(ad->pname, ANAME_SZ,
- krb5_princ_component(authdat->authenticator->client, 1));
- set_string(ad->pinst, INST_SZ,
- krb5_princ_component(authdat->authenticator->client, 2));
- set_string(ad->prealm, REALM_SZ,
krb5_princ_component(authdat->authenticator->client, 0));
+ if (authdat->authenticator->client->length > 1) {
+ set_string(ad->pinst, INST_SZ,
+ krb5_princ_component(authdat->authenticator->client,
+ 1));
+ }
+ else {
+ ad->pinst[0] = '\0';
+ }
+
+ set_string(ad->prealm, REALM_SZ,
+ krb5_princ_realm(authdat->authenticator->client));
+
ad->checksum = *(long *)authdat->authenticator->checksum->contents;
if (authdat->ticket->enc_part2->session->keytype != KEYTYPE_DES) {