Changes for testsuite from Ian Taylor <ian@cygnus.com>
authorMark Eichin <eichin@mit.edu>
Fri, 21 Apr 1995 00:21:07 +0000 (00:21 +0000)
committerMark Eichin <eichin@mit.edu>
Fri, 21 Apr 1995 00:21:07 +0000 (00:21 +0000)
* kerberos5.c (telnet_srvtab): New global variable.
(telnet_krb5_realm): New global variable.
(kerberos5_send): If telnet_krb5_realm is set, copy it into
creds.server.  Pass new_creds to krb5_mk_req_extended, not &creds.
Pass &new_creds->keyblock to krb5_copy_keyblock_contents, not
new_creds.
(kerberos5_is): pass telnet_srvtab in to krb_rd_req.
(kerberos5_forward): If telnet_krb5_realm is set, copy it into
local_creds->server.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5414 dc483132-0cff-0310-8789-dd5450dbe970

src/appl/telnet/libtelnet/ChangeLog
src/appl/telnet/libtelnet/kerberos5.c

index 135af39fd5510e319c19f15748e7a0041fdc5b8c..abe3422fad1e00fe6e626a966232038cb735728c 100644 (file)
@@ -1,3 +1,16 @@
+Thu Apr 20 20:12:32 1995  Mark Eichin  <eichin@cygnus.com>
+
+       Changes for testsuite from Ian Taylor <ian@cygnus.com>
+       * kerberos5.c (telnet_srvtab): New global variable.
+       (telnet_krb5_realm): New global variable.
+       (kerberos5_send): If telnet_krb5_realm is set, copy it into
+       creds.server.  Pass new_creds to krb5_mk_req_extended, not &creds.
+       Pass &new_creds->keyblock to krb5_copy_keyblock_contents, not
+       new_creds.
+       (kerberos5_is): pass telnet_srvtab in to krb_rd_req.
+       (kerberos5_forward): If telnet_krb5_realm is set, copy it into
+       local_creds->server.
+
 Wed Mar 29 15:08:43 1995  Theodore Y. Ts'o  (tytso@dcl)
 
        * kerberos5.c: No need to have the session_key established for
index 6b822b427c6fb719147b591b9cc35b128f57b46f..268bdb345e8d047a8f4e2a1b25189ffbfd3fbb65 100644 (file)
@@ -116,6 +116,8 @@ static      krb5_ticket * ticket = NULL;
 #define Voidptr krb5_pointer
 
 krb5_keyblock  session_key;
+char *         telnet_srvtab = NULL;
+char *         telnet_krb5_realm = NULL;
 
        static int
 Data(ap, type, d, c)
@@ -207,6 +209,19 @@ kerberos5_send(ap)
            return(0);
        }
 
+       if (telnet_krb5_realm != NULL) {
+           krb5_data rdata;
+
+           rdata.length = strlen(telnet_krb5_realm);
+           rdata.data = (char *) malloc(rdata.length + 1);
+           if (rdata.data == NULL) {
+               fprintf(stderr, "malloc failed\n");
+               return(0);
+           }
+           strcpy(rdata.data, telnet_krb5_realm);
+           krb5_princ_set_realm(telnet_context, creds.server, &rdata);
+       }
+
        if (r = krb5_cc_get_principal(telnet_context, ccache, &creds.client)) {
                if (auth_debug_mode) {
                        printf("Kerberos V5: failure on principal (%s)\r\n",
@@ -250,7 +265,8 @@ kerberos5_send(ap)
        if (newkey && (newkey->keytype != KEYTYPE_DES)) {
            if (new_creds->keyblock.keytype == KEYTYPE_DES)
                /* use the session key in credentials instead */
-               krb5_copy_keyblock_contents(telnet_context, new_creds, 
+               krb5_copy_keyblock_contents(telnet_context, 
+                                           &new_creds->keyblock,
                                            &session_key);
            else
                /* XXX ? */;
@@ -315,8 +331,16 @@ kerberos5_is(ap, data, cnt)
                                            &server);
                
                if (!r) {
+                   krb5_rcache rcache;
+
+                   r = krb5_get_server_rcache(telnet_context,
+                                       krb5_princ_component(telnet_context,
+                                                            server, 0),
+                                              &rcache);
                    r = krb5_rd_req(telnet_context, &auth_context, &auth,
-                                   server, NULL, NULL, &ticket);
+                                   server, telnet_srvtab, NULL, &ticket);
+                   if (rcache)
+                       krb5_rc_close(telnet_context, rcache);
                    krb5_free_principal(telnet_context, server);
                }
                if (r) {
@@ -606,6 +630,19 @@ kerberos5_forward(ap)
        return;
     }
 
+    if (telnet_krb5_realm != NULL) {
+        krb5_data rdata;
+
+       rdata.length = strlen(telnet_krb5_realm);
+       rdata.data = (char *) malloc(rdata.length + 1);
+       if (rdata.data == NULL) {
+           fprintf(stderr, "malloc failed\n");
+           return;
+       }
+       strcpy(rdata.data, telnet_krb5_realm);
+       krb5_princ_set_realm(telnet_context, local_creds->server, &rdata);
+    }
+
     if (r = krb5_cc_default(telnet_context, &ccache)) {
        if (auth_debug_mode) 
          printf("Kerberos V5: could not get default ccache - %s\r\n",