aports/main/openssh/fix-utmp.patch
Laurent Bercot 1d2dc2e0eb
main/openssh: fix build with utmps
Ensure sshd correctly updates utmp and wtmp.
2022-07-20 20:53:16 +02:00

35 lines
1.1 KiB
Diff

diff -rNU3 openssh-9.0p1.old/loginrec.c openssh-9.0p1/loginrec.c
--- openssh-9.0p1.old/loginrec.c 2022-04-06 02:47:48.000000000 +0200
+++ openssh-9.0p1/loginrec.c 2022-07-11 14:59:44.848827188 +0200
@@ -763,10 +763,6 @@
set_utmpx_time(li, utx);
utx->ut_pid = li->pid;
- /* strncpy(): Don't necessarily want null termination */
- strncpy(utx->ut_user, li->username,
- MIN_SIZEOF(utx->ut_user, li->username));
-
if (li->type == LTYPE_LOGOUT)
return;
@@ -775,6 +771,10 @@
* for logouts.
*/
+ /* strncpy(): Don't necessarily want null termination */
+ strncpy(utx->ut_user, li->username,
+ MIN_SIZEOF(utx->ut_user, li->username));
+
# ifdef HAVE_HOST_IN_UTMPX
strncpy(utx->ut_host, li->hostname,
MIN_SIZEOF(utx->ut_host, li->hostname));
@@ -787,7 +787,7 @@
if (li->hostaddr.sa.sa_family == AF_INET)
utx->ut_addr = li->hostaddr.sa_in.sin_addr.s_addr;
# endif
-# ifdef HAVE_ADDR_V6_IN_UTMP
+# ifdef HAVE_ADDR_V6_IN_UTMPX
/* this is just a 128-bit IPv6 address */
if (li->hostaddr.sa.sa_family == AF_INET6) {
sa6 = ((struct sockaddr_in6 *)&li->hostaddr.sa);