Preprend "FILE:" when converting from V4 ticket file name to V5
authorTheodore Tso <tytso@mit.edu>
Wed, 15 Dec 1993 18:09:04 +0000 (18:09 +0000)
committerTheodore Tso <tytso@mit.edu>
Wed, 15 Dec 1993 18:09:04 +0000 (18:09 +0000)
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

src/lib/krb425/get_cred.c
src/lib/krb425/rd_req.c

index 1307f10d457a33e51757de90004b899d6bc6b0ce..e0153b229a6d1705c997637eafc70c1f616f1673 100644 (file)
@@ -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,
index 54b3ad981dd927386302b23e371a04ee05890182..64b0850eb585dee1edb310ee7bc4df8b47c1f510 100644 (file)
@@ -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) {