282 Commits

Author SHA1 Message Date
Simon Josefsson
8e9d7c933a doc: Fix codespell nits 2025-11-27 00:33:35 +01:00
Erik Auerswald
db5823e95c syslogd: log ASCII 'DEL' as '^?'
DEL is a non-printable control character.  Make it visible in
syslogd log files by transliterating it in the same way as most
other ASCII control characters (TAB and NL are transliterated
as SP).

* NEWS: Mention change.
* src/syslogd.c (printline): Transliterate the ASCII DEL control
  character the same way as most other ASCII control characters.
2025-11-23 19:00:12 +01:00
Erik Auerswald
0170cf56ca syslogd: fix a stack-based buffer overflow
When logging a message, ASCII control characters are transliterated.
This transliteration uses two printable characters for each control
character.  If the last character that fits into the destination
buffer is a control character, the buffer needs place for two
characters in addition to the string terminator.  This was missing
from the code, resulting in a stack-based buffer overflow weakness
(CWE-121).

* NEWS: Mention fix.
* src/syslogd.c (printline): Allocate an additional byte in the
  "line" buffer to account for control character transliteration.
2025-11-23 16:39:23 +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
Jeffrey Cliff
b2e39e94eb rshd.c: Fix gcc15 warning.
* rshd.c (path): Increase size.

Signed-off-by: Simon Josefsson <simon@josefsson.org>
2024-10-05 18:07:36 +02:00
Collin Funk
4b73be3eb2 maint: Use stat-time from Gnulib.
* bootstrap.conf (gnulib_modules): Add stat-time.
* configure.ac: Prefer Gnulib checks for struct stat.
* libls/cmp.c (off_cmp): New function.
(modcmp, acccmp, statcmp, sizecmp): Use functions from stat-time.
* src/rcp.c (write_stat_time): Likewise.
2024-09-02 20:34:54 -07:00
Collin Funk
9931420a77 rcp: Don't call va_start without calling va_end.
* src/rcp.c (run_err): Move va_start call after the early return.
2024-07-27 21:25:30 -07:00
Collin Funk
550ad69881 traceroute: Modernize time functions.
* bootstrap.conf (gnulib_modules): Add gettime, pselect, timespec, and
timespec-sub.
* src/Makefile.am (traceroute_LDADD): Add $(CLOCK_TIME_LIB),
$(PTHREAD_SIGMASK_LIB), and $(SELECT_LIB).
* src/traceroute.c (trace_t): Use a timespec instead of timeval.
(do_try): Use pselect instead of select. Use current_timespec instead
of gettimeofday. Use timespec_sub.
(trace_write): Use current_timespec instead of gettimeofday.
2024-06-26 16:23:59 -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
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
b5888324ce Fix sc_unsigned_int checks.
* ftpd/ftpd.c (send_data, receive_data): Convert 'u_int' to
'unsigned int'.
* libinetutils/ttymsg.c (inetutils_ttymsg): Likewise.
* libls/extern.h: Likewise.
* libls/print.c (minor, printtype): Likewise.
* libls/stat_flags.c (flags_to_string, string_to_flags): Likewise.
* src/rlogin.c (winsize, get_window_size, getescape): Likewise.
* src/rsh.c (copyargs): Likewise.
2024-05-04 01:42:20 -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
Collin Funk
a172b76898 maint: Allow gnulib's readutmp module to use systemd. (tiny patch)
Signed-off-by: Simon Josefsson <simon@josefsson.org>
2024-03-22 20:45:23 +01:00
Simon Josefsson
aba8d6528e maint: Run 'make update-copyright'. 2024-01-01 11:28:59 +01:00
Simon Josefsson
e158f9c70d syslogd: Build fixes for macOS.
Thanks to Rui Chen and Caleb Xu, see
<https://savannah.gnu.org/bugs/?65093>.
2023-12-30 11:32:26 +01:00
Simon Josefsson
2cf199580a maint: Re-indent using GNU indent 2.2.13. 2023-12-29 18:35:01 +01:00
Simon Josefsson
9122999252 Indent changes in previous commit. 2023-07-31 13:59:05 +02:00
Jeffrey Bencteux
e4e65c03f4 ftpd,rcp,rlogin,rsh,rshd,uucpd: fix: check set*id() return values
Several setuid(), setgid(), seteuid() and setguid() return values
were not checked in ftpd/rcp/rlogin/rsh/rshd/uucpd code potentially
leading to potential security issues.

Signed-off-by: Jeffrey Bencteux <jeffbencteux@gmail.com>
Signed-off-by: Simon Josefsson <simon@josefsson.org>
2023-07-31 13:58:34 +02: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
Simon Josefsson
ae98f5b651 Don't use variable names true/bool, fixing gnulib builds and syncs with BSD.
* src/rlogind.c (rlogind_mainloop): Replace 'true' with 'on'.
* telnetd/telnetd.c (telnetd_setup): Likewise.
* ftp/cmds.c (onoff): Replace 'bool' with 'val'.
2022-10-14 21:40:19 +02:00
Erik Auerswald
fa6d2bce50 tftp: Ignore excess arguments
When given too many arguments to a command at the tftp cli,
the buffer used to hold the arguments would overflow.  This
could result in a crash.

The problem was reported by AiDai in
<https://lists.gnu.org/archive/html/bug-inetutils/2021-12/msg00018.html>.

This commit fixes the test failure in the previously added
file "tests/tftp-regressions.sh".

* NEWS: Mention fix.
* src/tftp.c (makeargv): Do not overflow argument buffer.
2022-09-11 15:12:26 +02:00
Simon Josefsson
8e0df0e80b logger: Don't read out of bounds on empty strings.
Reported by AiDai in:
<https://lists.gnu.org/archive/html/bug-inetutils/2021-12/msg00015.html>

* src/logger.c (send_to_syslog): Handle empty strings.
2022-07-07 23:40:05 +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
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
8586a5b3fe rlogind: Code for non-getaddrinfo removed.
* NEWS: Mention change.
* src/rlogind.c [!HAVE_DECL_GETADDRINFO]: Remove.
2021-08-26 09:11:44 +02:00
Simon Josefsson
1965afb227 logger: Code for non-getaddrinfo removed.
* NEWS: Mention change.
* src/logger.c [!HAVE_DECL_GETADDRINFO]: Remove.
2021-07-26 07:19:35 +02:00
Simon Josefsson
b6bfaf9630 Fix link failure with absent -lutil on Solaris 10.
* configure.ac (LIBUTIL): Prefer PTY_LIBS in Makefile.am over
adding -lutil for pty-functions.
* src/Makefile.am (LDADD): Add PTY_LIB.
* telnetd/Makefile.am (LDADD): Likewise.
* tests/Makefile.am (identify_LDADD): Likewise.
2021-01-28 09:01:47 +01:00
Alfred M. Szmidt
911413ea57 Happy GNU 2021 year! 2021-01-01 11:35:27 +01: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
393f4c6c3e uucpd: Fix buffer overflows 2020-02-29 20:10:21 +01:00
Tim Rühsen
2343dc2e35 uucpd: Fix 2x heap buffer overflow 2020-02-29 19:47:19 +01:00
Tim Rühsen
14291ecccc rcp: Remove unused variable 2020-02-29 18:37:20 +01:00
Mats Erik Andersson
a9d1edfd47 Various compiler warnings. 2020-02-21 17:47:49 +01:00
Mats Erik Andersson
c1f18548f7 rexecd, rshd: Avoid false failure message. 2020-02-20 16:41:12 +01:00
Mats Erik Andersson
470d0b8048 rcp: Recursive reception was broken.
Revert code to a previous and functional stage.  The source was broken
in a well defined commit.  Reported by Zhixiong Chi.
2020-02-20 16:11:04 +01:00
Mats Erik Andersson
da919de3f4 Buffer overflow in tftp and tftpd.
Recent Gnu libc and Gcc inject checks for buffer size into strcpy().
These interfere with declarations in <arpa/tftp.h>.  Issue was reported
independently by Mike Gilbert and Ricardo Ribalda Delgado.
2020-02-04 14:38:46 +01:00
Mats Erik Andersson
5164b075a5 Better portability for BSD install.
Reordering arguments in install hooks improves portability, and the
inclusion of exit codes helps post analysis.  Reported by Bill Cole.
2020-02-03 19:12:28 +01:00
Simon Josefsson
d8de4587f2 Update copyright years to use intervals up to 2020. 2020-01-01 13:21:37 +01:00
Mats Erik Andersson
a4a331b7ee tftpd: Restore logging while chrooted. 2018-11-12 16:36:29 +01:00
Alfred M. Szmidt
91960071d7 src/hostname.c (parse_file): Free name and allocate one extra byte for it. 2017-07-10 20:14:58 +00:00
Alfred M. Szmidt
5508475631 src/hostname.c (set_name): Handle case when hostname_new is NULL. 2017-07-10 20:08:00 +00:00
Mats Erik Andersson
3d64a8c728 Update copyright years to 2017. (silent change) 2017-02-21 14:25:23 +01:00
Mats Erik Andersson
b0f7dcdf16 hostname: Avoid a trailing space.
Suppress the space character after the last presented IP number.
2016-05-23 23:06:47 +02:00
Mats Erik Andersson
7267896f92 traceroute: Subprivileged use case.
A fallback for ICMP tracing relevant to GNU/Linux is implemented,
allowing a rudimentary but suid-less use case.
2016-02-17 13:12:29 +01:00
Mats Erik Andersson
84dcf08568 Update copyright years to 2016. (silent change) 2016-01-22 19:09:49 +01:00