[BACK]Return to sshconnect2.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/sshconnect2.c between version 1.72.2.4 and 1.72.2.5

version 1.72.2.4, 2002/03/09 00:20:45 version 1.72.2.5, 2002/06/02 22:56:11
Line 172 
Line 172 
 void    input_userauth_error(int, u_int32_t, void *);  void    input_userauth_error(int, u_int32_t, void *);
 void    input_userauth_info_req(int, u_int32_t, void *);  void    input_userauth_info_req(int, u_int32_t, void *);
 void    input_userauth_pk_ok(int, u_int32_t, void *);  void    input_userauth_pk_ok(int, u_int32_t, void *);
   void    input_userauth_passwd_changereq(int, u_int32_t, void *);
   
 int     userauth_none(Authctxt *);  int     userauth_none(Authctxt *);
 int     userauth_pubkey(Authctxt *);  int     userauth_pubkey(Authctxt *);
Line 391 
Line 392 
                         debug("no key from blob. pkalg %s", pkalg);                          debug("no key from blob. pkalg %s", pkalg);
                         break;                          break;
                 }                  }
                 if (key->type != pktype) {                  if (key->type != pktype) {
                         error("input_userauth_pk_ok: type mismatch "                          error("input_userauth_pk_ok: type mismatch "
                             "for decoded key (received %d, expected %d)",                              "for decoded key (received %d, expected %d)",
                              key->type, pktype);                               key->type, pktype);
Line 439 
Line 440 
 userauth_passwd(Authctxt *authctxt)  userauth_passwd(Authctxt *authctxt)
 {  {
         static int attempt = 0;          static int attempt = 0;
         char prompt[80];          char prompt[150];
         char *password;          char *password;
   
         if (attempt++ >= options.number_of_password_prompts)          if (attempt++ >= options.number_of_password_prompts)
Line 461 
Line 462 
         xfree(password);          xfree(password);
         packet_add_padding(64);          packet_add_padding(64);
         packet_send();          packet_send();
   
           dispatch_set(SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ,
               &input_userauth_passwd_changereq);
   
         return 1;          return 1;
 }  }
   /*
    * parse PASSWD_CHANGEREQ, prompt user and send SSH2_MSG_USERAUTH_REQUEST
    */
   void
   input_userauth_passwd_changereq(int type, uint32_t seqnr, void *ctxt)
   {
           Authctxt *authctxt = ctxt;
           char *info, *lang, *password = NULL, *retype = NULL;
           char prompt[150];
   
           debug2("input_userauth_passwd_changereq");
   
           if (authctxt == NULL)
                   fatal("input_userauth_passwd_changereq: "
                       "no authentication context");
   
           info = packet_get_string(NULL);
           lang = packet_get_string(NULL);
           if (strlen(info) > 0)
                   log("%s", info);
           xfree(info);
           xfree(lang);
           packet_start(SSH2_MSG_USERAUTH_REQUEST);
           packet_put_cstring(authctxt->server_user);
           packet_put_cstring(authctxt->service);
           packet_put_cstring(authctxt->method->name);
           packet_put_char(1);                     /* additional info */
           snprintf(prompt, sizeof(prompt),
               "Enter %.30s@%.128s's old password: ",
               authctxt->server_user, authctxt->host);
           password = read_passphrase(prompt, 0);
           packet_put_cstring(password);
           memset(password, 0, strlen(password));
           xfree(password);
           password = NULL;
           while (password == NULL) {
                   snprintf(prompt, sizeof(prompt),
                       "Enter %.30s@%.128s's new password: ",
                       authctxt->server_user, authctxt->host);
                   password = read_passphrase(prompt, RP_ALLOW_EOF);
                   if (password == NULL) {
                           /* bail out */
                           return;
                   }
                   snprintf(prompt, sizeof(prompt),
                       "Retype %.30s@%.128s's new password: ",
                       authctxt->server_user, authctxt->host);
                   retype = read_passphrase(prompt, 0);
                   if (strcmp(password, retype) != 0) {
                           memset(password, 0, strlen(password));
                           xfree(password);
                           log("Mismatch; try again, EOF to quit.");
                           password = NULL;
                   }
                   memset(retype, 0, strlen(retype));
                   xfree(retype);
           }
           packet_put_cstring(password);
           memset(password, 0, strlen(password));
           xfree(password);
           packet_add_padding(64);
           packet_send();
   
           dispatch_set(SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ,
               &input_userauth_passwd_changereq);
   }
   
 static void  static void
 clear_auth_state(Authctxt *authctxt)  clear_auth_state(Authctxt *authctxt)
 {  {
         /* XXX clear authentication state */          /* XXX clear authentication state */
           dispatch_set(SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ, NULL);
   
         if (authctxt->last_key != NULL && authctxt->last_key_hint == -1) {          if (authctxt->last_key != NULL && authctxt->last_key_hint == -1) {
                 debug3("clear_auth_state: key_free %p", authctxt->last_key);                  debug3("clear_auth_state: key_free %p", authctxt->last_key);
                 key_free(authctxt->last_key);                  key_free(authctxt->last_key);

Legend:
Removed from v.1.72.2.4  
changed lines
  Added in v.1.72.2.5