1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
diff -rNU3 openssh-9.4p1.old/loginrec.c openssh-9.4p1/loginrec.c
--- openssh-9.4p1.old/loginrec.c 2023-08-10 01:10:22.000000000 +0000
+++ openssh-9.4p1/loginrec.c 2024-12-08 04:52:39.040018859 +0000
@@ -741,7 +741,7 @@
void
construct_utmpx(struct logininfo *li, struct utmpx *utx)
{
-# ifdef HAVE_ADDR_V6_IN_UTMP
+# ifdef HAVE_ADDR_V6_IN_UTMPX
struct sockaddr_in6 *sa6;
# endif
memset(utx, '\0', sizeof(*utx));
@@ -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);
@@ -1663,7 +1663,11 @@
const char *ttyn)
{
int fd;
+#if defined(USE_UTMPX)
+ struct utmpx ut;
+#else
struct utmp ut;
+#endif
struct sockaddr_storage from;
socklen_t fromlen = sizeof(from);
struct sockaddr_in *a4;
|