Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/crypto/dist/ssh avoid hardcoded SOCK_xx; with markus; should...
details: https://anonhg.NetBSD.org/src/rev/5aad06d2b872
branches: trunk
changeset: 545686:5aad06d2b872
user: itojun <itojun%NetBSD.org@localhost>
date: Mon Apr 14 14:36:47 2003 +0000
description:
avoid hardcoded SOCK_xx; with markus; should allow ssh over SCTP
diffstat:
crypto/dist/ssh/channels.c | 11 ++++++-----
crypto/dist/ssh/ssh-keyscan.c | 4 ++--
crypto/dist/ssh/sshconnect.c | 18 ++++++++++--------
crypto/dist/ssh/sshd.c | 5 +++--
4 files changed, 21 insertions(+), 17 deletions(-)
diffs (142 lines):
diff -r 2da0ddf779cf -r 5aad06d2b872 crypto/dist/ssh/channels.c
--- a/crypto/dist/ssh/channels.c Mon Apr 14 14:20:10 2003 +0000
+++ b/crypto/dist/ssh/channels.c Mon Apr 14 14:36:47 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: channels.c,v 1.27 2003/04/03 06:21:32 itojun Exp $ */
+/* $NetBSD: channels.c,v 1.28 2003/04/14 14:36:47 itojun Exp $ */
/*
* Author: Tatu Ylonen <ylo%cs.hut.fi@localhost>
* Copyright (c) 1995 Tatu Ylonen <ylo%cs.hut.fi@localhost>, Espoo, Finland
@@ -2054,7 +2054,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));
@@ -2270,7 +2270,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));
@@ -2371,7 +2371,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) {
error("socket: %.100s", strerror(errno));
return -1;
@@ -2515,7 +2516,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;
diff -r 2da0ddf779cf -r 5aad06d2b872 crypto/dist/ssh/ssh-keyscan.c
--- a/crypto/dist/ssh/ssh-keyscan.c Mon Apr 14 14:20:10 2003 +0000
+++ b/crypto/dist/ssh/ssh-keyscan.c Mon Apr 14 14:36:47 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ssh-keyscan.c,v 1.18 2003/04/03 06:21:36 itojun Exp $ */
+/* $NetBSD: ssh-keyscan.c,v 1.19 2003/04/14 14:36:48 itojun Exp $ */
/*
* Copyright 1995, 1996 by David Mazieres <dm%lcs.mit.edu@localhost>.
*
@@ -379,7 +379,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;
diff -r 2da0ddf779cf -r 5aad06d2b872 crypto/dist/ssh/sshconnect.c
--- a/crypto/dist/ssh/sshconnect.c Mon Apr 14 14:20:10 2003 +0000
+++ b/crypto/dist/ssh/sshconnect.c Mon Apr 14 14:36:47 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sshconnect.c,v 1.26 2003/04/03 06:21:36 itojun Exp $ */
+/* $NetBSD: sshconnect.c,v 1.27 2003/04/14 14:36:48 itojun Exp $ */
/*
* Author: Tatu Ylonen <ylo%cs.hut.fi@localhost>
* Copyright (c) 1995 Tatu Ylonen <ylo%cs.hut.fi@localhost>, Espoo, Finland
@@ -160,7 +160,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;
@@ -172,15 +172,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));
@@ -189,8 +190,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) {
@@ -292,7 +294,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;
diff -r 2da0ddf779cf -r 5aad06d2b872 crypto/dist/ssh/sshd.c
--- a/crypto/dist/ssh/sshd.c Mon Apr 14 14:20:10 2003 +0000
+++ b/crypto/dist/ssh/sshd.c Mon Apr 14 14:36:47 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sshd.c,v 1.28 2003/04/03 06:21:37 itojun Exp $ */
+/* $NetBSD: sshd.c,v 1.29 2003/04/14 14:36:48 itojun Exp $ */
/*
* Author: Tatu Ylonen <ylo%cs.hut.fi@localhost>
* Copyright (c) 1995 Tatu Ylonen <ylo%cs.hut.fi@localhost>, Espoo, Finland
@@ -1099,7 +1099,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));
Home |
Main Index |
Thread Index |
Old Index