diff options
Diffstat (limited to 'sshd.c')
-rw-r--r-- | sshd.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -40,7 +40,7 @@ | |||
40 | */ | 40 | */ |
41 | 41 | ||
42 | #include "includes.h" | 42 | #include "includes.h" |
43 | RCSID("$OpenBSD: sshd.c,v 1.147 2001/01/10 19:43:20 deraadt Exp $"); | 43 | RCSID("$OpenBSD: sshd.c,v 1.150 2001/01/13 18:32:51 markus Exp $"); |
44 | 44 | ||
45 | #include "xmalloc.h" | 45 | #include "xmalloc.h" |
46 | #include "rsa.h" | 46 | #include "rsa.h" |
@@ -580,7 +580,7 @@ main(int ac, char **av) | |||
580 | initialize_server_options(&options); | 580 | initialize_server_options(&options); |
581 | 581 | ||
582 | /* Parse command-line arguments. */ | 582 | /* Parse command-line arguments. */ |
583 | while ((opt = getopt(ac, av, "f:p:b:k:h:g:V:u:dDiqQ46")) != EOF) { | 583 | while ((opt = getopt(ac, av, "f:p:b:k:h:g:V:u:dDiqQ46")) != -1) { |
584 | switch (opt) { | 584 | switch (opt) { |
585 | case '4': | 585 | case '4': |
586 | IPv4or6 = AF_INET; | 586 | IPv4or6 = AF_INET; |
@@ -927,7 +927,7 @@ main(int ac, char **av) | |||
927 | sighup_restart(); | 927 | sighup_restart(); |
928 | if (fdset != NULL) | 928 | if (fdset != NULL) |
929 | xfree(fdset); | 929 | xfree(fdset); |
930 | fdsetsz = howmany(maxfd, NFDBITS) * sizeof(fd_mask); | 930 | fdsetsz = howmany(maxfd+1, NFDBITS) * sizeof(fd_mask); |
931 | fdset = (fd_set *)xmalloc(fdsetsz); | 931 | fdset = (fd_set *)xmalloc(fdsetsz); |
932 | memset(fdset, 0, fdsetsz); | 932 | memset(fdset, 0, fdsetsz); |
933 | 933 | ||
@@ -938,7 +938,7 @@ main(int ac, char **av) | |||
938 | FD_SET(startup_pipes[i], fdset); | 938 | FD_SET(startup_pipes[i], fdset); |
939 | 939 | ||
940 | /* Wait in select until there is a connection. */ | 940 | /* Wait in select until there is a connection. */ |
941 | if (select(maxfd + 1, fdset, NULL, NULL, NULL) < 0) { | 941 | if (select(maxfd+1, fdset, NULL, NULL, NULL) < 0) { |
942 | if (errno != EINTR) | 942 | if (errno != EINTR) |
943 | error("select: %.100s", strerror(errno)); | 943 | error("select: %.100s", strerror(errno)); |
944 | continue; | 944 | continue; |
@@ -1080,6 +1080,12 @@ main(int ac, char **av) | |||
1080 | linger.l_linger = 5; | 1080 | linger.l_linger = 5; |
1081 | setsockopt(sock_in, SOL_SOCKET, SO_LINGER, (void *) &linger, sizeof(linger)); | 1081 | setsockopt(sock_in, SOL_SOCKET, SO_LINGER, (void *) &linger, sizeof(linger)); |
1082 | 1082 | ||
1083 | /* Set keepalives if requested. */ | ||
1084 | if (options.keepalives && | ||
1085 | setsockopt(sock_in, SOL_SOCKET, SO_KEEPALIVE, (void *)&on, | ||
1086 | sizeof(on)) < 0) | ||
1087 | error("setsockopt SO_KEEPALIVE: %.100s", strerror(errno)); | ||
1088 | |||
1083 | /* | 1089 | /* |
1084 | * Register our connection. This turns encryption off because we do | 1090 | * Register our connection. This turns encryption off because we do |
1085 | * not have a key. | 1091 | * not have a key. |