Develop and Download Open Source Software

Browse Subversion Repository

Diff of /branches/ssh_chacha20poly1305/ttssh2/ttxssh/auth.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2752 by yutakakn, Thu Dec 16 13:01:09 2004 UTC revision 2762 by yutakakn, Wed Dec 22 17:28:14 2004 UTC
# Line 249  static int get_key_file_name(HWND parent Line 249  static int get_key_file_name(HWND parent
249          OPENFILENAME params;          OPENFILENAME params;
250          char fullname_buf[2048] = "identity";          char fullname_buf[2048] = "identity";
251    
252            ZeroMemory(&params, sizeof(params));
253          params.lStructSize = sizeof(OPENFILENAME);          params.lStructSize = sizeof(OPENFILENAME);
254          params.hwndOwner = parent;          params.hwndOwner = parent;
255          params.lpstrFilter = NULL;          // フィルタの追加 (2004.12.19 yutaka)
256            params.lpstrFilter = "identity(RSA1)\0identity\0id_rsa(SSH2)\0id_rsa\0id_dsa(SSH2)\0id_dsa\0all(*.*)\0*.*\0\0";
257          params.lpstrCustomFilter = NULL;          params.lpstrCustomFilter = NULL;
258          params.nFilterIndex = 0;          params.nFilterIndex = 0;
259          buf[0] = 0;          buf[0] = 0;
# Line 321  static BOOL end_auth_dlg(PTInstVar pvar, Line 323  static BOOL end_auth_dlg(PTInstVar pvar,
323                  GetDlgItemText(dlg, file_ctl_ID, buf, sizeof(buf));                  GetDlgItemText(dlg, file_ctl_ID, buf, sizeof(buf));
324                  if (buf[0] == 0) {                  if (buf[0] == 0) {
325                          notify_nonfatal_error(pvar,                          notify_nonfatal_error(pvar,
326                                                                    "You must specify a file containing the RSA private key.");                                                                    "You must specify a file containing the RSA/DSA private key.");
327                          SetFocus(GetDlgItem(dlg, file_ctl_ID));                          SetFocus(GetDlgItem(dlg, file_ctl_ID));
328                          destroy_malloced_string(&password);                          destroy_malloced_string(&password);
329                          return FALSE;                          return FALSE;
330                  } else {                  }
331                    
332                    if (SSHv1(pvar)) {
333                          BOOL invalid_passphrase = FALSE;                          BOOL invalid_passphrase = FALSE;
334    
335                          key_pair = KEYFILES_read_private_key(pvar, buf, password,                          key_pair = KEYFILES_read_private_key(pvar, buf, password,
# Line 344  static BOOL end_auth_dlg(PTInstVar pvar, Line 348  static BOOL end_auth_dlg(PTInstVar pvar,
348                                  destroy_malloced_string(&password);                                  destroy_malloced_string(&password);
349                                  return FALSE;                                  return FALSE;
350                          }                          }
351    
352                    } else { // SSH2(yutaka)
353                            BOOL invalid_passphrase = FALSE;
354    
355                            key_pair = read_SSH2_private_key(pvar, buf, password,
356                                                                            &invalid_passphrase,
357                                                                            FALSE);
358    
359                            if (key_pair == NULL) { // read error
360                                    notify_nonfatal_error(pvar, "read error SSH2 private key file");
361                                    destroy_malloced_string(&password);
362                                    return FALSE;
363                            }
364    
365                  }                  }
366    
367          }          }
368    
369          /* from here on, we cannot fail, so just munge cur_cred in place */          /* from here on, we cannot fail, so just munge cur_cred in place */
# Line 490  int AUTH_set_supported_auth_types(PTInst Line 509  int AUTH_set_supported_auth_types(PTInst
509                          | (1 << SSH_AUTH_TIS);                          | (1 << SSH_AUTH_TIS);
510          } else {          } else {
511                  // for SSH2(yutaka)                  // for SSH2(yutaka)
512                  types &= (1 << SSH_AUTH_PASSWORD);  //              types &= (1 << SSH_AUTH_PASSWORD);
513  //              types &= (1 << SSH_AUTH_PASSWORD) | (1 << SSH_AUTH_RSA)                  // 公開鍵認証を有効にする (2004.12.18 yutaka)
514  //                      | (1 << SSH_AUTH_DSA);                  types &= (1 << SSH_AUTH_PASSWORD) | (1 << SSH_AUTH_RSA)
515                            | (1 << SSH_AUTH_DSA);
516          }          }
517          pvar->auth_state.supported_types = types;          pvar->auth_state.supported_types = types;
518    
# Line 895  void AUTH_get_auth_info(PTInstVar pvar, Line 915  void AUTH_get_auth_info(PTInstVar pvar,
915          if (pvar->auth_state.user == NULL) {          if (pvar->auth_state.user == NULL) {
916                  strncpy(dest, "None", len);                  strncpy(dest, "None", len);
917          } else if (pvar->auth_state.cur_cred.method != SSH_AUTH_NONE) {          } else if (pvar->auth_state.cur_cred.method != SSH_AUTH_NONE) {
918                  _snprintf(dest, len, "User '%s', using %s", pvar->auth_state.user,                  if (SSHv1(pvar)) {
919                                    get_auth_method_name(pvar->auth_state.cur_cred.method));                          _snprintf(dest, len, "User '%s', using %s", pvar->auth_state.user,
920                                            get_auth_method_name(pvar->auth_state.cur_cred.method));
921    
922                    } else { // SSH2:認証メソッドの判別 (2004.12.23 yutaka)
923                            if (pvar->auth_state.cur_cred.method == SSH_AUTH_PASSWORD) {
924                                    _snprintf(dest, len, "User '%s', using %s", pvar->auth_state.user,
925                                                    get_auth_method_name(pvar->auth_state.cur_cred.method));
926                            } else {
927                                    char *method = "unknown";
928                                    if (pvar->auth_state.cur_cred.key_pair->RSA_key != NULL) {
929                                            method = "RSA";
930                                    } else if (pvar->auth_state.cur_cred.key_pair->DSA_key != NULL) {
931                                            method = "DSA";
932                                    }
933                                    _snprintf(dest, len, "User '%s', using %s", pvar->auth_state.user, method);
934                            }
935    
936                    }
937    
938          } else {          } else {
939                  _snprintf(dest, len, "User '%s', using %s", pvar->auth_state.user,                  _snprintf(dest, len, "User '%s', using %s", pvar->auth_state.user,
940                                    get_auth_method_name(pvar->auth_state.failed_method));                                    get_auth_method_name(pvar->auth_state.failed_method));
# Line 924  void AUTH_end(PTInstVar pvar) Line 962  void AUTH_end(PTInstVar pvar)
962    
963  /*  /*
964   * $Log: not supported by cvs2svn $   * $Log: not supported by cvs2svn $
965     * Revision 1.3  2004/12/16 13:01:09  yutakakn
966     * SSH自動ログインでアプリケーションエラーとなる現象を修正した。
967     *
968   * Revision 1.2  2004/12/01 15:37:49  yutakakn   * Revision 1.2  2004/12/01 15:37:49  yutakakn
969   * SSH2自動ログイン機能を追加。   * SSH2自動ログイン機能を追加。
970   * 現状、パスワード認証のみに対応。   * 現状、パスワード認証のみに対応。

Legend:
Removed from v.2752  
changed lines
  Added in v.2762

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26