+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
char ccname[35];
krb5_ccache ccache = NULL;
struct passwd *pwd;
+ char *tty;
if (!(pwd = (struct passwd *) getpwnam(lusername)))
return -1;
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))
#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>
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;