Simon Josefsson
8e9d7c933a
doc: Fix codespell nits
2025-11-27 00:33:35 +01:00
Collin Funk
8e88c32cfe
maint: Fix link errors on Solaris 11 OmniOS.
...
* bootstrap.conf (gnulib_modules): Add hostent and socket.
* ftp/Makefile.am (ftp_LDADD): New variable.
* ftpd/Makefile.am (ftpd_LDADD): New variable.
* ifconfig/Makefile.am (ifconfig_LDADD): New variable.
* ping/Makefile.am (ping_LDADD): Add $(LIBSOCKET), $(HOSTENT_LIB),
$(LIBINTL), and $(GETADDRINFO_LIB).
(ping6_LDADD): New variable.
* src/Makefile.am (hostname_LDADD, rlogin_LDADD, rsh_LDADD): Add
$(HOSTENT_LIB).
(tftp_LDADD, rexecd_LDADD): Add $(LIBSOCKET).
(rexec_LDADD, dnsdomainname_LDADD, logger_LDADD, inetd_LDADD)
(tftpd_LDADD): New variables.
(rlogind_LDADD): Add $(LIBSOCKET), $(LIBINTL), and $(GETADDRINFO_LIB).
(rshd_LDADD): Add $(HOSTENT_LIB), $(LIBINTL), and $(GETADDRINFO_LIB).
(syslogd_LDADD): Add $(LIBSOCKET), $(HOSTENT_LIB), $(LIBINTL), and
$(GETADDRINFO_LIB).
(uucpd_LDADD): Add $(LIBSOCKET) and $(HOSTENT_LIB).
* talk/Makefile.am (talk_LDADD): New variable.
* talkd/Makefile.am (talkd_LDADD): New variable.
* telnet/Makefile.am (telnet_LDADD): New variable.
* telnetd/Makefile.am (telnetd_LDADD): New variable.
* tests/Makefile.am (localhost_LDADD, runtime_ipv6_LDADD)
(addrpeek_LDADD, tcpget_LDADD): New variables.
* whois/Makefile.am (whois_LDADD): New variable.
2025-02-25 22:36:20 -08:00
Simon Josefsson
04c3738a6c
maint: Run 'make update-copyright'.
2025-01-01 18:21:25 +01:00
Collin Funk
a6d9848a32
telnet: Handle integer overflow gracefully.
...
* bootstrap.conf (gnulib_modules): Add inttypes and xstrtoimax.
* telnet/commands.c (send_tncmd): Don't allow the integer argument to
'send dont' to overflow.
2024-08-23 22:48:30 -07:00
Simon Josefsson
b2e9902ee0
Cleanup susp/ayt definitions, inspired by NetBSD.
...
sys_bsd.c:680:12: warning: a function declaration without a prototype is deprecated in all versions of C and is treated as a zero-parameter prototype in C2x, conflicting with a subsequent definition [-Wdeprecated-non-prototype]
void ayt ();
^
sys_bsd.c:1003:1: note: conflicting prototype is here
ayt (int sig MAYBE_UNUSED)
^
2024-07-18 09:33:05 +02:00
Simon Josefsson
3b0f9a276e
Fix MacOSX build error, adopting NetBSD's "solution" to cast the function.
...
sys_bsd.c:734:24: error: incompatible function pointer types passing 'void (void)' to parameter of type 'void (*)(int)' [-Wincompatible-function-pointer-types]
signal (SIGINFO, ayt_status);
^~~~~~~~~~
2024-07-18 09:29:22 +02:00
Collin Funk
380bbda036
telnet: Make function declarations C23 compatible.
...
* NEWS: Mention C23 support.
* telnet/commands.c (Sendlist, Togglelist, Setlist, ModeList, SlcList)
(EnvList): Replace '0' pointers with NULL.
(struct authlist, struct encryptlist): Add types to function
prototypes.
(AuthList, EncryptList): Cast some function pointers. Replace '0'
pointers with NULL.
(auth_cmd, encrypt_cmd): Fix number of arguments passed to functions.
2024-05-10 21:02:04 -07:00
Collin Funk
dd4c077b34
maint: Fix most instances of '-Wstrict-prototypes'.
...
* libinetutils/des_rw.c (des_clear_key, des_read, des_write): Don't
use K&R-style function declarations.
* ifconfig/system/linux.c (pnd_read): Use void instead of an empty
argument list.
* libtelnet/auth.c (auth_status, auth_request, auth_send_retry):
Likewise.
* libtelnet/kerberos5.c (kerberos5_cleanup): Likewise.
* ping/ping.c (ping_run): Likewise.
* ping/ping6.c (ping_run): Likewise.
* ping/ping6.h (ping_run): Likewise.
* ping/ping_impl.h (ping_run): Likewise.
* telnet/authenc.c (net_encrypt, telnet_spin): Likewise.
* telnet/commands.c (_setlist_init, auth_help, EncryptHelp)
(ayt_status): Likewise.
* telnet/sys_bsd.c (TerminalNewMode): Likewise.
* telnet/tn3270.c (outputPurge, Push3270, Finish3270, SetIn3270)
(tn3270_ttype): Likewise.
* telnetd/state.c (willoption): Likewise.
* telnetd/telnetd.h (pty_buffer_level): Likewise.
* telnetd/term.c (term_send_eof, term_change_eof, tty_linemode)
(tty_isecho, tty_flowmode, tty_restartany, tty_israw)
(tty_isbinaryin, tty_isbinaryout, tty_isediting, tty_istrapsig)
(tty_issofttab, tty_islitecho, tty_iscrnl, copy_termbuf): Likewise.
* telnetd/termstat.c (termstat, _termstat): Likewise.
* telnetd/utility.c (net_encrypt, telnet_spin): Likewise.
* src/rcp.c (krb_realmofhost): Add the parameter type.
* telnet/ring.c (ring_encrypt): Likewise.
* telnet/ring.h (ring_encrypt): Likewise.
2024-05-09 18:51:54 -07:00
Collin Funk
711242da5b
maint: Remove uses of the 'register' keyword.
...
* libicmp/*.c: Don't use the 'register' keyword when declaring
variables or arguments.
* libinetutils/*.c: Likewise.
* libtelnet/*.h: Likewise.
* libtelnet/*.c: Likewise.
* src/*.c: Likewise.
* talk/*.c: Likewise.
* telnet/*.c: Likewise.
* telnetd/*.c: Likewise.
2024-05-08 21:22:33 -07:00
Collin Funk
e5a9384c92
maint: Remove unnecessary standard library extern function decls.
...
* ftp/cmds.c (account, user): Don't declare getpass since it is
defined in unistd.h.
* ftp/ftp.c (login): Likewise. Don't declare fclose and pclose since
they are defined in stdio.h.
* ftpd/extern.h: Don't declare getusershell since it is defined in
unistd.h.
* ftpd/ftpd.c: Don't declare fclose since it is defined in stdio.h.
* libinetutils/logwtmp.c: Don't declare errno since it is defined in
errno.h.
* libtelnet/misc.c (auth_encrypt_user): Include string.h and don't
declare strdup.
* telnet/authenc.c (telnet_gets): Don't declare getpass since it is
defined in unistd.h.
* telnet/commands.c (hostname): Use NULL instead of 0.
(env_init, shell): Include string.h and don't redeclare functions.
2024-05-08 20:29:36 -07:00
Collin Funk
4d71ebcc50
Fix sc_bsd_caddr checks.
...
* libinetutils/if_index.c (if_nameindex): Don't cast non-void pointer
arithmetic.
* ftp/ftp.c (hookup): Don't cast pointers to memmove and memset.
* src/inetd.c (getconfigent): Likewise.
* telnet/commands.c (tn): Likewise.
2024-05-06 14:50:17 -07:00
Collin Funk
be9a0c66f5
maint: Remove redundant 'environ' declarations.
...
* src/rexecd.c: Remove 'extern char **environ' and instead rely on the
gnulib declaration in unistd.h.
* src/rshd.c: Likewise.
* src/uucpd.c: Likewise.
* telnet/commands.c: Likewise.
* telnetd/pty.c: Likewise.
* tests/addrpeek.c: Likewise.
2024-05-02 04:21:40 -07:00
Simon Josefsson
aba8d6528e
maint: Run 'make update-copyright'.
2024-01-01 11:28:59 +01:00
Simon Josefsson
2cf199580a
maint: Re-indent using GNU indent 2.2.13.
2023-12-29 18:35:01 +01:00
Simon Josefsson
4bfe18d36f
maint: Run 'make update-copyright'.
2023-01-01 01:37:41 +01:00
Simon Josefsson
c1b8d134d5
Indent code.
2022-10-26 00:03:45 +02:00
Simon Josefsson
541fbbdaea
Build fixes for C23 compatibility.
...
* src/inetd.c (signal_set_handler): Clarify sighandler_t type.
* ifconfig/printif.c, ifconfig/system/bsd.c, ifconfig/system/generic.c,
ifconfig/system/hurd.c, ifconfig/system/linux.c, src/tftp.c,
telnet/commands.c: Reorder MAYBE_UNUSED.
* libtelnet/genget.c (isprefix, genget): Use const char.
libtelnet/genget.c (Ambiguous): Use void.
* telnet/commands.c, telnet/externs.h, telnet/network.c,
telnet/telnet.c, telnet/utilities.c: Clarify empty function types,
and update callers.
2022-10-25 22:37:01 +02:00
Erik Auerswald
77ad828a15
telnet: fix typo in diagnostic message
...
* telnet/commands.c (makeargv): Print the newline after the
sentence terminating period, not before.
2022-09-07 18:51:26 +02:00
Guillem Jover
749520101b
telnet: Add checks for option reply parsing limits
...
This fixes buffer overflows caused by for example:
telnet -l`perl -e 'print "A"x5000'` localhost
Origin: FreeBSD, https://cgit.freebsd.org/src/commit/?id=14aab889f4e50072a6b914eb95ebbfa939539dad
Fixes: CVE-2019-0053
Signed-off-by: Simon Josefsson <simon@josefsson.org >
2022-09-06 19:49:54 +02:00
Erik Auerswald
7aa677948c
telnet: Fix TTYPE subnegotiation off-by-one error.
...
Fix off-by-one error in Terminal-Type option subnegotiation if the TERM
variable has exactly 44 bytes. In this case the SE byte (end of
subnegotiation parameters) was replaced by a NUL byte. This concerns
the CVE-2019-0053 fixes. Reported by Erik Auerswald in
<https://lists.gnu.org/archive/html/bug-inetutils/2022-02/msg00004.html >.
* NEWS: Mention fix.
* telnet/telnet.c (suboption): Adjust length check to account for NUL
byte written by snprintf().
Signed-off-by: Simon Josefsson <simon@josefsson.org >
2022-07-08 00:53:58 +02:00
Erik Auerswald
e48407eb2a
telnet: Abort subnegotiation of XDISPLOC on error.
...
Subnegotiation of the X Display Location option needs to be
aborted when it cannot be completed.
* NEWS: Mention fix.
* telnet/telnet.c (suboption): Call send_wont() to abort when
DISPLAY value does not fit into temporary buffer.
Signed-off-by: Simon Josefsson <simon@josefsson.org >
2022-07-08 00:51:58 +02:00
Simon Josefsson
43ee2f0191
telnet: Fix crash of "set ' ' foo" command.
...
Reported by ZFeiXQ and tiny patch by Erik Auerswald in
<https://lists.gnu.org/archive/html/bug-inetutils/2022-02/msg00010.html >.
* telnet/commands.c (setcmd): Don't crash on empty option.
2022-07-07 23:23:52 +02:00
Simon Josefsson
6123dd90d9
telnet: Fix crash of "unset ' '" command.
...
Reported by AiDai and tiny patch by Erik Auerswald in
<https://lists.gnu.org/archive/html/bug-inetutils/2022-02/msg00007.html >.
* telnet/commands.c (unsetcmd): Don't crash on empty option.
2022-07-07 23:14:52 +02:00
Simon Josefsson
9a2a28719e
telnet: Make 'help help' output help string.
...
Tiny patch by Erik Auerswald in
<https://lists.gnu.org/archive/html/bug-inetutils/2022-02/msg00009.html >.
* telnet/commands.c (cmdtab2): Fix 'help' string.
2022-07-07 22:51:13 +02:00
Simon Josefsson
fe1c596e02
telnet: Fix crash on 'help help' command.
...
Reported by AiDai in
<https://lists.gnu.org/archive/html/bug-inetutils/2021-12/msg00009.html >
and debugged and tiny patch by Erik Auerswald in
<https://lists.gnu.org/archive/html/bug-inetutils/2022-02/msg00009.html >.
* telnet/commands.c (help): Don't crash on empty c->help.
2022-07-07 22:47:55 +02:00
Simon Josefsson
f0c2abdbb7
telnet: Fix crash on too many options to 'help' command.
...
Tiny patch from Erik Auerswald <auerswal@unix-ag.uni-kl.de > in
<https://lists.gnu.org/archive/html/bug-inetutils/2022-02/msg00014.html >.
* telnet/commands.c (TELNET_MAX_ARGS): New symbol.
(margv): Use it instead of hard-coded value.
(makeargv): Check if we reach limit instead of crashing.
2022-07-07 22:11:36 +02:00
Alfred M. Szmidt
6d519229fa
Happy GNU 2022 year!
2022-01-01 17:23:02 +01:00
Simon Josefsson
1d5c923528
maint: Use copyright year ranges for readability.
...
* cfg.mk (update-copyright-env): Add, from coreutils.
(VC_LIST_ALWAYS_EXCLUDE_REGEX): Add, for update-copyright exceptions.
* README: Add info about copyright year ranges.
* *: Update copyright notices.
2021-09-03 18:41:09 +02:00
Simon Josefsson
a1b4cb859f
doc: Fix typos, inspired by tiny BSD patches.
2021-09-03 17:43:26 +02:00
Simon Josefsson
3fcebb9b38
telnet: Don't infloop for malicious server.
...
See https://bugs.debian.org/945861 and the tiny patch used by NetBSD:
36b8cfb2e2 (diff-38b7213f9c6c21245fbeb4fad9520a27239d712a6dd0fea20dd6b77203b5737c)
* NEWS: Mention fix.
* telnet/utilities.c (ExitString): Don't call SetForExit().
2021-09-03 16:06:11 +02:00
Simon Josefsson
0ceee23262
Use gnulib module 'attribute' instead of obsolete 'snippets/unused-parameters'.
...
* */*.c: Use MAYBE_UNUSED instead of _GL_UNUSED_PARAMETER.
* */*.c: Include attribute.h instead of unused-parameters.h.
2021-09-01 22:49:18 +02:00
Simon Josefsson
f70b506e37
telnet: Support --bind (-b) for NetKit compatibility.
...
* NEWS: Add.
* doc/inetutils.texi (telnet invocation): Add --bind (-b).
* telnet/commands.c (tn): New variables hostaddr and srchostp.
Parse -b parameter. Update usage string. If -b is set, call
getaddrinfo on it and pass that ai_addr on to bind.
* telnet/main.c (srcaddr): New global variable.
(argp_options): Add --bind (-b).
(parse_opt): Set srcaddr to -b value.
(main): Propagate -b value to tn function.
2021-04-28 20:14:52 +02:00
Simon Josefsson
d92d17e98a
telnet/commands.c (logoutcmd): Renamed from logout.
...
Conflicts with system utmp.h's logout(3).
(cmdtab): Use logoutcmd instead of logout.
2021-01-28 17:13:17 +01:00
Alfred M. Szmidt
911413ea57
Happy GNU 2021 year!
2021-01-01 11:35:27 +01:00
Tim Rühsen
100cfe0866
telnet: Use memove for overlapping memory instead of strncpy
2020-04-27 10:03:21 +02:00
Mats Erik Andersson
705750b8b4
Support for libidn2 in addition to libidn.
...
Prefer libidn2 when both are present and usable.
2020-04-05 16:21:30 +02:00
Tim Rühsen
908bfc85ed
telnet/commands.c: Use strdup instead malloc+strcpy
2020-02-29 19:42:00 +01:00
Tim Rühsen
22243e6f8e
telnet: Fix -Wsign-compare in suboption
2020-02-29 19:30:20 +01:00
Tim Rühsen
861ee754da
telnet: Fix silent truncation (off-by-one check)
...
If the DISPLAY variable had exactly 44 bytes, the SE
byte (end sub negotiation) was silently truncated.
2020-02-29 18:37:20 +01:00
Mats Erik Andersson
07fdb4201a
More work on CVE-2019-0053.
...
Telnet protocol messages must remain sane at all costs, instead of
being truncated because indata was oversized. Some additional cases
of insufficient buffer declaration are corrected.
2020-01-29 21:07:10 +01:00
Mats Erik Andersson
71ece60ff8
Minor portability glitches in Solaris and in AIX.
2020-01-18 17:47:05 +01:00
Simon Josefsson
1480573a90
telnet: Validate supplied environment variables. CVE-2019-0053
...
telnet/telnet.c (suboption): Use snprintf instead of sprintf.
telnet/utilities.c (printsub): Likewise.
2020-01-01 15:28:58 +01:00
Simon Josefsson
d8de4587f2
Update copyright years to use intervals up to 2020.
2020-01-01 13:21:37 +01:00
Simon Josefsson
69196f8b6c
telnet: Telnet -E(no escape) is treating _POSIX_VDISABLE char as escape.
...
Reported by Mikhail Bychek <mikhail.bychek@sputnix.ru >.
See also:
c3694d9858
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=6317
2020-01-01 12:41:33 +01:00
Mats Erik Andersson
3d64a8c728
Update copyright years to 2017. (silent change)
2017-02-21 14:25:23 +01:00
Mats Erik Andersson
84dcf08568
Update copyright years to 2016. (silent change)
2016-01-22 19:09:49 +01:00
Mats Erik Andersson
654247a94d
telnet: Printing of uninitialized characters.
...
Correctly test whether a string composed from a handful
of contributions turned out to be empty after all.
2015-01-31 16:33:31 +01:00
Mats Erik Andersson
d3c9b1b8fa
Update copyright years with 2015. (silent change)
2015-01-16 14:09:44 +01:00
Mats Erik Andersson
ae85332551
Update copyright years with 2014. (silent change)
2014-01-18 12:23:21 +01:00
Mats Erik Andersson
17518fbec9
rlogind, telnet, telnetd: Modify exit status.
...
As a side effect, a race condition is now avoided,
while `rlogind' is tearing down pseudo-terminal pairs.
2013-11-28 19:39:38 +01:00