]> andersk Git - gssapi-openssh.git/blobdiff - openssh/readconf.c
merged OpenSSH 5.1p1 to trunk
[gssapi-openssh.git] / openssh / readconf.c
index 81e4f7bf7808b38de7809c81cec0e5130dae8161..791d9e49e7fb5f7afa9fc5cb34607fba358605ee 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: readconf.c,v 1.162 2007/03/20 03:56:12 tedu Exp $ */
+/* $OpenBSD: readconf.c,v 1.167 2008/06/26 11:46:31 grunk Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -134,6 +134,7 @@ typedef enum {
        oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand,
        oNoneEnabled, oTcpRcvBufPoll, oTcpRcvBuf, oNoneSwitch, oHPNDisabled,
        oHPNBufferSize,
+       oVisualHostKey,
        oDeprecated, oUnsupported
 } OpCodes;
 
@@ -240,6 +241,7 @@ static struct {
         { "noneswitch", oNoneSwitch },
        { "hpndisabled", oHPNDisabled },
        { "hpnbuffersize", oHPNBufferSize },
+       { "visualhostkey", oVisualHostKey },
        { NULL, oBadOption }
 };
 
@@ -340,6 +342,7 @@ process_config_line(Options *options, const char *host,
 {
        char *s, **charptr, *endofnumber, *keyword, *arg, *arg2, fwdarg[256];
        int opcode, *intptr, value, value2, scale;
+       LogLevel *log_level_ptr;
        long long orig, val64;
        size_t len;
        Forward fwd;
@@ -510,7 +513,6 @@ parse_flag:
                intptr = &options->verify_host_key_dns;
                goto parse_yesnoask;
 
-
        case oStrictHostKeyChecking:
                intptr = &options->strict_host_key_checking;
 parse_yesnoask:
@@ -552,7 +554,6 @@ parse_yesnoask:
                goto parse_int;
 
        case oRekeyLimit:
-               intptr = &options->rekey_limit;
                arg = strdelim(&s);
                if (!arg || *arg == '\0')
                        fatal("%.200s line %d: Missing argument.", filename, linenum);
@@ -580,14 +581,14 @@ parse_yesnoask:
                }
                val64 *= scale;
                /* detect integer wrap and too-large limits */
-               if ((val64 / scale) != orig || val64 > INT_MAX)
+               if ((val64 / scale) != orig || val64 > UINT_MAX)
                        fatal("%.200s line %d: RekeyLimit too large",
                            filename, linenum);
                if (val64 < 16)
                        fatal("%.200s line %d: RekeyLimit too small",
                            filename, linenum);
-               if (*activep && *intptr == -1)
-                       *intptr = (int)val64;
+               if (*activep && options->rekey_limit == -1)
+                       options->rekey_limit = (u_int32_t)val64;
                break;
 
        case oIdentityFile:
@@ -750,14 +751,14 @@ parse_int:
                break;
 
        case oLogLevel:
-               intptr = (int *) &options->log_level;
+               log_level_ptr = &options->log_level;
                arg = strdelim(&s);
                value = log_level_number(arg);
                if (value == SYSLOG_LEVEL_NOT_SET)
                        fatal("%.200s line %d: unsupported log level '%s'",
                            filename, linenum, arg ? arg : "<NONE>");
-               if (*activep && (LogLevel) *intptr == SYSLOG_LEVEL_NOT_SET)
-                       *intptr = (LogLevel) value;
+               if (*activep && *log_level_ptr == SYSLOG_LEVEL_NOT_SET)
+                       *log_level_ptr = (LogLevel) value;
                break;
 
        case oLocalForward:
@@ -973,6 +974,10 @@ parse_int:
                intptr = &options->permit_local_command;
                goto parse_flag;
 
+       case oVisualHostKey:
+               intptr = &options->visual_host_key;
+               goto parse_flag;
+
        case oDeprecated:
                debug("%s line %d: Deprecated option \"%s\"",
                    filename, linenum, keyword);
@@ -1131,6 +1136,7 @@ initialize_options(Options * options)
        options->hpn_buffer_size = -1;
        options->tcp_rcv_buf_poll = -1;
        options->tcp_rcv_buf = -1;
+       options->visual_host_key = -1;
 }
 
 /*
@@ -1263,21 +1269,23 @@ fill_default_options(Options * options)
                options->hpn_disabled = 0;
        if (options->hpn_buffer_size > -1)
        {
+         /* if a user tries to set the size to 0 set it to 1KB */
                if (options->hpn_buffer_size == 0)
-               options->hpn_buffer_size = 1;
+               options->hpn_buffer_size = 1024;
                /*limit the buffer to 64MB*/
-                       if (options->hpn_buffer_size > 65536)
+               if (options->hpn_buffer_size > 65536)
                {
-                       options->hpn_buffer_size = 65536;
+                       options->hpn_buffer_size = 65536*1024;
                        debug("User requested buffer larger than 64MB. Request reverted to 64MB");
                }
-               options->hpn_buffer_size *=1024;
                debug("hpn_buffer_size set to %d", options->hpn_buffer_size);
        }
        if (options->tcp_rcv_buf == 0)
                options->tcp_rcv_buf = 1;
        if (options->tcp_rcv_buf > -1) 
                options->tcp_rcv_buf *=1024;
+       if (options->tcp_rcv_buf_poll == -1)
+               options->tcp_rcv_buf_poll = 1;
        if (options->control_master == -1)
                options->control_master = 0;
        if (options->hash_known_hosts == -1)
@@ -1290,6 +1298,8 @@ fill_default_options(Options * options)
                options->tun_remote = SSH_TUNID_ANY;
        if (options->permit_local_command == -1)
                options->permit_local_command = 0;
+       if (options->visual_host_key == -1)
+               options->visual_host_key = 0;
        /* options->local_command should not be set by default */
        /* options->proxy_command should not be set by default */
        /* options->user will be set in the main program if appropriate */
@@ -1346,7 +1356,7 @@ parse_forward(Forward *fwd, const char *fwdspec)
 
        xfree(p);
 
-       if (fwd->listen_port == 0 && fwd->connect_port == 0)
+       if (fwd->listen_port == 0 || fwd->connect_port == 0)
                goto fail_free;
 
        if (fwd->connect_host != NULL &&
This page took 0.210327 seconds and 4 git commands to generate.