]> andersk Git - openssh.git/blobdiff - readconf.c
- (tim) [configure.ac auth.c defines.h session.c openbsd-compat/port-uw.c
[openssh.git] / readconf.c
index 7173a8c2328860287eb951be34dcfd7ced76f988..cf27a9f4107e842b4c642f587fbda3d101631465 100644 (file)
@@ -12,7 +12,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: readconf.c,v 1.137 2005/03/04 08:48:06 djm Exp $");
+RCSID("$OpenBSD: readconf.c,v 1.143 2005/07/30 02:03:47 djm Exp $");
 
 #include "ssh.h"
 #include "xmalloc.h"
@@ -253,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;
@@ -299,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';
@@ -693,7 +695,7 @@ parse_int:
                        fwd.listen_host = cleanhostname(fwd.listen_host);
                } else {
                        fwd.listen_port = a2port(fwd.listen_host);
-                       fwd.listen_host = "";
+                       fwd.listen_host = NULL;
                }
                if (fwd.listen_port == 0)
                        fatal("%.200s line %d: Badly formatted port number.",
@@ -741,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;
@@ -791,7 +796,27 @@ parse_int:
 
        case oControlMaster:
                intptr = &options->control_master;
-               goto parse_yesnoask;
+               arg = strdelim(&s);
+               if (!arg || *arg == '\0')
+                       fatal("%.200s line %d: Missing ControlMaster argument.",
+                           filename, linenum);
+               value = 0;      /* To avoid compiler warning... */
+               if (strcmp(arg, "yes") == 0 || strcmp(arg, "true") == 0)
+                       value = SSHCTL_MASTER_YES;
+               else if (strcmp(arg, "no") == 0 || strcmp(arg, "false") == 0)
+                       value = SSHCTL_MASTER_NO;
+               else if (strcmp(arg, "auto") == 0)
+                       value = SSHCTL_MASTER_AUTO;
+               else if (strcmp(arg, "ask") == 0)
+                       value = SSHCTL_MASTER_ASK;
+               else if (strcmp(arg, "autoask") == 0)
+                       value = SSHCTL_MASTER_AUTO_ASK;
+               else
+                       fatal("%.200s line %d: Bad ControlMaster argument.",
+                           filename, linenum);
+               if (*activep && *intptr == -1)
+                       *intptr = value;
+               break;
 
        case oHashKnownHosts:
                intptr = &options->hash_known_hosts;
@@ -814,7 +839,7 @@ parse_int:
        /* Check that there is no garbage at end of line. */
        if ((arg = strdelim(&s)) != NULL && *arg != '\0') {
                fatal("%.200s line %d: garbage at end of line; \"%.200s\".",
-                    filename, linenum, arg);
+                   filename, linenum, arg);
        }
        return 0;
 }
This page took 0.039425 seconds and 4 git commands to generate.