summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-05-14 13:42:23 +1000
committerDamien Miller <djm@mindrot.org>2003-05-14 13:42:23 +1000
commit2372ace57287c6963a5790fb254e47de57537e0a (patch)
tree20a109f7f5c789a79599a52bcf6a6346fb794293
parent44e72a764f7febd041263c61c6931896a67d338e (diff)
- markus@cvs.openbsd.org 2003/04/14 14:17:50
[channels.c sshconnect.c sshd.c ssh-keyscan.c] avoid hardcoded SOCK_xx; with itojun@; should allow ssh over SCTP
-rw-r--r--ChangeLog5
-rw-r--r--channels.c11
-rw-r--r--ssh-keyscan.c4
-rw-r--r--sshconnect.c18
-rw-r--r--sshd.c5
5 files changed, 25 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index d1661c6d2..0d22a9f81 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,9 @@
15 - naddy@cvs.openbsd.org 2003/04/12 11:40:15 15 - naddy@cvs.openbsd.org 2003/04/12 11:40:15
16 [ssh.1] 16 [ssh.1]
17 document -V switch, fix wording; ok markus@ 17 document -V switch, fix wording; ok markus@
18 - markus@cvs.openbsd.org 2003/04/14 14:17:50
19 [channels.c sshconnect.c sshd.c ssh-keyscan.c]
20 avoid hardcoded SOCK_xx; with itojun@; should allow ssh over SCTP
18 21
1920030512 2220030512
20 - (djm) Redhat spec: Don't install profile.d scripts when not 23 - (djm) Redhat spec: Don't install profile.d scripts when not
@@ -1402,4 +1405,4 @@
1402 save auth method before monitor_reset_key_state(); bugzilla bug #284; 1405 save auth method before monitor_reset_key_state(); bugzilla bug #284;
1403 ok provos@ 1406 ok provos@
1404 1407
1405$Id: ChangeLog,v 1.2681 2003/05/14 03:42:08 djm Exp $ 1408$Id: ChangeLog,v 1.2682 2003/05/14 03:42:23 djm Exp $
diff --git a/channels.c b/channels.c
index 41abb8d6b..27707a128 100644
--- a/channels.c
+++ b/channels.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: channels.c,v 1.188 2003/04/08 20:21:28 itojun Exp $"); 42RCSID("$OpenBSD: channels.c,v 1.189 2003/04/14 14:17:50 markus Exp $");
43 43
44#include "ssh.h" 44#include "ssh.h"
45#include "ssh1.h" 45#include "ssh1.h"
@@ -2058,7 +2058,7 @@ channel_setup_fwd_listener(int type, const char *listen_addr, u_short listen_por
2058 continue; 2058 continue;
2059 } 2059 }
2060 /* Create a port to listen for the host. */ 2060 /* Create a port to listen for the host. */
2061 sock = socket(ai->ai_family, SOCK_STREAM, 0); 2061 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
2062 if (sock < 0) { 2062 if (sock < 0) {
2063 /* this is no error since kernel may not support ipv6 */ 2063 /* this is no error since kernel may not support ipv6 */
2064 verbose("socket: %.100s", strerror(errno)); 2064 verbose("socket: %.100s", strerror(errno));
@@ -2280,7 +2280,7 @@ connect_to(const char *host, u_short port)
2280 error("connect_to: getnameinfo failed"); 2280 error("connect_to: getnameinfo failed");
2281 continue; 2281 continue;
2282 } 2282 }
2283 sock = socket(ai->ai_family, SOCK_STREAM, 0); 2283 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
2284 if (sock < 0) { 2284 if (sock < 0) {
2285 if (ai->ai_next == NULL) 2285 if (ai->ai_next == NULL)
2286 error("socket: %.100s", strerror(errno)); 2286 error("socket: %.100s", strerror(errno));
@@ -2381,7 +2381,8 @@ x11_create_display_inet(int x11_display_offset, int x11_use_localhost,
2381 for (ai = aitop; ai; ai = ai->ai_next) { 2381 for (ai = aitop; ai; ai = ai->ai_next) {
2382 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) 2382 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
2383 continue; 2383 continue;
2384 sock = socket(ai->ai_family, SOCK_STREAM, 0); 2384 sock = socket(ai->ai_family, ai->ai_socktype,
2385 ai->ai_protocol);
2385 if (sock < 0) { 2386 if (sock < 0) {
2386 if ((errno != EINVAL) && (errno != EAFNOSUPPORT)) { 2387 if ((errno != EINVAL) && (errno != EAFNOSUPPORT)) {
2387 error("socket: %.100s", strerror(errno)); 2388 error("socket: %.100s", strerror(errno));
@@ -2547,7 +2548,7 @@ x11_connect_display(void)
2547 } 2548 }
2548 for (ai = aitop; ai; ai = ai->ai_next) { 2549 for (ai = aitop; ai; ai = ai->ai_next) {
2549 /* Create a socket. */ 2550 /* Create a socket. */
2550 sock = socket(ai->ai_family, SOCK_STREAM, 0); 2551 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
2551 if (sock < 0) { 2552 if (sock < 0) {
2552 debug("socket: %.100s", strerror(errno)); 2553 debug("socket: %.100s", strerror(errno));
2553 continue; 2554 continue;
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index 5b4eb82d1..ac3056ff2 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -7,7 +7,7 @@
7 */ 7 */
8 8
9#include "includes.h" 9#include "includes.h"
10RCSID("$OpenBSD: ssh-keyscan.c,v 1.41 2003/02/16 17:09:57 markus Exp $"); 10RCSID("$OpenBSD: ssh-keyscan.c,v 1.42 2003/04/14 14:17:50 markus Exp $");
11 11
12#include "openbsd-compat/sys-queue.h" 12#include "openbsd-compat/sys-queue.h"
13 13
@@ -397,7 +397,7 @@ tcpconnect(char *host)
397 if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) 397 if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0)
398 fatal("getaddrinfo %s: %s", host, gai_strerror(gaierr)); 398 fatal("getaddrinfo %s: %s", host, gai_strerror(gaierr));
399 for (ai = aitop; ai; ai = ai->ai_next) { 399 for (ai = aitop; ai; ai = ai->ai_next) {
400 s = socket(ai->ai_family, SOCK_STREAM, 0); 400 s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
401 if (s < 0) { 401 if (s < 0) {
402 error("socket: %s", strerror(errno)); 402 error("socket: %s", strerror(errno));
403 continue; 403 continue;
diff --git a/sshconnect.c b/sshconnect.c
index 16db13fa1..33d9c727f 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15#include "includes.h" 15#include "includes.h"
16RCSID("$OpenBSD: sshconnect.c,v 1.138 2003/04/08 20:21:29 itojun Exp $"); 16RCSID("$OpenBSD: sshconnect.c,v 1.139 2003/04/14 14:17:50 markus Exp $");
17 17
18#include <openssl/bn.h> 18#include <openssl/bn.h>
19 19
@@ -163,7 +163,7 @@ ssh_proxy_connect(const char *host, u_short port, const char *proxy_command)
163 * Creates a (possibly privileged) socket for use as the ssh connection. 163 * Creates a (possibly privileged) socket for use as the ssh connection.
164 */ 164 */
165static int 165static int
166ssh_create_socket(int privileged, int family) 166ssh_create_socket(int privileged, struct addrinfo *ai)
167{ 167{
168 int sock, gaierr; 168 int sock, gaierr;
169 struct addrinfo hints, *res; 169 struct addrinfo hints, *res;
@@ -175,15 +175,16 @@ ssh_create_socket(int privileged, int family)
175 if (privileged) { 175 if (privileged) {
176 int p = IPPORT_RESERVED - 1; 176 int p = IPPORT_RESERVED - 1;
177 PRIV_START; 177 PRIV_START;
178 sock = rresvport_af(&p, family); 178 sock = rresvport_af(&p, ai->ai_family);
179 PRIV_END; 179 PRIV_END;
180 if (sock < 0) 180 if (sock < 0)
181 error("rresvport: af=%d %.100s", family, strerror(errno)); 181 error("rresvport: af=%d %.100s", ai->ai_family,
182 strerror(errno));
182 else 183 else
183 debug("Allocated local port %d.", p); 184 debug("Allocated local port %d.", p);
184 return sock; 185 return sock;
185 } 186 }
186 sock = socket(family, SOCK_STREAM, 0); 187 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
187 if (sock < 0) 188 if (sock < 0)
188 error("socket: %.100s", strerror(errno)); 189 error("socket: %.100s", strerror(errno));
189 190
@@ -192,8 +193,9 @@ ssh_create_socket(int privileged, int family)
192 return sock; 193 return sock;
193 194
194 memset(&hints, 0, sizeof(hints)); 195 memset(&hints, 0, sizeof(hints));
195 hints.ai_family = family; 196 hints.ai_family = ai->ai_family;
196 hints.ai_socktype = SOCK_STREAM; 197 hints.ai_socktype = ai->ai_socktype;
198 hints.ai_protocol = ai->ai_protocol;
197 hints.ai_flags = AI_PASSIVE; 199 hints.ai_flags = AI_PASSIVE;
198 gaierr = getaddrinfo(options.bind_address, "0", &hints, &res); 200 gaierr = getaddrinfo(options.bind_address, "0", &hints, &res);
199 if (gaierr) { 201 if (gaierr) {
@@ -295,7 +297,7 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr,
295 host, ntop, strport); 297 host, ntop, strport);
296 298
297 /* Create a socket for connecting. */ 299 /* Create a socket for connecting. */
298 sock = ssh_create_socket(needpriv, ai->ai_family); 300 sock = ssh_create_socket(needpriv, ai);
299 if (sock < 0) 301 if (sock < 0)
300 /* Any error is already output */ 302 /* Any error is already output */
301 continue; 303 continue;
diff --git a/sshd.c b/sshd.c
index 0f3fbb230..9e2e218c6 100644
--- a/sshd.c
+++ b/sshd.c
@@ -42,7 +42,7 @@
42 */ 42 */
43 43
44#include "includes.h" 44#include "includes.h"
45RCSID("$OpenBSD: sshd.c,v 1.264 2003/04/08 20:21:29 itojun Exp $"); 45RCSID("$OpenBSD: sshd.c,v 1.265 2003/04/14 14:17:50 markus Exp $");
46 46
47#include <openssl/dh.h> 47#include <openssl/dh.h>
48#include <openssl/bn.h> 48#include <openssl/bn.h>
@@ -1153,7 +1153,8 @@ main(int ac, char **av)
1153 continue; 1153 continue;
1154 } 1154 }
1155 /* Create socket for listening. */ 1155 /* Create socket for listening. */
1156 listen_sock = socket(ai->ai_family, SOCK_STREAM, 0); 1156 listen_sock = socket(ai->ai_family, ai->ai_socktype,
1157 ai->ai_protocol);
1157 if (listen_sock < 0) { 1158 if (listen_sock < 0) {
1158 /* kernel may not support ipv6 */ 1159 /* kernel may not support ipv6 */
1159 verbose("socket: %.100s", strerror(errno)); 1160 verbose("socket: %.100s", strerror(errno));