diff options
-rw-r--r-- | src/appl/telnet/libtelnet/ChangeLog | 10 | ||||
-rw-r--r-- | src/appl/telnet/libtelnet/forward.c | 19 | ||||
-rw-r--r-- | src/appl/telnet/libtelnet/kerberos5.c | 24 |
3 files changed, 45 insertions, 8 deletions
diff --git a/src/appl/telnet/libtelnet/ChangeLog b/src/appl/telnet/libtelnet/ChangeLog index 391cd71..8cb5616 100644 --- a/src/appl/telnet/libtelnet/ChangeLog +++ b/src/appl/telnet/libtelnet/ChangeLog @@ -1,3 +1,13 @@ +Thu Apr 11 21:45:21 1996 Richard Basch <basch@lehman.com> + + * forward.c (rd_and_store_for_creds): If we are going to use a + ttyname based credentials file, at least compute it in a saner + fashion (strip the /dev/ and translate remaining /'s into _, so + the cache name looks like krb5cc_pts_4 instead of krb5cc_4). + + * kerberos5.c (kerberos5_cleanup): Cleanup the credentials cache + that we may have created and destroy the context. + Mon Mar 18 20:56:37 1996 Theodore Y. Ts'o <tytso@dcl> * kerberos5.c (kerberos5_send): Send in as input the diff --git a/src/appl/telnet/libtelnet/forward.c b/src/appl/telnet/libtelnet/forward.c index 1647b60..025a134 100644 --- a/src/appl/telnet/libtelnet/forward.c +++ b/src/appl/telnet/libtelnet/forward.c @@ -46,6 +46,7 @@ rd_and_store_for_creds(context, auth_context, inbuf, ticket, lusername) char ccname[35]; krb5_ccache ccache = NULL; struct passwd *pwd; + char *tty; if (!(pwd = (struct passwd *) getpwnam(lusername))) return -1; @@ -53,13 +54,17 @@ rd_and_store_for_creds(context, auth_context, inbuf, ticket, lusername) if (retval = krb5_rd_cred(context, auth_context, inbuf, &creds, NULL)) return(retval); - if (*line) { - /* code from appl/bsd/login.c since it will do the same */ - sprintf(ccname, "FILE:/tmp/krb5cc_%s", strrchr(line, '/')+1); - } else { - /* since default will be based on uid and we haven't changed yet */ - sprintf(ccname, "FILE:/tmp/krb5cc_%d", pwd->pw_uid); - } + if (*line && (tty = strchr(line, '/')) && (tty = strchr(tty+1, '/'))) { + ++tty; + sprintf(ccname, "FILE:/tmp/krb5cc_%s", tty); + while (tty = strchr(tty, '/')) { + tty++; + *((char *)strrchr(ccname, '/')) = '_'; + } + } else + /* since default will be based on uid and we haven't changed yet */ + sprintf(ccname, "FILE:/tmp/krb5cc_%d", pwd->pw_uid); + setenv(KRB5_ENV_CCNAME, ccname, 1); if (retval = krb5_cc_resolve(context, ccname, &ccache)) diff --git a/src/appl/telnet/libtelnet/kerberos5.c b/src/appl/telnet/libtelnet/kerberos5.c index 6f947e3..63f54cd 100644 --- a/src/appl/telnet/libtelnet/kerberos5.c +++ b/src/appl/telnet/libtelnet/kerberos5.c @@ -61,7 +61,7 @@ #ifdef KRB5 #include <arpa/telnet.h> #include <stdio.h> -#include "krb5.h" +#include "k5-int.h" #include "com_err.h" #include <netdb.h> #include <ctype.h> @@ -179,6 +179,28 @@ kerberos5_init(ap, server) return(1); } +void +kerberos5_cleanup() +{ + krb5_error_code retval; + krb5_ccache ccache; + char *ccname; + + if (telnet_context == 0) + return; + + ccname = getenv(KRB5_ENV_CCNAME); + if (ccname) { + retval = krb5_cc_resolve(telnet_context, ccname, &ccache); + if (!retval) + retval = krb5_cc_destroy(telnet_context, ccache); + } + + krb5_free_context(telnet_context); + telnet_context = 0; +} + + int kerberos5_send(ap) Authenticator *ap; |