From 2e3838552652a5dbb8a6ca0d5b25799f8e90dd98 Mon Sep 17 00:00:00 2001 From: John Baldwin 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 --- contrib/telnet/telnetd/state.c | 6 ++++-- contrib/telnet/telnetd/telnetd.c | 12 +++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/contrib/telnet/telnetd/state.c b/contrib/telnet/telnetd/state.c index 9db4516096a0..300421f6dec4 100644 --- a/contrib/telnet/telnetd/state.c +++ b/contrib/telnet/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/contrib/telnet/telnetd/telnetd.c b/contrib/telnet/telnetd/telnetd.c index a790c8969a80..ad1e45953e9e 100644 --- a/contrib/telnet/telnetd/telnetd.c +++ b/contrib/telnet/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