X-Git-Url: http://andersk.mit.edu/gitweb/gssapi-openssh.git/blobdiff_plain/f713db997ba7f0ace8d4aa119ba7711614828de9..11b9ed8c1308eeb64a90aacb19bcad99aa7812ba:/openssh/readconf.c diff --git a/openssh/readconf.c b/openssh/readconf.c index de7635e..dce06dc 100644 --- a/openssh/readconf.c +++ b/openssh/readconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: readconf.c,v 1.159 2006/08/03 03:34:42 deraadt Exp $ */ +/* $OpenBSD: readconf.c,v 1.165 2008/01/19 23:09:49 djm Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -340,6 +340,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; @@ -378,7 +379,7 @@ parse_time: if ((value = convtime(arg)) == -1) fatal("%s line %d: invalid time value.", filename, linenum); - if (*intptr == -1) + if (*activep && *intptr == -1) *intptr = value; break; @@ -478,10 +479,21 @@ parse_flag: case oNoneEnabled: intptr = &options->none_enabled; goto parse_flag; - + + /* we check to see if the command comes from the */ + /* command line or not. If it does then enable it */ + /* otherwise fail. NONE should never be a default configuration */ case oNoneSwitch: - intptr = &options->none_switch; - goto parse_flag; + if(strcmp(filename,"command-line")==0) + { + intptr = &options->none_switch; + goto parse_flag; + } else { + error("NoneSwitch is found in %.200s.\nYou may only use this configuration option from the command line", filename); + error("Continuing..."); + debug("NoneSwitch directive found in %.200s.", filename); + return 0; + } case oHPNDisabled: intptr = &options->hpn_disabled; @@ -499,7 +511,6 @@ parse_flag: intptr = &options->verify_host_key_dns; goto parse_yesnoask; - case oStrictHostKeyChecking: intptr = &options->strict_host_key_checking; parse_yesnoask: @@ -541,7 +552,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); @@ -569,14 +579,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: @@ -588,7 +598,7 @@ parse_yesnoask: if (*intptr >= SSH_MAX_IDENTITY_FILES) fatal("%.200s line %d: Too many identity files specified (max %d).", filename, linenum, SSH_MAX_IDENTITY_FILES); - charptr = &options->identity_files[*intptr]; + charptr = &options->identity_files[*intptr]; *charptr = xstrdup(arg); *intptr = *intptr + 1; } @@ -739,14 +749,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 : ""); - 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: @@ -1252,21 +1262,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; - /*limit the buffer to 7MB*/ - if (options->hpn_buffer_size > 7168) + options->hpn_buffer_size = 1024; + /*limit the buffer to 64MB*/ + if (options->hpn_buffer_size > 65536) { - options->hpn_buffer_size = 7168; - debug("User requested buffer larger than 7MB. Request reverted to 7MB"); + 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) @@ -1304,7 +1316,7 @@ parse_forward(Forward *fwd, const char *fwdspec) cp = p = xstrdup(fwdspec); /* skip leading spaces */ - while (*cp && isspace(*cp)) + while (isspace(*cp)) cp++; for (i = 0; i < 4; ++i) @@ -1335,7 +1347,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 &&