介绍

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. 【Java8新特性】- 接口中默认方法修饰为普通方法

    Java8新特性 - 接口中默认方法修饰为普通方法 生命不息,写作不止 继续踏上学习之路,学之分享笔记 总有一天我也能像各位大佬一样 一个有梦有戏的人 @怒放吧德德 分享学习心得,欢迎指正,大家一起学 ...

  2. 把train数据集生成txt(test同理)

    import cv2 import numpy as np import os import sys import pickle data_dir = os.path.join("./&qu ...

  3. flutter系列之:flutter中可以建索引的栈布局IndexedStack

    目录 简介 IndexedStack简介 IndexedStack的使用 总结 简介 之前我们介绍了一个flutter的栈结构的layout组件叫做Stack,通过Stack我们可以将一些widget ...

  4. 【多服务场景化解决方案】AR虚拟技术助力智能家装

    ​ 1 .介绍 总览 本应用采用了华为图形引擎服务的AR虚拟技术,您可以在手机相机里摆放想要购置的家具家电,交互式体验让您可以轻松操控它们的3D图例,以此来确定这些家具家电是否适合摆放在您的家里. 特 ...

  5. 题解UVA10948 The primary problem

    前言 前置 \(\sf{Solution}\) 既然有了 \(n\) ,那找出 \(a\) 和 \(b\) 就只要枚举 \(a\) 的范围 \(1\sim n\),判断 \(a\) 和 \(n-a\) ...

  6. flutter 系列之:flutter 中的幽灵offstage

    目录 简介 Offstage详解 Offstage的使用 总结 简介 我们在使用flutter的过程中,有时候需要控制某些组件是否展示,一种方法是将这个组件从render tree中删除,这样这个组件 ...

  7. 【深入浅出 Yarn 架构与实现】1-1 设计理念与基本架构

    一.Yarn 产生的背景 Hadoop2 之前是由 HDFS 和 MR 组成的,HDFS 负责存储,MR 负责计算. 一)MRv1 的问题 耦合度高:MR 中的 jobTracker 同时负责资源管理 ...

  8. Ajax基础(中)

    这节主要在上节的基础上学会如何使用Ajax 源码下载: 链接:https://pan.baidu.com/s/1kG-vACFxneAZqONdo97XrQ 提取码:k21y 在WebStorm中打开 ...

  9. 2022春每日一题:Day 11

    题目:高斯消元法 高斯消元法是一个模板,下面简单介绍其内容以及实现方法. 高斯消元是求一个求多元一次方程组的解的算法. 就是形式如下的关于x1,x2...xn的方程组的解. a11x1 + a12x2 ...

  10. 数据结构篇——KMP算法

    数据结构篇--KMP算法 本次我们介绍数据结构中的KMP算法,我们会从下面几个角度来介绍: 问题介绍 暴力求解 知识补充 Next示例 Next代码 匹配示例 匹配代码 完整代码 问题介绍 首先我们先 ...