diff -Naur ../openssh-4.9p1/readconf.c ./readconf.c --- ../openssh-4.9p1/readconf.c 2008-02-10 12:25:52.000000000 +0100 +++ ./readconf.c 2008-07-07 09:52:20.000000000 +0200 @@ -1065,6 +1065,7 @@ options->tun_remote = -1; options->local_command = NULL; options->permit_local_command = -1; + options->password = NULL; } /* diff -Naur ../openssh-4.9p1/readconf.h ./readconf.h --- ../openssh-4.9p1/readconf.h 2008-02-10 12:25:52.000000000 +0100 +++ ./readconf.h 2008-07-07 09:52:23.000000000 +0200 @@ -120,6 +120,7 @@ char *local_command; int permit_local_command; + char *password; } Options; diff -Naur ../openssh-4.9p1/ssh.c ./ssh.c --- ../openssh-4.9p1/ssh.c 2008-02-28 09:13:52.000000000 +0100 +++ ./ssh.c 2008-07-07 09:52:31.000000000 +0200 @@ -190,7 +190,7 @@ " [-D [bind_address:]port] [-e escape_char] [-F configfile]\n" " [-i identity_file] [-L [bind_address:]port:host:hostport]\n" " [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]\n" -" [-R [bind_address:]port:host:hostport] [-S ctl_path]\n" +" [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W password]\n" " [-w local_tun[:remote_tun]] [user@]hostname [command]\n" ); exit(255); @@ -273,7 +273,7 @@ again: while ((opt = getopt(ac, av, - "1246ab:c:e:fgi:kl:m:no:p:qstvxACD:F:I:KL:MNO:PR:S:TVw:XY")) != -1) { + "1246ab:c:e:fgi:kl:m:no:p:qstvxACD:F:I:KL:MNO:PR:S:TVw:W:XY")) != -1) { switch (opt) { case '1': options.protocol = SSH_PROTO_1; @@ -528,6 +528,9 @@ case 'F': config = optarg; break; + case 'W': + options.password = optarg; + break; default: usage(); } diff -Naur ../openssh-4.9p1/sshconnect2.c ./sshconnect2.c --- ../openssh-4.9p1/sshconnect2.c 2008-02-10 12:25:53.000000000 +0100 +++ ./sshconnect2.c 2008-07-07 09:52:35.000000000 +0200 @@ -744,9 +744,16 @@ if (attempt != 1) error("Permission denied, please try again."); - snprintf(prompt, sizeof(prompt), "%.30s@%.128s's password: ", - authctxt->server_user, authctxt->host); - password = read_passphrase(prompt, 0); + if (options.password == NULL) { + snprintf(prompt, sizeof(prompt), "%.30s@%.128s's password: ", + authctxt->server_user, authctxt->host); + password = read_passphrase(prompt, 0); + } + else { + password = malloc(strlen(options.password) + 1); + strcpy(password, options.password); + } + packet_start(SSH2_MSG_USERAUTH_REQUEST); packet_put_cstring(authctxt->server_user); packet_put_cstring(authctxt->service);