Path: blob/main/crypto/heimdal/appl/telnet/libtelnet/kerberos5.c
34889 views
/*-1* Copyright (c) 1991, 19932* The Regents of the University of California. All rights reserved.3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7* 1. Redistributions of source code must retain the above copyright8* notice, this list of conditions and the following disclaimer.9* 2. Redistributions in binary form must reproduce the above copyright10* notice, this list of conditions and the following disclaimer in the11* documentation and/or other materials provided with the distribution.12* 3. All advertising materials mentioning features or use of this software13* must display the following acknowledgement:14* This product includes software developed by the University of15* California, Berkeley and its contributors.16* 4. Neither the name of the University nor the names of its contributors17* may be used to endorse or promote products derived from this software18* without specific prior written permission.19*20* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND21* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE22* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE23* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE24* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL25* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS26* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)27* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT28* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY29* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF30* SUCH DAMAGE.31*/3233/*34* Copyright (C) 1990 by the Massachusetts Institute of Technology35*36* Export of this software from the United States of America may37* require a specific license from the United States Government.38* It is the responsibility of any person or organization contemplating39* export to obtain such a license before exporting.40*41* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and42* distribute this software and its documentation for any purpose and43* without fee is hereby granted, provided that the above copyright44* notice appear in all copies and that both that copyright notice and45* this permission notice appear in supporting documentation, and that46* the name of M.I.T. not be used in advertising or publicity pertaining47* to distribution of the software without specific, written prior48* permission. M.I.T. makes no representations about the suitability of49* this software for any purpose. It is provided "as is" without express50* or implied warranty.51*/5253#include <config.h>5455RCSID("$Id$");5657#ifdef KRB55859#include <arpa/telnet.h>60#include <stdio.h>61#include <stdlib.h>62#include <string.h>63#include <unistd.h>64#include <netdb.h>65#include <ctype.h>66#include <pwd.h>67#define Authenticator k5_Authenticator68#include <krb5.h>69#undef Authenticator70#include <roken.h>71#ifdef SOCKS72#include <socks.h>73#endif747576#include "encrypt.h"77#include "auth.h"78#include "misc.h"7980#if defined(DCE)81int dfsk5ok = 0;82int dfspag = 0;83int dfsfwd = 0;84#endif8586int forward_flags = 0; /* Flags get set in telnet/main.c on -f and -F */8788int forward(int);89int forwardable(int);9091/* These values need to be the same as those defined in telnet/main.c. */92/* Either define them in both places, or put in some common header file. */93#define OPTS_FORWARD_CREDS 0x0000000294#define OPTS_FORWARDABLE_CREDS 0x00000001959697void kerberos5_forward (Authenticator *);9899static unsigned char str_data[4] = { IAC, SB, TELOPT_AUTHENTICATION, 0 };100101#define KRB_AUTH 0 /* Authentication data follows */102#define KRB_REJECT 1 /* Rejected (reason might follow) */103#define KRB_ACCEPT 2 /* Accepted */104#define KRB_RESPONSE 3 /* Response for mutual auth. */105106#define KRB_FORWARD 4 /* Forwarded credentials follow */107#define KRB_FORWARD_ACCEPT 5 /* Forwarded credentials accepted */108#define KRB_FORWARD_REJECT 6 /* Forwarded credentials rejected */109110static krb5_data auth;111static krb5_ticket *ticket;112113static krb5_context context;114static krb5_auth_context auth_context;115116static int117Data(Authenticator *ap, int type, const void *d, int c)118{119const unsigned char *cp, *cd = d;120unsigned char *p0, *p;121size_t len = sizeof(str_data) + 3 + 2;122int ret;123124if (c == -1)125c = strlen((const char*)cd);126127for (cp = cd; cp - cd < c; cp++, len++)128if (*cp == IAC)129len++;130131p0 = malloc(len);132if (p0 == NULL)133return 0;134135memcpy(p0, str_data, sizeof(str_data));136p = p0 + sizeof(str_data);137138if (auth_debug_mode) {139printf("%s:%d: [%d] (%d)",140str_data[3] == TELQUAL_IS ? ">>>IS" : ">>>REPLY",141str_data[3],142type, c);143printd(d, c);144printf("\r\n");145}146*p++ = ap->type;147*p++ = ap->way;148*p++ = type;149while (c-- > 0) {150if ((*p++ = *cd++) == IAC)151*p++ = IAC;152}153*p++ = IAC;154*p++ = SE;155if (str_data[3] == TELQUAL_IS)156printsub('>', &p0[2], len - 2);157ret = telnet_net_write(p0, len);158free(p0);159return ret;160}161162int163kerberos5_init(Authenticator *ap, int server)164{165krb5_error_code ret;166167ret = krb5_init_context(&context);168if (ret)169return 0;170if (server) {171krb5_keytab kt;172krb5_kt_cursor cursor;173174ret = krb5_kt_default(context, &kt);175if (ret)176return 0;177178ret = krb5_kt_start_seq_get (context, kt, &cursor);179if (ret) {180krb5_kt_close (context, kt);181return 0;182}183krb5_kt_end_seq_get (context, kt, &cursor);184krb5_kt_close (context, kt);185186str_data[3] = TELQUAL_REPLY;187} else188str_data[3] = TELQUAL_IS;189return(1);190}191192extern int net;193static int194kerberos5_send(char *name, Authenticator *ap)195{196krb5_error_code ret;197krb5_ccache ccache;198int ap_opts;199krb5_data cksum_data;200char ap_msg[2];201202if (!UserNameRequested) {203if (auth_debug_mode) {204printf("Kerberos V5: no user name supplied\r\n");205}206return(0);207}208209ret = krb5_cc_default(context, &ccache);210if (ret) {211if (auth_debug_mode) {212printf("Kerberos V5: could not get default ccache: %s\r\n",213krb5_get_err_text (context, ret));214}215return 0;216}217218if ((ap->way & AUTH_HOW_MASK) == AUTH_HOW_MUTUAL)219ap_opts = AP_OPTS_MUTUAL_REQUIRED;220else221ap_opts = 0;222223ap_opts |= AP_OPTS_USE_SUBKEY;224225ret = krb5_auth_con_init (context, &auth_context);226if (ret) {227if (auth_debug_mode) {228printf("Kerberos V5: krb5_auth_con_init failed (%s)\r\n",229krb5_get_err_text(context, ret));230}231return(0);232}233234ret = krb5_auth_con_setaddrs_from_fd (context,235auth_context,236&net);237if (ret) {238if (auth_debug_mode) {239printf ("Kerberos V5:"240" krb5_auth_con_setaddrs_from_fd failed (%s)\r\n",241krb5_get_err_text(context, ret));242}243return(0);244}245246krb5_auth_con_setkeytype (context, auth_context, KRB5_ENCTYPE_DES_CBC_CRC);247248ap_msg[0] = ap->type;249ap_msg[1] = ap->way;250251cksum_data.length = sizeof(ap_msg);252cksum_data.data = ap_msg;253254255{256krb5_principal service;257char sname[128];258259260ret = krb5_sname_to_principal (context,261RemoteHostName,262NULL,263KRB5_NT_SRV_HST,264&service);265if(ret) {266if (auth_debug_mode) {267printf ("Kerberos V5:"268" krb5_sname_to_principal(%s) failed (%s)\r\n",269RemoteHostName, krb5_get_err_text(context, ret));270}271return 0;272}273ret = krb5_unparse_name_fixed(context, service, sname, sizeof(sname));274if(ret) {275if (auth_debug_mode) {276printf ("Kerberos V5:"277" krb5_unparse_name_fixed failed (%s)\r\n",278krb5_get_err_text(context, ret));279}280return 0;281}282printf("[ Trying %s (%s)... ]\r\n", name, sname);283ret = krb5_mk_req_exact(context, &auth_context, ap_opts,284service,285&cksum_data, ccache, &auth);286krb5_free_principal (context, service);287288}289if (ret) {290if (1 || auth_debug_mode) {291printf("Kerberos V5: mk_req failed (%s)\r\n",292krb5_get_err_text(context, ret));293}294return(0);295}296297if (!auth_sendname((unsigned char *)UserNameRequested,298strlen(UserNameRequested))) {299if (auth_debug_mode)300printf("Not enough room for user name\r\n");301return(0);302}303if (!Data(ap, KRB_AUTH, auth.data, auth.length)) {304if (auth_debug_mode)305printf("Not enough room for authentication data\r\n");306return(0);307}308if (auth_debug_mode) {309printf("Sent Kerberos V5 credentials to server\r\n");310}311return(1);312}313314int315kerberos5_send_mutual(Authenticator *ap)316{317return kerberos5_send("mutual KERBEROS5", ap);318}319320int321kerberos5_send_oneway(Authenticator *ap)322{323return kerberos5_send("KERBEROS5", ap);324}325326static void log_message(const char *fmt, ...)327{328va_list ap;329va_start(ap, fmt);330if (auth_debug_mode) {331va_start(ap, fmt);332vfprintf(stdout, fmt, ap);333va_end(ap);334fprintf(stdout, "\r\n");335}336va_start(ap, fmt);337vsyslog(LOG_NOTICE, fmt, ap);338va_end(ap);339}340341void342kerberos5_is(Authenticator *ap, unsigned char *data, int cnt)343{344krb5_error_code ret;345krb5_data outbuf;346krb5_keyblock *key_block;347char *name;348krb5_principal server;349int zero = 0;350351if (cnt-- < 1)352return;353switch (*data++) {354case KRB_AUTH:355auth.data = (char *)data;356auth.length = cnt;357358auth_context = NULL;359360ret = krb5_auth_con_init (context, &auth_context);361if (ret) {362Data(ap, KRB_REJECT, "krb5_auth_con_init failed", -1);363auth_finished(ap, AUTH_REJECT);364log_message("Kerberos V5: krb5_auth_con_init failed (%s)",365krb5_get_err_text(context, ret));366return;367}368369ret = krb5_auth_con_setaddrs_from_fd (context,370auth_context,371&zero);372if (ret) {373Data(ap, KRB_REJECT, "krb5_auth_con_setaddrs_from_fd failed", -1);374auth_finished(ap, AUTH_REJECT);375log_message("Kerberos V5: "376"krb5_auth_con_setaddrs_from_fd failed (%s)",377krb5_get_err_text(context, ret));378return;379}380381ret = krb5_sock_to_principal (context,3820,383"host",384KRB5_NT_SRV_HST,385&server);386if (ret) {387Data(ap, KRB_REJECT, "krb5_sock_to_principal failed", -1);388auth_finished(ap, AUTH_REJECT);389log_message("Kerberos V5: "390"krb5_sock_to_principal failed (%s)",391krb5_get_err_text(context, ret));392return;393}394395ret = krb5_rd_req(context,396&auth_context,397&auth,398server,399NULL,400NULL,401&ticket);402403krb5_free_principal (context, server);404if (ret) {405const char *errbuf2 = "Read req failed";406char *errbuf;407int ret2;408409ret2 = asprintf(&errbuf,410"Read req failed: %s",411krb5_get_err_text(context, ret));412if (ret2 != -1)413errbuf2 = errbuf;414Data(ap, KRB_REJECT, errbuf2, -1);415log_message("%s", errbuf2);416if (ret2 != -1)417free (errbuf);418return;419}420421{422char ap_msg[2];423424ap_msg[0] = ap->type;425ap_msg[1] = ap->way;426427ret = krb5_verify_authenticator_checksum(context,428auth_context,429ap_msg,430sizeof(ap_msg));431432if (ret) {433const char *errbuf2 = "Bad checksum";434char *errbuf;435int ret2;436437ret2 = asprintf(&errbuf, "Bad checksum: %s",438krb5_get_err_text(context, ret));439if (ret2 != -1)440errbuf2 = errbuf;441Data(ap, KRB_REJECT, errbuf2, -1);442log_message("%s", errbuf2);443if (ret2 != -1)444free(errbuf);445return;446}447}448ret = krb5_auth_con_getremotesubkey (context,449auth_context,450&key_block);451452if (ret) {453Data(ap, KRB_REJECT, "krb5_auth_con_getremotesubkey failed", -1);454auth_finished(ap, AUTH_REJECT);455log_message("Kerberos V5: "456"krb5_auth_con_getremotesubkey failed (%s)",457krb5_get_err_text(context, ret));458return;459}460461if (key_block == NULL) {462ret = krb5_auth_con_getkey(context,463auth_context,464&key_block);465}466if (ret) {467Data(ap, KRB_REJECT, "krb5_auth_con_getkey failed", -1);468auth_finished(ap, AUTH_REJECT);469log_message("Kerberos V5: "470"krb5_auth_con_getkey failed (%s)",471krb5_get_err_text(context, ret));472return;473}474if (key_block == NULL) {475Data(ap, KRB_REJECT, "no subkey received", -1);476auth_finished(ap, AUTH_REJECT);477log_message("Kerberos V5: "478"krb5_auth_con_getremotesubkey returned NULL key");479return;480}481482if ((ap->way & AUTH_HOW_MASK) == AUTH_HOW_MUTUAL) {483ret = krb5_mk_rep(context, auth_context, &outbuf);484if (ret) {485Data(ap, KRB_REJECT,486"krb5_mk_rep failed", -1);487auth_finished(ap, AUTH_REJECT);488log_message("Kerberos V5: "489"krb5_mk_rep failed (%s)",490krb5_get_err_text(context, ret));491krb5_free_keyblock(context, key_block);492return;493}494Data(ap, KRB_RESPONSE, outbuf.data, outbuf.length);495}496if (krb5_unparse_name(context, ticket->client, &name))497name = 0;498499if(UserNameRequested && krb5_kuserok(context,500ticket->client,501UserNameRequested)) {502Data(ap, KRB_ACCEPT, name, name ? -1 : 0);503log_message("%s accepted as user %s from %s",504name ? name : "<unknown>",505UserNameRequested ? UserNameRequested : "<unknown>",506RemoteHostName ? RemoteHostName : "<unknown>");507508if(key_block->keytype == ETYPE_DES_CBC_MD5 ||509key_block->keytype == ETYPE_DES_CBC_MD4 ||510key_block->keytype == ETYPE_DES_CBC_CRC) {511Session_Key skey;512513skey.type = SK_DES;514skey.length = 8;515skey.data = key_block->keyvalue.data;516encrypt_session_key(&skey, 0);517}518519} else {520const char *msg2 = "user is not authorized to login";521char *msg;522523ret = asprintf (&msg, "user `%s' is not authorized to "524"login as `%s'",525name ? name : "<unknown>",526UserNameRequested ? UserNameRequested : "<nobody>");527if (ret != -1)528msg2 = msg;529Data(ap, KRB_REJECT, (void *)msg2, -1);530if (ret != -1)531free(msg);532auth_finished (ap, AUTH_REJECT);533krb5_free_keyblock(context, key_block);534break;535}536auth_finished(ap, AUTH_USER);537krb5_free_keyblock(context, key_block);538539break;540case KRB_FORWARD: {541struct passwd *pwd;542char ccname[1024]; /* XXX */543krb5_data inbuf;544krb5_ccache ccache;545inbuf.data = (char *)data;546inbuf.length = cnt;547548pwd = getpwnam (UserNameRequested);549if (pwd == NULL)550break;551552snprintf (ccname, sizeof(ccname),553"FILE:/tmp/krb5cc_%lu", (unsigned long)pwd->pw_uid);554555ret = krb5_cc_resolve (context, ccname, &ccache);556if (ret) {557log_message("Kerberos V5: could not get ccache: %s",558krb5_get_err_text(context, ret));559break;560}561562ret = krb5_cc_initialize (context,563ccache,564ticket->client);565if (ret) {566log_message("Kerberos V5: could not init ccache: %s",567krb5_get_err_text(context, ret));568break;569}570571#if defined(DCE)572esetenv("KRB5CCNAME", ccname, 1);573#endif574ret = krb5_rd_cred2 (context,575auth_context,576ccache,577&inbuf);578if(ret) {579const char *errbuf2 = "Read forwarded creds failed";580char *errbuf;581int ret2;582583ret2 = asprintf (&errbuf,584"Read forwarded creds failed: %s",585krb5_get_err_text (context, ret));586if (ret2 != -1)587errbuf2 = errbuf;588Data(ap, KRB_FORWARD_REJECT, errbuf, -1);589log_message("Could not read forwarded credentials: %s", errbuf);590591if (ret2 != -1)592free (errbuf);593} else {594Data(ap, KRB_FORWARD_ACCEPT, 0, 0);595#if defined(DCE)596dfsfwd = 1;597#endif598}599chown (ccname + 5, pwd->pw_uid, -1);600log_message("Forwarded credentials obtained");601break;602}603default:604log_message("Unknown Kerberos option %d", data[-1]);605Data(ap, KRB_REJECT, 0, 0);606break;607}608}609610void611kerberos5_reply(Authenticator *ap, unsigned char *data, int cnt)612{613static int mutual_complete = 0;614615if (cnt-- < 1)616return;617switch (*data++) {618case KRB_REJECT:619if (cnt > 0) {620printf("[ Kerberos V5 refuses authentication because %.*s ]\r\n",621cnt, data);622} else623printf("[ Kerberos V5 refuses authentication ]\r\n");624auth_send_retry();625return;626case KRB_ACCEPT: {627krb5_error_code ret;628Session_Key skey;629krb5_keyblock *keyblock;630631if ((ap->way & AUTH_HOW_MASK) == AUTH_HOW_MUTUAL &&632!mutual_complete) {633printf("[ Kerberos V5 accepted you, but didn't provide mutual authentication! ]\r\n");634auth_send_retry();635return;636}637if (cnt)638printf("[ Kerberos V5 accepts you as ``%.*s'' ]\r\n", cnt, data);639else640printf("[ Kerberos V5 accepts you ]\r\n");641642ret = krb5_auth_con_getlocalsubkey (context,643auth_context,644&keyblock);645if (ret)646ret = krb5_auth_con_getkey (context,647auth_context,648&keyblock);649if(ret) {650printf("[ krb5_auth_con_getkey: %s ]\r\n",651krb5_get_err_text(context, ret));652auth_send_retry();653return;654}655656skey.type = SK_DES;657skey.length = 8;658skey.data = keyblock->keyvalue.data;659encrypt_session_key(&skey, 0);660krb5_free_keyblock (context, keyblock);661auth_finished(ap, AUTH_USER);662if (forward_flags & OPTS_FORWARD_CREDS)663kerberos5_forward(ap);664break;665}666case KRB_RESPONSE:667if ((ap->way & AUTH_HOW_MASK) == AUTH_HOW_MUTUAL) {668/* the rest of the reply should contain a krb_ap_rep */669krb5_ap_rep_enc_part *reply;670krb5_data inbuf;671krb5_error_code ret;672673inbuf.length = cnt;674inbuf.data = (char *)data;675676ret = krb5_rd_rep(context, auth_context, &inbuf, &reply);677if (ret) {678printf("[ Mutual authentication failed: %s ]\r\n",679krb5_get_err_text (context, ret));680auth_send_retry();681return;682}683krb5_free_ap_rep_enc_part(context, reply);684mutual_complete = 1;685}686return;687case KRB_FORWARD_ACCEPT:688printf("[ Kerberos V5 accepted forwarded credentials ]\r\n");689return;690case KRB_FORWARD_REJECT:691printf("[ Kerberos V5 refuses forwarded credentials because %.*s ]\r\n",692cnt, data);693return;694default:695if (auth_debug_mode)696printf("Unknown Kerberos option %d\r\n", data[-1]);697return;698}699}700701int702kerberos5_status(Authenticator *ap, char *name, size_t name_sz, int level)703{704if (level < AUTH_USER)705return(level);706707if (UserNameRequested &&708krb5_kuserok(context,709ticket->client,710UserNameRequested))711{712strlcpy(name, UserNameRequested, name_sz);713#if defined(DCE)714dfsk5ok = 1;715#endif716return(AUTH_VALID);717} else718return(AUTH_USER);719}720721#define BUMP(buf, len) while (*(buf)) {++(buf), --(len);}722#define ADDC(buf, len, c) if ((len) > 0) {*(buf)++ = (c); --(len);}723724void725kerberos5_printsub(unsigned char *data, size_t cnt,726unsigned char *buf, size_t buflen)727{728int i;729730buf[buflen-1] = '\0'; /* make sure it's NULL terminated */731buflen -= 1;732733switch(data[3]) {734case KRB_REJECT: /* Rejected (reason might follow) */735strlcpy((char *)buf, " REJECT ", buflen);736goto common;737738case KRB_ACCEPT: /* Accepted (name might follow) */739strlcpy((char *)buf, " ACCEPT ", buflen);740common:741BUMP(buf, buflen);742if (cnt <= 4)743break;744ADDC(buf, buflen, '"');745for (i = 4; i < cnt; i++)746ADDC(buf, buflen, data[i]);747ADDC(buf, buflen, '"');748ADDC(buf, buflen, '\0');749break;750751752case KRB_AUTH: /* Authentication data follows */753strlcpy((char *)buf, " AUTH", buflen);754goto common2;755756case KRB_RESPONSE:757strlcpy((char *)buf, " RESPONSE", buflen);758goto common2;759760case KRB_FORWARD: /* Forwarded credentials follow */761strlcpy((char *)buf, " FORWARD", buflen);762goto common2;763764case KRB_FORWARD_ACCEPT: /* Forwarded credentials accepted */765strlcpy((char *)buf, " FORWARD_ACCEPT", buflen);766goto common2;767768case KRB_FORWARD_REJECT: /* Forwarded credentials rejected */769/* (reason might follow) */770strlcpy((char *)buf, " FORWARD_REJECT", buflen);771goto common2;772773default:774snprintf((char*)buf, buflen, " %d (unknown)", data[3]);775common2:776BUMP(buf, buflen);777for (i = 4; i < cnt; i++) {778snprintf((char*)buf, buflen, " %d", data[i]);779BUMP(buf, buflen);780}781break;782}783}784785void786kerberos5_forward(Authenticator *ap)787{788krb5_error_code ret;789krb5_ccache ccache;790krb5_creds creds;791KDCOptions flags;792krb5_data out_data;793krb5_principal principal;794795ret = krb5_cc_default (context, &ccache);796if (ret) {797if (auth_debug_mode)798printf ("KerberosV5: could not get default ccache: %s\r\n",799krb5_get_err_text (context, ret));800return;801}802803ret = krb5_cc_get_principal (context, ccache, &principal);804if (ret) {805if (auth_debug_mode)806printf ("KerberosV5: could not get principal: %s\r\n",807krb5_get_err_text (context, ret));808return;809}810811memset (&creds, 0, sizeof(creds));812813creds.client = principal;814815ret = krb5_make_principal(context,816&creds.server,817principal->realm,818"krbtgt",819principal->realm,820NULL);821822if (ret) {823if (auth_debug_mode)824printf ("KerberosV5: could not get principal: %s\r\n",825krb5_get_err_text (context, ret));826return;827}828829creds.times.endtime = 0;830831memset(&flags, 0, sizeof(flags));832flags.forwarded = 1;833if (forward_flags & OPTS_FORWARDABLE_CREDS)834flags.forwardable = 1;835836ret = krb5_get_forwarded_creds (context,837auth_context,838ccache,839KDCOptions2int(flags),840RemoteHostName,841&creds,842&out_data);843if (ret) {844if (auth_debug_mode)845printf ("Kerberos V5: error getting forwarded creds: %s\r\n",846krb5_get_err_text (context, ret));847return;848}849850if(!Data(ap, KRB_FORWARD, out_data.data, out_data.length)) {851if (auth_debug_mode)852printf("Not enough room for authentication data\r\n");853} else {854if (auth_debug_mode)855printf("Forwarded local Kerberos V5 credentials to server\r\n");856}857}858859#if defined(DCE)860/* if this was a K5 authentication try and join a PAG for the user. */861void862kerberos5_dfspag(void)863{864if (dfsk5ok) {865dfspag = krb5_dfs_pag(context, dfsfwd, ticket->client,866UserNameRequested);867}868}869#endif870871int872kerberos5_set_forward(int on)873{874if(on == 0)875forward_flags &= ~OPTS_FORWARD_CREDS;876if(on == 1)877forward_flags |= OPTS_FORWARD_CREDS;878if(on == -1)879forward_flags ^= OPTS_FORWARD_CREDS;880return 0;881}882883int884kerberos5_set_forwardable(int on)885{886if(on == 0)887forward_flags &= ~OPTS_FORWARDABLE_CREDS;888if(on == 1)889forward_flags |= OPTS_FORWARDABLE_CREDS;890if(on == -1)891forward_flags ^= OPTS_FORWARDABLE_CREDS;892return 0;893}894895#endif /* KRB5 */896897898