blob: f6a48e84fb000c331d3bfef0a0faa4dfad060ed3 (
plain) (
blame)
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
|
r184122 | des | 2008-10-21 06:58:26 -0500 (Tue, 21 Oct 2008) | 11 lines
Changed paths:
M /head/crypto/openssh/loginrec.c
M /head/crypto/openssh/sshd.c
At some point, construct_utmp() was changed to use realhostname() to fill
in the struct utmp due to concerns about the length of the hostname buffer.
However, this breaks the UseDNS option. There is a simpler and better
solution: initialize utmp_len to the correct value (UT_HOSTSIZE instead of
MAXHOSTNAMELEN) and let get_remote_name_or_ip() worry about the size of the
buffer.
PR: bin/97499
Submitted by: Bruce Cran <bruce@cran.org.uk>
Index: sshd.c
===================================================================
--- sshd.c.orig 2015-04-04 11:40:24.175508000 -0500
+++ sshd.c 2015-04-04 11:40:38.082324000 -0500
@@ -72,6 +72,7 @@
#include <string.h>
#include <unistd.h>
#include <limits.h>
+#include <utmp.h>
#ifdef WITH_OPENSSL
#include <openssl/dh.h>
@@ -229,7 +230,7 @@ u_char *session_id2 = NULL;
u_int session_id2_len = 0;
/* record remote hostname or ip */
-u_int utmp_len = HOST_NAME_MAX+1;
+u_int utmp_len = UT_HOSTSIZE;
/* options.max_startup sized array of fd ints */
int *startup_pipes = NULL;
|