]> andersk Git - openssh.git/blobdiff - readconf.c
- (djm) [README README.privsep] Mention FreeBSD and NetBSD as being
[openssh.git] / readconf.c
index c3dc71e66c9d9a560382ecb5660d19d74c7f675d..d41220807ad0df0d9d38b969a2d477cb9b36af59 100644 (file)
@@ -12,7 +12,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: readconf.c,v 1.135 2005/03/01 10:09:52 djm Exp $");
+RCSID("$OpenBSD: readconf.c,v 1.140 2005/05/16 15:30:51 markus Exp $");
 
 #include "ssh.h"
 #include "xmalloc.h"
@@ -106,7 +106,7 @@ typedef enum {
        oEnableSSHKeysign, oRekeyLimit, oVerifyHostKeyDNS, oConnectTimeout,
        oAddressFamily, oGssAuthentication, oGssDelegateCreds,
        oServerAliveInterval, oServerAliveCountMax, oIdentitiesOnly,
-       oSendEnv, oControlPath, oControlMaster,
+       oSendEnv, oControlPath, oControlMaster, oHashKnownHosts,
        oDeprecated, oUnsupported
 } OpCodes;
 
@@ -197,6 +197,7 @@ static struct {
        { "sendenv", oSendEnv },
        { "controlpath", oControlPath },
        { "controlmaster", oControlMaster },
+       { "hashknownhosts", oHashKnownHosts },
        { NULL, oBadOption }
 };
 
@@ -252,12 +253,14 @@ clear_forwardings(Options *options)
        int i;
 
        for (i = 0; i < options->num_local_forwards; i++) {
-               xfree(options->local_forwards[i].listen_host);
+               if (options->local_forwards[i].listen_host != NULL)
+                       xfree(options->local_forwards[i].listen_host);
                xfree(options->local_forwards[i].connect_host);
        }
        options->num_local_forwards = 0;
        for (i = 0; i < options->num_remote_forwards; i++) {
-               xfree(options->remote_forwards[i].listen_host);
+               if (options->remote_forwards[i].listen_host != NULL)
+                       xfree(options->remote_forwards[i].listen_host);
                xfree(options->remote_forwards[i].connect_host);
        }
        options->num_remote_forwards = 0;
@@ -298,7 +301,7 @@ process_config_line(Options *options, const char *host,
        Forward fwd;
 
        /* Strip trailing whitespace */
-       for(len = strlen(line) - 1; len > 0; len--) {
+       for (len = strlen(line) - 1; len > 0; len--) {
                if (strchr(WHITESPACE, line[len]) == NULL)
                        break;
                line[len] = '\0';
@@ -740,6 +743,9 @@ parse_int:
 
        case oAddressFamily:
                arg = strdelim(&s);
+               if (!arg || *arg == '\0')
+                       fatal("%s line %d: missing address family.",
+                           filename, linenum);
                intptr = &options->address_family;
                if (strcasecmp(arg, "inet") == 0)
                        value = AF_INET;
@@ -774,6 +780,8 @@ parse_int:
                        if (strchr(arg, '=') != NULL)
                                fatal("%s line %d: Invalid environment name.",
                                    filename, linenum);
+                       if (!*activep)
+                               continue;
                        if (options->num_send_env >= MAX_SEND_ENV)
                                fatal("%s line %d: too many send env.",
                                    filename, linenum);
@@ -790,6 +798,10 @@ parse_int:
                intptr = &options->control_master;
                goto parse_yesnoask;
 
+       case oHashKnownHosts:
+               intptr = &options->hash_known_hosts;
+               goto parse_flag;
+
        case oDeprecated:
                debug("%s line %d: Deprecated option \"%s\"",
                    filename, linenum, keyword);
@@ -933,6 +945,7 @@ initialize_options(Options * options)
        options->num_send_env = 0;
        options->control_path = NULL;
        options->control_master = -1;
+       options->hash_known_hosts = -1;
 }
 
 /*
@@ -1055,6 +1068,8 @@ fill_default_options(Options * options)
                options->server_alive_count_max = 3;
        if (options->control_master == -1)
                options->control_master = 0;
+       if (options->hash_known_hosts == -1)
+               options->hash_known_hosts = 0;
        /* options->proxy_command should not be set by default */
        /* options->user will be set in the main program if appropriate */
        /* options->hostname will be set in the main program if appropriate */
This page took 0.214005 seconds and 4 git commands to generate.