]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Delay evaluating the "-pw" option, so we can criticise the user's choice of
authorJacob Nevins <jacobn@chiark.greenend.org.uk>
Sun, 25 Feb 2007 00:51:38 +0000 (00:51 +0000)
committerJacob Nevins <jacobn@chiark.greenend.org.uk>
Sun, 25 Feb 2007 00:51:38 +0000 (00:51 +0000)
backend, bailing out if anything other than SSH is in use.

[originally from svn r7322]

cmdline.c

index 3e890b78fe8b0fc79b118f065db4bec527f3d1a7..bdfa1aa2c60a6b6c7488dad9ce19535c62aae01e 100644 (file)
--- a/cmdline.c
+++ b/cmdline.c
@@ -315,7 +315,14 @@ int cmdline_process_param(char *p, char *value, int need_save, Config *cfg)
     if (!strcmp(p, "-pw")) {
        RETURN(2);
        UNAVAILABLE_IN(TOOLTYPE_NONNETWORK);
-       cmdline_password = value;
+       SAVEABLE(1);
+       /* We delay evaluating this until after the protocol is decided,
+        * so that we can warn if it's of no use with the selected protocol */
+       if (cfg->protocol != PROT_SSH)
+           cmdline_error("The -pw option can only be used with the "
+                         "SSH protocol");
+       else
+           cmdline_password = value;
     }
 
     if (!strcmp(p, "-agent") || !strcmp(p, "-pagent") ||