From: Mark Eichin Date: Fri, 21 Apr 1995 00:21:07 +0000 (+0000) Subject: Changes for testsuite from Ian Taylor X-Git-Tag: krb5-1.0-beta5~332 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=175ccee7921d761c6872882ec7ad4cf9928bcd36;p=krb5.git Changes for testsuite from Ian Taylor * 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 --- diff --git a/src/appl/telnet/libtelnet/ChangeLog b/src/appl/telnet/libtelnet/ChangeLog index 135af39fd..abe3422fa 100644 --- a/src/appl/telnet/libtelnet/ChangeLog +++ b/src/appl/telnet/libtelnet/ChangeLog @@ -1,3 +1,16 @@ +Thu Apr 20 20:12:32 1995 Mark Eichin + + Changes for testsuite from Ian Taylor + * 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 diff --git a/src/appl/telnet/libtelnet/kerberos5.c b/src/appl/telnet/libtelnet/kerberos5.c index 6b822b427..268bdb345 100644 --- a/src/appl/telnet/libtelnet/kerberos5.c +++ b/src/appl/telnet/libtelnet/kerberos5.c @@ -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",