From e72fe8de196c9f0bc2efa49d3536ee4101ebd6bf Mon Sep 17 00:00:00 2001
From: g0dil <g0dil@wiback.org>
Date: Tue, 3 Mar 2009 13:33:27 +0000
Subject: [PATCH] Utils/Termlib: Convert received terminal type string to
 lowercase (fixes OpenBSD telnet client support)

---
 Utils/Termlib/Telnet.cc         | 2 ++
 Utils/Termlib/TelnetTerminal.cc | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/Utils/Termlib/Telnet.cc b/Utils/Termlib/Telnet.cc
index 5c79e1f73..19b90582a 100644
--- a/Utils/Termlib/Telnet.cc
+++ b/Utils/Termlib/Telnet.cc
@@ -27,6 +27,7 @@
 //#include "Telnet.ih"
 
 // Custom includes
+#include <boost/algorithm/string/case_conv.hpp>
 #include "../membind.hh"
 #include "../Logger/SenfLog.hh"
 
@@ -456,6 +457,7 @@ v_handleOptionParameters(std::string const & data)
         return;
     if (data[0] == '\x00') {
         type_ = data.substr(1);
+        boost::algorithm::to_lower(type_);
         decrementRequestCounter();
     }
 }
diff --git a/Utils/Termlib/TelnetTerminal.cc b/Utils/Termlib/TelnetTerminal.cc
index 2699f9caf..3445d5c24 100644
--- a/Utils/Termlib/TelnetTerminal.cc
+++ b/Utils/Termlib/TelnetTerminal.cc
@@ -82,8 +82,12 @@ prefix_ void senf::term::TelnetTerminal::v_setupComplete()
             log << "TelnetTerminal setup failed:\n";
             if (width() <= 0)
                 log << "    missing telnet client NAWS support\n";
+            else
+                log << "    size=" << width() << "x" << height() << "\n";
             if (terminalType().empty())
                 log << "    missing telnet client TERMINAL_TYPE support\n";
+            else
+                log << "    TERM=" << terminalType() << "\n";
             if (! localOption(telnetopt::SUPPRESS_GO_AHEAD) ||
                 ! peerOption(telnetopt::SUPPRESS_GO_AHEAD))
                 log << "    missing telnet clinet SGO support\n";
-- 
GitLab