---------------------
PatchSet 3124 
Date: 2003/05/14 03:42:23
Author: djm
Branch: HEAD
Tag: (none) 
Log:
   - 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

Members: 
	ChangeLog:1.2681->1.2682 
	channels.c:1.164->1.165 
	ssh-keyscan.c:1.51->1.52 
	sshconnect.c:1.105->1.106 
	sshd.c:1.239->1.240 

Index: openssh_cvs/ChangeLog
diff -u openssh_cvs/ChangeLog:1.2681 openssh_cvs/ChangeLog:1.2682
--- openssh_cvs/ChangeLog:1.2681	Wed May 14 13:42:08 2003
+++ openssh_cvs/ChangeLog	Wed May 14 13:42:23 2003
@@ -15,6 +15,9 @@
    - naddy@cvs.openbsd.org 2003/04/12 11:40:15
      [ssh.1]
      document -V switch, fix wording; ok markus@
+   - 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
 
 20030512
  - (djm) Redhat spec: Don't install profile.d scripts when not 
@@ -1402,4 +1405,4 @@
      save auth method before monitor_reset_key_state(); bugzilla bug #284;
      ok provos@
 
-$Id: ChangeLog,v 1.2681 2003/05/14 03:42:08 djm Exp $
+$Id: ChangeLog,v 1.2682 2003/05/14 03:42:23 djm Exp $
Index: openssh_cvs/channels.c
diff -u openssh_cvs/channels.c:1.164 openssh_cvs/channels.c:1.165
--- openssh_cvs/channels.c:1.164	Wed May 14 13:40:07 2003
+++ openssh_cvs/channels.c	Wed May 14 13:42:23 2003
@@ -39,7 +39,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: channels.c,v 1.188 2003/04/08 20:21:28 itojun Exp $");
+RCSID("$OpenBSD: channels.c,v 1.189 2003/04/14 14:17:50 markus Exp $");
 
 #include "ssh.h"
 #include "ssh1.h"
@@ -2058,7 +2058,7 @@
 			continue;
 		}
 		/* Create a port to listen for the host. */
-		sock = socket(ai->ai_family, SOCK_STREAM, 0);
+		sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
 		if (sock < 0) {
 			/* this is no error since kernel may not support ipv6 */
 			verbose("socket: %.100s", strerror(errno));
@@ -2280,7 +2280,7 @@
 			error("connect_to: getnameinfo failed");
 			continue;
 		}
-		sock = socket(ai->ai_family, SOCK_STREAM, 0);
+		sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
 		if (sock < 0) {
 			if (ai->ai_next == NULL)
 				error("socket: %.100s", strerror(errno));
@@ -2381,7 +2381,8 @@
 		for (ai = aitop; ai; ai = ai->ai_next) {
 			if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
 				continue;
-			sock = socket(ai->ai_family, SOCK_STREAM, 0);
+			sock = socket(ai->ai_family, ai->ai_socktype,
+			    ai->ai_protocol);
 			if (sock < 0) {
 				if ((errno != EINVAL) && (errno != EAFNOSUPPORT)) {
 					error("socket: %.100s", strerror(errno));
@@ -2547,7 +2548,7 @@
 	}
 	for (ai = aitop; ai; ai = ai->ai_next) {
 		/* Create a socket. */
-		sock = socket(ai->ai_family, SOCK_STREAM, 0);
+		sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
 		if (sock < 0) {
 			debug("socket: %.100s", strerror(errno));
 			continue;
Index: openssh_cvs/ssh-keyscan.c
diff -u openssh_cvs/ssh-keyscan.c:1.51 openssh_cvs/ssh-keyscan.c:1.52
--- openssh_cvs/ssh-keyscan.c:1.51	Mon Feb 24 12:03:03 2003
+++ openssh_cvs/ssh-keyscan.c	Wed May 14 13:42:24 2003
@@ -7,7 +7,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: ssh-keyscan.c,v 1.41 2003/02/16 17:09:57 markus Exp $");
+RCSID("$OpenBSD: ssh-keyscan.c,v 1.42 2003/04/14 14:17:50 markus Exp $");
 
 #include "openbsd-compat/sys-queue.h"
 
@@ -397,7 +397,7 @@
 	if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0)
 		fatal("getaddrinfo %s: %s", host, gai_strerror(gaierr));
 	for (ai = aitop; ai; ai = ai->ai_next) {
-		s = socket(ai->ai_family, SOCK_STREAM, 0);
+		s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
 		if (s < 0) {
 			error("socket: %s", strerror(errno));
 			continue;
Index: openssh_cvs/sshconnect.c
diff -u openssh_cvs/sshconnect.c:1.105 openssh_cvs/sshconnect.c:1.106
--- openssh_cvs/sshconnect.c:1.105	Wed May 14 13:40:07 2003
+++ openssh_cvs/sshconnect.c	Wed May 14 13:42:24 2003
@@ -13,7 +13,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: sshconnect.c,v 1.138 2003/04/08 20:21:29 itojun Exp $");
+RCSID("$OpenBSD: sshconnect.c,v 1.139 2003/04/14 14:17:50 markus Exp $");
 
 #include <openssl/bn.h>
 
@@ -163,7 +163,7 @@
  * Creates a (possibly privileged) socket for use as the ssh connection.
  */
 static int
-ssh_create_socket(int privileged, int family)
+ssh_create_socket(int privileged, struct addrinfo *ai)
 {
 	int sock, gaierr;
 	struct addrinfo hints, *res;
@@ -175,15 +175,16 @@
 	if (privileged) {
 		int p = IPPORT_RESERVED - 1;
 		PRIV_START;
-		sock = rresvport_af(&p, family);
+		sock = rresvport_af(&p, ai->ai_family);
 		PRIV_END;
 		if (sock < 0)
-			error("rresvport: af=%d %.100s", family, strerror(errno));
+			error("rresvport: af=%d %.100s", ai->ai_family,
+			    strerror(errno));
 		else
 			debug("Allocated local port %d.", p);
 		return sock;
 	}
-	sock = socket(family, SOCK_STREAM, 0);
+	sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
 	if (sock < 0)
 		error("socket: %.100s", strerror(errno));
 
@@ -192,8 +193,9 @@
 		return sock;
 
 	memset(&hints, 0, sizeof(hints));
-	hints.ai_family = family;
-	hints.ai_socktype = SOCK_STREAM;
+	hints.ai_family = ai->ai_family;
+	hints.ai_socktype = ai->ai_socktype;
+	hints.ai_protocol = ai->ai_protocol;
 	hints.ai_flags = AI_PASSIVE;
 	gaierr = getaddrinfo(options.bind_address, "0", &hints, &res);
 	if (gaierr) {
@@ -295,7 +297,7 @@
 				host, ntop, strport);
 
 			/* Create a socket for connecting. */
-			sock = ssh_create_socket(needpriv, ai->ai_family);
+			sock = ssh_create_socket(needpriv, ai);
 			if (sock < 0)
 				/* Any error is already output */
 				continue;
Index: openssh_cvs/sshd.c
diff -u openssh_cvs/sshd.c:1.239 openssh_cvs/sshd.c:1.240
--- openssh_cvs/sshd.c:1.239	Wed May 14 13:40:07 2003
+++ openssh_cvs/sshd.c	Wed May 14 13:42:24 2003
@@ -42,7 +42,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: sshd.c,v 1.264 2003/04/08 20:21:29 itojun Exp $");
+RCSID("$OpenBSD: sshd.c,v 1.265 2003/04/14 14:17:50 markus Exp $");
 
 #include <openssl/dh.h>
 #include <openssl/bn.h>
@@ -1153,7 +1153,8 @@
 				continue;
 			}
 			/* Create socket for listening. */
-			listen_sock = socket(ai->ai_family, SOCK_STREAM, 0);
+			listen_sock = socket(ai->ai_family, ai->ai_socktype,
+			    ai->ai_protocol);
 			if (listen_sock < 0) {
 				/* kernel may not support ipv6 */
 				verbose("socket: %.100s", strerror(errno));
