介绍

Linux 下流行的 telnet 实现有两个:

  1. GNU inetutils: http://ftp.gnu.org/gnu/inetutils/

  2. 哈佛netkit-telnet

编译

编译环境

Ubuntu 20.04.4 LTS

编译telnet-0.17

下载并解压安装包netkit-telnet_0.17.orig.tar.gz

编译源码

netkit-telnet-0.17# ./configure
netkit-telnet-0.17# make

遇到的问题

官方的代码编译还是会遇到一些代码本身的问题,需要做些修改。

undefined reference

commands.cc:(.text+0x25c4): undefined reference to `operator new(unsigned long)'
/usr/bin/ld: commands.cc:(.text+0x2651): undefined reference to `operator new(unsigned long)'
/usr/bin/ld: commands.cc:(.text+0x26e1): undefined reference to `operator new(unsigned long)' collect2: error: ld returned 1 exit status

原因:

申明了函数却没实现,一般是链接阶段出现

netkit-telnet-0.17# ./configure
Looking for a C++ compiler... gcc <<< 发现编译c++文件应该编译器要选g++

解决:修改configure文件中c++文件的编译器

# git diff
diff --git a/configure b/configure
index 429167a..e8780e7 100755
--- a/configure
+++ b/configure
@@ -122,7 +122,7 @@ EOF if [ x"$CXX" = x ]; then
echo -n 'Looking for a C++ compiler... '
- for TRY in egcs gcc g++ CC c++ cc; do
+ for TRY in egcs g++ CC c++ cc; do <<<修改

exit函数不存在

main.cc:92:2: error: 'exit' was not declared in this scope; did you mean 'Exit'?
92 | exit(1);
| ^~~~
| Exit
make[1]: *** [../MRULES:7: main.o] Error 1
make[1]: Leaving directory 'netkit-telnet-0.17/telnet'
make: *** [Makefile:8: telnet.build] Error 2

解决:

添加头文件

#include <cstdlib>

error: 'memcpy' was not declared

terminal.cc:696:5: error: 'memcpy' was not declared in this scope
696 | memcpy(new_tc.c_cc, old_tc.c_cc, sizeof(old_tc.c_cc));

解决:

c++ - ‘memcpy’ was not declared in this scope - Stack Overflow

运行

编译完成后生成可执行文件

//客户端
netkit-telnet-0.17/telnet/telnet
//服务端
netkit-telnet-0.17/telnetd/telnetd

运行client端

netkit-telnet-0.17/telnet# ./telnet
telnet> ?
Commands may be abbreviated. Commands are: close close current connection
logout forcibly logout remote user and close the connection
display display operating parameters
mode try to enter line or character mode ('mode ?' for more)
open connect to a site
quit exit telnet
send transmit special characters ('send ?' for more)
set set operating parameters ('set ?' for more)
unset unset operating parameters ('unset ?' for more)
status print status information
toggle toggle operating parameters ('toggle ?' for more)
slc set treatment of special characters z suspend telnet
environ change environment variables ('environ ?' for more)

运行server端

netkit-telnet-0.17/telnetd# ./telnetd -n
Usage: telnetd [-debug] [-D (options|report|exercise|netdata|ptydata)]
[-h] [-L login_program] [-n] [port]

netkit-telnet源码编译安装的更多相关文章

  1. Centos7.X 源码编译安装subversion svn1.8.x

    说明:SVN(subversion)的运行方式有两种:一种是基于Apache的http.https网页访问形式:还有一种是基于svnserve的独立服务器模式.SVN的数据存储方式也有两种:一种是在B ...

  2. Linux 从源码编译安装 OpenSSH

    https://blog.csdn.net/bytxl/article/details/46639073 Linux 从源码编译安装 OpenSSH以及各问题解决 2015年06月25日 17:37: ...

  3. SSH/SSL 源码编译安装简易操作说明

    环境:CentOS 6.7 安全加固需求,由于某盟扫描系统主机有SSL系列漏洞,客户要求必须修复: 解决方案:将SSH/SSL升级到最新版本,删除SSL旧版本(实测不删除旧版本某盟扫描无法通过). 当 ...

  4. 源码编译安装 MySQL 5.5.x 实践

    1.安装cmakeMySQL从5.5版本开始,通过./configure进行编译配置方式已经被取消,取而代之的是cmake工具.因此,我们首先要在系统中源码编译安装cmake工具. # wget ht ...

  5. 烂泥:mysql5.5数据库cmake源码编译安装

    本文由秀依林枫提供友情赞助,首发于烂泥行天下. 以前也写过一篇有关mysql5.0源码编译的文章,该文章为<烂泥:mysql5.0数据库源码编译安装>.但是MySQL自5.5版本以后,就开 ...

  6. centos6.5环境源码编译安装mysql5.6.34

    centos6.5环境源码编译安装mysql5.6.34 源码下载地址http://dev.mysql.com/downloads/mysql/5.6.html#downloads 选择Generic ...

  7. centos 6.5源码编译安装subversion 1.8.10

    一.简介 CentOS 6.5的yum源可以安装的SVN客户端版本太低了,1.6.11,所以需要升级到1.8.10,而官网有没有找到1.8.10的安装包,只能选择源码编译安装. 二.安装步骤 参考官网 ...

  8. Linux环境PostgreSQL源码编译安装

    Linux环境PostgreSQL源码编译安装 Linux版本: Red Hat 6.4 PostgreSQL版本: postgresql-9.3.2.tar.gz 数据存放目录: /var/post ...

  9. 总结源码编译安装mysql

    最近在学习源码编译安装LAMP.LNMP时,一直遇到一个难题,就是就是mysql无论怎么源码编译安装,到最后启动服务都提示"Starting MySQL.The server quit wi ...

  10. Linux下源码编译安装rpy2

    R(又称R语言)是一款开源的跨平台的数值统计和数值图形化展现工具.rpy2是Python直接调用R的第三方库,它可以实现使用python读取R的对象.调用R的方法以及Python与R数据结构转换等.这 ...

随机推荐

  1. pycharm下载与使用

    pycharm下载与使用 PyCharm是一种Python IDE(Integrated Development Environment,集成开发环境),带有一整套可以帮助用户在使用Python语言开 ...

  2. 欢迎来到ktq_cpp的cnblog

    欢迎来到ktq_cpp的cnblog 初学html,可能排版有一些问题,望指教 我的洛谷博客 我的AtCoder账号

  3. 浅谈-动态路由之OSPF的理解

    路由 在网络中,路由相当于就是一张地图,让路由器知道这个对应的IP数据包应该往哪端口.网段走:而这个"地图"我们称之为路由表,不同的目的IP路由表的下一个跳也不同,其生成方式有又有 ...

  4. 关于Struts访问不到静态资源的问题

    今天重新配置了Struts的项目进行开发,但是项目静态资源一直访问不到. 将一些静态资源放在WebRoot下的static包下面便于管理. 一开始以为采用拦截.do,只拦截do后缀的请求,解决了静态资 ...

  5. sql语句优化小结

    sql的优化技巧. 1.用join进行子查询的优化. 低效的子查询 select a.user_name,a.over,(select over from user2 b where a.user_n ...

  6. CentOS6/7开机启动配置

    最近在配置Linux系统的ntp校时,涉及到开机启动问题,总结一下 两个环境: CentOS release 6.5 (Final) CentOS Linux release 7.9.2009 (Co ...

  7. uoj221【NOI2016】循环之美

    前面部分比较简单,就是无脑化式子,简单点讲好了. 首先肯定在\((x,y)=1\)时才考虑这个分数,要求纯循环的话,不妨猜猜结论,就是y必须和K互质.所以答案是\(\sum_{i=1}^n \sum_ ...

  8. python如何引入外部其他py文件

    新手常常会遇到这种问题 解决方法如下: 比如我在C:\Users\123\Desktop有一个mmm.py文件,内容为: def abc(): print('hello,world') 当我写程序想引 ...

  9. linux系统启动达梦迁移工具失败解决办法

    在达梦数据库服务端的tool目录下执行./dts来启动迁移工具,迁移工具启动前出现报错,以下提供几种遇到问题的解决办法: 1. 报错1: 执行./dts,报错提示: [yyuser@qy-ggyf-z ...

  10. 网页嵌入zabbix页面(不同域名)

    先来结论: 方案一:绕过身份验证:https://www.cnblogs.com/JaSonS-toy/p/4939805.html(我不是这样实现,可以自行尝试) 方案二: 1.保证请求的ip与请求 ...