aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Basch <probe@mit.edu>1996-04-12 01:52:28 +0000
committerRichard Basch <probe@mit.edu>1996-04-12 01:52:28 +0000
commit973c33dfefb55a97375dc9269d2764373b918f24 (patch)
treed304ee6566065e064e0b112ea99ac145969e4687
parenteffb3cff956d9f66b28c1241bde054263206cbce (diff)
downloadkrb5-973c33dfefb55a97375dc9269d2764373b918f24.zip
krb5-973c33dfefb55a97375dc9269d2764373b918f24.tar.gz
krb5-973c33dfefb55a97375dc9269d2764373b918f24.tar.bz2
forward.c: Use a saner naming convention for the credentials cache.
kerberos5.c: Add a cleanup function to destroy the credentials cache. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7799 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r--src/appl/telnet/libtelnet/ChangeLog10
-rw-r--r--src/appl/telnet/libtelnet/forward.c19
-rw-r--r--src/appl/telnet/libtelnet/kerberos5.c24
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;