summaryrefslogtreecommitdiff
path: root/sshconnect.c
diff options
context:
space:
mode:
authordjm <djm>2003-05-14 03:42:23 +0000
committerdjm <djm>2003-05-14 03:42:23 +0000
commit078edf17acd9a3f8a3418193af7dcb9e4174300e (patch)
treedb8117bc6b7e871e2d8a094534988c330280d202 /sshconnect.c
parent63a8273f0e0f0b4b0da4225670e42363f6d1c80a (diff)
downloadopenssh-078edf17acd9a3f8a3418193af7dcb9e4174300e.tar.gz
- 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
Diffstat (limited to 'sshconnect.c')
-rw-r--r--sshconnect.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/sshconnect.c b/sshconnect.c
index 16db13fa..33d9c727 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -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 @@ ssh_proxy_connect(const char *host, u_short port, const char *proxy_command)
* 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 @@ ssh_create_socket(int privileged, int family)
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 @@ ssh_create_socket(int privileged, int family)
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 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr,
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;