summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2003-07-03 08:09:07 +0000
committerDamien Miller <djm@cvs.openbsd.org>2003-07-03 08:09:07 +0000
commit85f2c0d9aa83ccdeca222b48cad9ea8b7cf94821 (patch)
tree65cb938219e64ec7543b75b6c80b78171cab9e93
parent54887bfa3ea15dd8f1b0655c7f09958f7af85abb (diff)
fix AddressFamily option in config file, from brent@graveland.net; ok markus@
-rw-r--r--usr.bin/ssh/readconf.c15
-rw-r--r--usr.bin/ssh/readconf.h3
-rw-r--r--usr.bin/ssh/ssh-keysign.c3
-rw-r--r--usr.bin/ssh/ssh.c17
4 files changed, 20 insertions, 18 deletions
diff --git a/usr.bin/ssh/readconf.c b/usr.bin/ssh/readconf.c
index 9c4bd8bf33c..e4d92289855 100644
--- a/usr.bin/ssh/readconf.c
+++ b/usr.bin/ssh/readconf.c
@@ -12,7 +12,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: readconf.c,v 1.113 2003/06/26 20:08:33 markus Exp $");
+RCSID("$OpenBSD: readconf.c,v 1.114 2003/07/03 08:09:05 djm Exp $");
#include "ssh.h"
#include "xmalloc.h"
@@ -286,7 +286,6 @@ process_config_line(Options *options, const char *host,
size_t len;
u_short fwd_port, fwd_host_port;
char sfwd_host_port[6];
- extern int IPv4or6;
/* Strip trailing whitespace */
for(len = strlen(line) - 1; len > 0; len--) {
@@ -725,14 +724,17 @@ parse_int:
case oAddressFamily:
arg = strdelim(&s);
+ intptr = &options->address_family;
if (strcasecmp(arg, "inet") == 0)
- IPv4or6 = AF_INET;
+ value = AF_INET;
else if (strcasecmp(arg, "inet6") == 0)
- IPv4or6 = AF_INET6;
+ value = AF_INET6;
else if (strcasecmp(arg, "any") == 0)
- IPv4or6 = AF_UNSPEC;
+ value = AF_UNSPEC;
else
fatal("Unsupported AddressFamily \"%s\"", arg);
+ if (*activep && *intptr == -1)
+ *intptr = value;
break;
case oEnableSSHKeysign:
@@ -837,6 +839,7 @@ initialize_options(Options * options)
options->keepalives = -1;
options->compression_level = -1;
options->port = -1;
+ options->address_family = -1;
options->connection_attempts = -1;
options->connection_timeout = -1;
options->number_of_password_prompts = -1;
@@ -924,6 +927,8 @@ fill_default_options(Options * options)
options->compression_level = 6;
if (options->port == -1)
options->port = 0; /* Filled in ssh_connect. */
+ if (options->address_family == -1)
+ options->address_family = AF_UNSPEC;
if (options->connection_attempts == -1)
options->connection_attempts = 1;
if (options->number_of_password_prompts == -1)
diff --git a/usr.bin/ssh/readconf.h b/usr.bin/ssh/readconf.h
index c884de68b76..4e0b7431888 100644
--- a/usr.bin/ssh/readconf.h
+++ b/usr.bin/ssh/readconf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: readconf.h,v 1.50 2003/05/15 14:55:25 djm Exp $ */
+/* $OpenBSD: readconf.h,v 1.51 2003/07/03 08:09:06 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -58,6 +58,7 @@ typedef struct {
LogLevel log_level; /* Level for logging. */
int port; /* Port to connect. */
+ int address_family;
int connection_attempts; /* Max attempts (seconds) before
* giving up */
int connection_timeout; /* Max time (seconds) before
diff --git a/usr.bin/ssh/ssh-keysign.c b/usr.bin/ssh/ssh-keysign.c
index f50c3fb6bc4..00c5fb76ab9 100644
--- a/usr.bin/ssh/ssh-keysign.c
+++ b/usr.bin/ssh/ssh-keysign.c
@@ -22,7 +22,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh-keysign.c,v 1.12 2003/05/16 03:27:12 djm Exp $");
+RCSID("$OpenBSD: ssh-keysign.c,v 1.13 2003/07/03 08:09:06 djm Exp $");
#include <openssl/evp.h>
#include <openssl/rand.h>
@@ -44,7 +44,6 @@ RCSID("$OpenBSD: ssh-keysign.c,v 1.12 2003/05/16 03:27:12 djm Exp $");
/* XXX readconf.c needs these */
uid_t original_real_uid;
-int IPv4or6;
static int
valid_request(struct passwd *pw, char *host, Key **ret, u_char *data,
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c
index cb3c1b95362..58ae40bd8a4 100644
--- a/usr.bin/ssh/ssh.c
+++ b/usr.bin/ssh/ssh.c
@@ -40,7 +40,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh.c,v 1.195 2003/07/02 20:37:48 markus Exp $");
+RCSID("$OpenBSD: ssh.c,v 1.196 2003/07/03 08:09:06 djm Exp $");
#include <openssl/evp.h>
#include <openssl/err.h>
@@ -75,10 +75,6 @@ RCSID("$OpenBSD: ssh.c,v 1.195 2003/07/02 20:37:48 markus Exp $");
extern char *__progname;
-/* Flag indicating whether IPv4 or IPv6. This can be set on the command line.
- Default value is AF_UNSPEC means both IPv4 and IPv6. */
-int IPv4or6 = AF_UNSPEC;
-
/* Flag indicating whether debug mode is on. This can be set on the command line. */
int debug_flag = 0;
@@ -271,10 +267,10 @@ again:
options.protocol = SSH_PROTO_2;
break;
case '4':
- IPv4or6 = AF_INET;
+ options.address_family = AF_INET;
break;
case '6':
- IPv4or6 = AF_INET6;
+ options.address_family = AF_INET6;
break;
case 'n':
stdin_null_flag = 1;
@@ -505,7 +501,6 @@ again:
SSLeay_add_all_algorithms();
ERR_load_crypto_strings();
- channel_set_af(IPv4or6);
/* Initialize the command to execute on remote host. */
buffer_init(&command);
@@ -577,6 +572,8 @@ again:
/* Fill configuration defaults. */
fill_default_options(&options);
+ channel_set_af(options.address_family);
+
/* reinit */
log_init(av[0], options.log_level, SYSLOG_FACILITY_USER, 1);
@@ -605,8 +602,8 @@ again:
}
/* Open a connection to the remote host. */
- if (ssh_connect(host, &hostaddr, options.port, IPv4or6,
- options.connection_attempts,
+ if (ssh_connect(host, &hostaddr, options.port,
+ options.address_family, options.connection_attempts,
original_effective_uid == 0 && options.use_privileged_port,
options.proxy_command) != 0)
exit(1);