diff options
Diffstat (limited to 'sshconnect.c')
-rw-r--r-- | sshconnect.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/sshconnect.c b/sshconnect.c index 59b273a9c..e40ba984c 100644 --- a/sshconnect.c +++ b/sshconnect.c | |||
@@ -13,7 +13,7 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include "includes.h" | 15 | #include "includes.h" |
16 | RCSID("$OpenBSD: sshconnect.c,v 1.89 2001/01/04 22:41:03 markus Exp $"); | 16 | RCSID("$OpenBSD: sshconnect.c,v 1.90 2001/01/13 18:32:50 markus Exp $"); |
17 | 17 | ||
18 | #include <openssl/bn.h> | 18 | #include <openssl/bn.h> |
19 | #include <openssl/dsa.h> | 19 | #include <openssl/dsa.h> |
@@ -187,12 +187,13 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr, | |||
187 | int anonymous, uid_t original_real_uid, | 187 | int anonymous, uid_t original_real_uid, |
188 | const char *proxy_command) | 188 | const char *proxy_command) |
189 | { | 189 | { |
190 | int gaierr; | ||
191 | int on = 1; | ||
190 | int sock = -1, attempt; | 192 | int sock = -1, attempt; |
191 | struct servent *sp; | ||
192 | struct addrinfo hints, *ai, *aitop; | ||
193 | char ntop[NI_MAXHOST], strport[NI_MAXSERV]; | 193 | char ntop[NI_MAXHOST], strport[NI_MAXSERV]; |
194 | int gaierr; | 194 | struct addrinfo hints, *ai, *aitop; |
195 | struct linger linger; | 195 | struct linger linger; |
196 | struct servent *sp; | ||
196 | 197 | ||
197 | debug("ssh_connect: getuid %u geteuid %u anon %d", | 198 | debug("ssh_connect: getuid %u geteuid %u anon %d", |
198 | (u_int) getuid(), (u_int) geteuid(), anonymous); | 199 | (u_int) getuid(), (u_int) geteuid(), anonymous); |
@@ -298,7 +299,13 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr, | |||
298 | /* setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *)&on, sizeof(on)); */ | 299 | /* setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *)&on, sizeof(on)); */ |
299 | linger.l_onoff = 1; | 300 | linger.l_onoff = 1; |
300 | linger.l_linger = 5; | 301 | linger.l_linger = 5; |
301 | setsockopt(sock, SOL_SOCKET, SO_LINGER, (void *) &linger, sizeof(linger)); | 302 | setsockopt(sock, SOL_SOCKET, SO_LINGER, (void *)&linger, sizeof(linger)); |
303 | |||
304 | /* Set keepalives if requested. */ | ||
305 | if (options.keepalives && | ||
306 | setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (void *)&on, | ||
307 | sizeof(on)) < 0) | ||
308 | error("setsockopt SO_KEEPALIVE: %.100s", strerror(errno)); | ||
302 | 309 | ||
303 | /* Set the connection. */ | 310 | /* Set the connection. */ |
304 | packet_set_connection(sock, sock); | 311 | packet_set_connection(sock, sock); |