5c099b14c1
pull in just about all of the differences from the crypto-us telnet suite (which includes Kerberos 4 and connection encryption support). Also bring in the Kerberos 5 support from the Heimdal telnet, and frob a little so that it can work with the non-Heimdal telnet suite. There is still some work left to do, specifically: - Add Heimdal's ticket forwarding support to the Berkeley Kerberos 4 module. - Add connection encryption support to the Heimdal Kerberos 5 module. Hints on this can be taken from the MIT Kerberos 5 module which still exists in crypto-us. However, even with the shortcomings listed above, this is a better situation than using the stock Heimdal telnet suite, which does not understand the IPSec policy stuff, and is also based on much older code which contains bugs that we have already fixed in the NetBSD sources.
72 lines
2.2 KiB
C
72 lines
2.2 KiB
C
/*
|
|
* appl/telnet/libtelnet/forward.c
|
|
*/
|
|
|
|
/*
|
|
* Copyright (c) 1983 Regents of the University of California.
|
|
* All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms are permitted
|
|
* provided that the above copyright notice and this paragraph are
|
|
* duplicated in all such forms and that any documentation,
|
|
* advertising materials, and other materials related to such
|
|
* distribution and use acknowledge that the software was developed
|
|
* by the University of California, Berkeley. The name of the
|
|
* University may not be used to endorse or promote products derived
|
|
* from this software without specific prior written permission.
|
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
*/
|
|
|
|
|
|
/* General-purpose forwarding routines. These routines may be put into */
|
|
/* libkrb5.a to allow widespread use */
|
|
|
|
#if defined(KERBEROS) || defined(KRB5)
|
|
#include <stdio.h>
|
|
#include <netdb.h>
|
|
|
|
#include "k5-int.h"
|
|
|
|
extern char *line; /* see sys_term.c */
|
|
|
|
#ifdef __P
|
|
krb5_error_code rd_and_store_for_creds __P((krb5_context, krb5_auth_context, krb5_data *, krb5_ticket *));
|
|
#endif
|
|
|
|
/* Decode, decrypt and store the forwarded creds in the local ccache. */
|
|
krb5_error_code
|
|
rd_and_store_for_creds(context, auth_context, inbuf, ticket)
|
|
krb5_context context;
|
|
krb5_auth_context auth_context;
|
|
krb5_data *inbuf;
|
|
krb5_ticket *ticket;
|
|
{
|
|
krb5_creds **creds;
|
|
krb5_error_code retval;
|
|
char ccname[35];
|
|
krb5_ccache ccache = NULL;
|
|
|
|
if ((retval = krb5_rd_cred(context, auth_context, inbuf, &creds, NULL)) != 0)
|
|
return(retval);
|
|
|
|
sprintf(ccname, "FILE:/tmp/krb5cc_p%d", getpid());
|
|
setenv(KRB5_ENV_CCNAME, ccname, 1);
|
|
|
|
if ((retval = krb5_cc_resolve(context, ccname, &ccache)) != 0)
|
|
goto cleanup;
|
|
|
|
if ((retval = krb5_cc_initialize(context, ccache, ticket->enc_part2->client)) != 0)
|
|
goto cleanup;
|
|
|
|
if ((retval = krb5_cc_store_cred(context, ccache, *creds)) != 0)
|
|
goto cleanup;
|
|
|
|
cleanup:
|
|
krb5_free_creds(context, *creds);
|
|
return retval;
|
|
}
|
|
|
|
#endif /* defined(KRB5) && defined(FORWARD) */
|