From d76e719277abcc3587e08b2568b078f1c58d23ed Mon Sep 17 00:00:00 2001 From: jhb Date: Mon, 28 Jul 2008 18:58:16 +0000 Subject: [PATCH] Don't attempt authentication at all if it has been disabled via '-a off'. This works around a bug in HP-UX's telnet client and also gives a much saner user experience when using FreeBSD's telnet client. PR: bin/19405 Submitted by: Joel Ray Holveck joelh of gnu.org MFC after: 1 month git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@180931 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- telnetd/state.c | 6 ++++-- telnetd/telnetd.c | 12 +++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/telnetd/state.c b/telnetd/state.c index 9db4516..300421f 100644 --- a/telnetd/state.c +++ b/telnetd/state.c @@ -553,8 +553,10 @@ willoption(int option) #ifdef AUTHENTICATION case TELOPT_AUTHENTICATION: - func = auth_request; - changeok++; + if (auth_level >= 0) { + func = auth_request; + changeok++; + } break; #endif diff --git a/telnetd/telnetd.c b/telnetd/telnetd.c index a790c89..ad1e459 100644 --- a/telnetd/telnetd.c +++ b/telnetd/telnetd.c @@ -481,11 +481,13 @@ getterminaltype(char *name undef2) /* * Handle the Authentication option before we do anything else. */ - send_do(TELOPT_AUTHENTICATION, 1); - while (his_will_wont_is_changing(TELOPT_AUTHENTICATION)) - ttloop(); - if (his_state_is_will(TELOPT_AUTHENTICATION)) { - retval = auth_wait(name); + if (auth_level >= 0) { + send_do(TELOPT_AUTHENTICATION, 1); + while (his_will_wont_is_changing(TELOPT_AUTHENTICATION)) + ttloop(); + if (his_state_is_will(TELOPT_AUTHENTICATION)) { + retval = auth_wait(name); + } } #endif