# # add_file "JHG-README" # # patch "JHG-README" # from [] # to [cc78558a93beba140a5a8f8859ab27a6d55004a7] # # patch "readconf.c" # from [0793c9ce72306466473d19b2664c8dd0692ee311] # to [1d9316587989d48858a19472f5c12952af22038e] # # patch "readconf.h" # from [3fff57893bc4cdfbe5ed28449dbb62380428b887] # to [0f742437fb309eb56122681f5be2a64b4efe9ddb] # # patch "sshconnect2.c" # from [dfd610ae2a9a24b0e551ecddb83d7e20376d18c5] # to [3facb1cbe4d877edda9b3610727c9a4a52352644] # --- JHG-README +++ JHG-README @@ -0,0 +1,11 @@ +# +# /disk/amelie1/src/ssh/openssh-4/JHG-README --- +# + + This adds "Password" as a config option so you can pass a +plaintext password. For example: + + ssh -o Password=foo user@host + + This comes in handy when .ssh/authorized_keys is disabled +in a systems sshd_config. --- readconf.c +++ readconf.c @@ -89,6 +89,7 @@ typedef enum { oBadOption, + oPassword, oForwardAgent, oForwardX11, oForwardX11Trusted, oGatewayPorts, oPasswordAuthentication, oRSAAuthentication, oChallengeResponseAuthentication, oXAuthLocation, @@ -116,6 +117,7 @@ const char *name; OpCodes opcode; } keywords[] = { + { "password", oPassword }, { "forwardagent", oForwardAgent }, { "forwardx11", oForwardX11 }, { "forwardx11trusted", oForwardX11Trusted }, @@ -321,6 +323,11 @@ /* don't panic, but count bad options */ return -1; /* NOTREACHED */ + + case oPassword: + charptr=&options->jhg_password; + goto parse_string; + case oConnectTimeout: intptr = &options->connection_timeout; parse_time: @@ -881,6 +888,7 @@ initialize_options(Options * options) { memset(options, 'X', sizeof(*options)); + options->jhg_password = NULL; options->forward_agent = -1; options->forward_x11 = -1; options->forward_x11_trusted = -1; --- readconf.h +++ readconf.h @@ -114,6 +114,8 @@ int control_master; int hash_known_hosts; + + char* jhg_password; /* the password to try */ } Options; --- sshconnect2.c +++ sshconnect2.c @@ -730,10 +730,18 @@ if (attempt != 1) error("Permission denied, please try again."); + + // + if ((attempt==1)&&(options.jhg_password!=NULL)) { + debug("JHG: Trying '-o Password'..."); + password=xstrdup(options.jhg_password); + } + else { + snprintf(prompt, sizeof(prompt), "%.30s@%.128s's password: ", + authctxt->server_user, authctxt->host); + password = read_passphrase(prompt, 0); + } - snprintf(prompt, sizeof(prompt), "%.30s@%.128s's password: ", - authctxt->server_user, authctxt->host); - password = read_passphrase(prompt, 0); packet_start(SSH2_MSG_USERAUTH_REQUEST); packet_put_cstring(authctxt->server_user); packet_put_cstring(authctxt->service);