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 3028 by maya, Thu Oct 4 15:41:56 2007 UTC revision 3029 by maya, Fri Oct 5 02:08:13 2007 UTC
# Line 46  static HFONT DlgAuthFont; Line 46  static HFONT DlgAuthFont;
46  static HFONT DlgTisFont;  static HFONT DlgTisFont;
47  static HFONT DlgAuthSetupFont;  static HFONT DlgAuthSetupFont;
48    
 const int IDC_TIMER1 = 300;  
 const int IDC_TIMER2 = 301;  
 const int autologin_timeout = 10; // ミリ秒  
   
49  void destroy_malloced_string(char FAR * FAR * str)  void destroy_malloced_string(char FAR * FAR * str)
50  {  {
51          if (*str != NULL) {          if (*str != NULL) {
# Line 309  static void init_auth_dlg(PTInstVar pvar Line 305  static void init_auth_dlg(PTInstVar pvar
305                          CheckRadioButton(dlg, IDC_SSHUSEPASSWORD, MAX_AUTH_CONTROL, IDC_SSHUSETIS);                          CheckRadioButton(dlg, IDC_SSHUSEPASSWORD, MAX_AUTH_CONTROL, IDC_SSHUSETIS);
306                          EnableWindow(GetDlgItem(dlg, IDC_SSHPASSWORD), FALSE);                          EnableWindow(GetDlgItem(dlg, IDC_SSHPASSWORD), FALSE);
307                          SetDlgItemText(dlg, IDC_SSHPASSWORD, "");                          SetDlgItemText(dlg, IDC_SSHPASSWORD, "");
                         // TIS ではパスワードの入力が別ダイアログなので、  
                         // 自動ログインでなくてもタイマーをセットする。  
                         if (pvar->ssh2_autologin != 0)  
                                 SetTimer(dlg, IDC_TIMER1, autologin_timeout, 0);  
308    
309                  } else {                  } else {
310                          // TODO                          // TODO
# Line 582  static BOOL end_auth_dlg(PTInstVar pvar, Line 574  static BOOL end_auth_dlg(PTInstVar pvar,
574  static BOOL CALLBACK auth_dlg_proc(HWND dlg, UINT msg, WPARAM wParam,  static BOOL CALLBACK auth_dlg_proc(HWND dlg, UINT msg, WPARAM wParam,
575                                     LPARAM lParam)                                     LPARAM lParam)
576  {  {
577            const int IDC_TIMER1 = 300;
578            const int IDC_TIMER2 = 301;
579            const int IDC_TIMER3 = 302;
580            const int autologin_timeout = 10; // ミリ秒
581          PTInstVar pvar;          PTInstVar pvar;
582          LOGFONT logfont;          LOGFONT logfont;
583          HFONT font;          HFONT font;
# Line 629  static BOOL CALLBACK auth_dlg_proc(HWND Line 625  static BOOL CALLBACK auth_dlg_proc(HWND
625                          // サポートされているメソッドをチェックする。(2007.9.24 maya)                          // サポートされているメソッドをチェックする。(2007.9.24 maya)
626                          // 設定が有効で、まだ取りに行っておらず、ユーザ名が確定している                          // 設定が有効で、まだ取りに行っておらず、ユーザ名が確定している
627                          if (pvar->session_settings.CheckAuthListFirst &&                          if (pvar->session_settings.CheckAuthListFirst &&
628                              !pvar->tryed_ssh2_authlist) {                              !pvar->tryed_ssh2_authlist &&
629                                  // ダイアログのユーザ名を反映                              GetWindowTextLength(GetDlgItem(dlg, IDC_SSHUSERNAME)) > 0) {
630                                  if (pvar->auth_state.user == NULL) {                                  SetTimer(dlg, IDC_TIMER2, autologin_timeout, 0);
631                                          pvar->auth_state.user =                          }
632                                                  alloc_control_text(GetDlgItem(dlg, IDC_SSHUSERNAME));                          else {
633                                  }                                  SetTimer(dlg, IDC_TIMER3, autologin_timeout, 0);
                                 if (strlen(pvar->auth_state.user) > 0) {  
                                         SetTimer(dlg, IDC_TIMER2, autologin_timeout, 0);  
                                 }  
                                 else {  
                                         // ユーザ名の KILLFOCUS 時にチェックするため  
                                         pvar->auth_state.user = NULL;  
                                 }  
634                          }                          }
635                  }                  }
636                  return FALSE;                   /* because we set the focus */                  return FALSE;                   /* because we set the focus */
# Line 659  static BOOL CALLBACK auth_dlg_proc(HWND Line 648  static BOOL CALLBACK auth_dlg_proc(HWND
648                  }                  }
649                  else if (wParam == IDC_TIMER2) {                  else if (wParam == IDC_TIMER2) {
650                          // authlist を得るため                          // authlist を得るため
651                          if (!(pvar->ssh_state.status_flags & STATUS_DONT_SEND_USER_NAME) &&                          if (SSHv2(pvar)) {
652                              (pvar->ssh_state.status_flags & STATUS_HOST_OK)) {                                  if (!(pvar->ssh_state.status_flags & STATUS_DONT_SEND_USER_NAME) &&
653                                  // WM_INITDIALOG 時点ではプロトコルバージョンが分からない                                      (pvar->ssh_state.status_flags & STATUS_HOST_OK)) {
                                 if (SSHv2(pvar)) {  
654                                          KillTimer(dlg, IDC_TIMER2);                                          KillTimer(dlg, IDC_TIMER2);
655    
656                                            // ダイアログのユーザ名を取得する
657                                            if (pvar->auth_state.user == NULL) {
658                                                    pvar->auth_state.user =
659                                                            alloc_control_text(GetDlgItem(dlg, IDC_SSHUSERNAME));
660                                            }
661    
662                                          // ユーザ名を変更させない                                          // ユーザ名を変更させない
663                                          EnableWindow(GetDlgItem(dlg, IDC_SSHUSERNAME), FALSE);                                          EnableWindow(GetDlgItem(dlg, IDC_SSHUSERNAME), FALSE);
664    
665                                          // none を送る                                          // none を送る
666                                          do_SSH2_userauth(pvar);                                          do_SSH2_userauth(pvar);
667    
668                                            // TIS 用に OK を押すタイマーを仕掛けるのは
669                                            // 認証に失敗したあとにしないと
670                                            // Unexpected SSH2 message になる。
671                                  }                                  }
672                                  else {                          }
673                                          // SSH2 でない場合は none を送らない                          else if (SSHv1(pvar)) {
674                                          KillTimer(dlg, IDC_TIMER2);                                  KillTimer(dlg, IDC_TIMER2);
675                                    // TIS 用に OK を押すタイマーを仕掛ける
676                                    if (pvar->ssh2_authmethod == SSH_AUTH_TIS) {
677                                            SendMessage(dlg, WM_COMMAND, IDOK, 0);
678                                    }
679                                    // SSH1 では none を送らない
680                            }
681                            // プロトコルバージョン確定前は何もしない
682                    }
683                    else if (wParam == IDC_TIMER3) {
684                            if (SSHv2(pvar) || SSHv1(pvar)) {
685                                    KillTimer(dlg, IDC_TIMER3);
686                                    // TIS 用に OK を押すタイマーを仕掛ける
687                                    if (pvar->ssh2_authmethod == SSH_AUTH_TIS) {
688                                            SendMessage(dlg, WM_COMMAND, IDOK, 0);
689                                  }                                  }
690                          }                          }
691                            // プロトコルバージョン確定前は何もしない
692                  }                  }
693                  return FALSE;                  return FALSE;
694    

Legend:
Removed from v.3028  
changed lines
  Added in v.3029

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