| 230 |
init_auth_machine_banner(pvar, dlg); |
init_auth_machine_banner(pvar, dlg); |
| 231 |
init_password_control(dlg); |
init_password_control(dlg); |
| 232 |
|
|
| 233 |
|
// 認証失敗後はラベルを書き換え |
| 234 |
if (pvar->auth_state.failed_method != SSH_AUTH_NONE) { |
if (pvar->auth_state.failed_method != SSH_AUTH_NONE) { |
| 235 |
/* must be retrying a failed attempt */ |
/* must be retrying a failed attempt */ |
| 236 |
UTIL_get_lang_msg("DLG_AUTH_BANNER2_FAILED", pvar, "Authentication failed. Please retry."); |
UTIL_get_lang_msg("DLG_AUTH_BANNER2_FAILED", pvar, "Authentication failed. Please retry."); |
| 240 |
default_method = pvar->auth_state.failed_method; |
default_method = pvar->auth_state.failed_method; |
| 241 |
} |
} |
| 242 |
|
|
| 243 |
// ホスト確認ダイアログから抜けたとき=ウィンドウがアクティブになったとき |
// パスワードを覚えておくチェックボックスにはデフォルトで有効とする (2006.8.3 yutaka) |
| 244 |
// に SetFocus が実行され、コマンドラインで渡された認証方式が上書きされて |
if (pvar->ts_SSH->remember_password) { |
| 245 |
// しまうので、自動ログイン有効時は SetFocus しない (2009.1.31 maya) |
SendMessage(GetDlgItem(dlg, IDC_REMEMBER_PASSWORD), BM_SETCHECK, BST_CHECKED, 0); |
| 246 |
if (!pvar->ssh2_autologin) { |
} else { |
| 247 |
set_auth_options_status(dlg, auth_types_to_control_IDs[default_method]); |
SendMessage(GetDlgItem(dlg, IDC_REMEMBER_PASSWORD), BM_SETCHECK, BST_UNCHECKED, 0); |
| 248 |
|
} |
| 249 |
|
|
| 250 |
if (default_method == SSH_AUTH_TIS) { |
// ForwardAgent の設定を反映する (2008.12.4 maya) |
| 251 |
/* we disabled the password control, so fix the focus */ |
CheckDlgButton(dlg, IDC_FORWARD_AGENT, pvar->settings.ForwardAgent); |
| 252 |
SetFocus(GetDlgItem(dlg, IDC_SSHUSETIS)); |
|
| 253 |
} |
// SSH バージョンによって TIS のラベルを書き換え |
| 254 |
else if (default_method == SSH_AUTH_PAGEANT) { |
if (pvar->settings.ssh_protocol_version == 1) { |
| 255 |
SetFocus(GetDlgItem(dlg, IDC_SSHUSEPAGEANT)); |
UTIL_get_lang_msg("DLG_AUTH_METHOD_CHALLENGE1", pvar, |
| 256 |
} |
"Use challenge/response to log in(&TIS)"); |
| 257 |
|
SetDlgItemText(dlg, IDC_SSHUSETIS, pvar->ts->UIMsg); |
| 258 |
|
} else { |
| 259 |
|
UTIL_get_lang_msg("DLG_AUTH_METHOD_CHALLENGE2", pvar, |
| 260 |
|
"Use &challenge/response to log in(keyboard-interactive)"); |
| 261 |
|
SetDlgItemText(dlg, IDC_SSHUSETIS, pvar->ts->UIMsg); |
| 262 |
} |
} |
| 263 |
|
|
| 264 |
if (pvar->auth_state.user != NULL) { |
if (pvar->auth_state.user != NULL) { |
| 265 |
SetDlgItemText(dlg, IDC_SSHUSERNAME, pvar->auth_state.user); |
SetDlgItemText(dlg, IDC_SSHUSERNAME, pvar->auth_state.user); |
| 266 |
EnableWindow(GetDlgItem(dlg, IDC_SSHUSERNAME), FALSE); |
EnableWindow(GetDlgItem(dlg, IDC_SSHUSERNAME), FALSE); |
| 267 |
EnableWindow(GetDlgItem(dlg, IDC_SSHUSERNAMELABEL), FALSE); |
EnableWindow(GetDlgItem(dlg, IDC_SSHUSERNAMELABEL), FALSE); |
|
} else if (pvar->session_settings.DefaultUserName[0] != 0) { |
|
|
SetDlgItemText(dlg, IDC_SSHUSERNAME, |
|
|
pvar->session_settings.DefaultUserName); |
|
| 268 |
} |
} |
| 269 |
|
if (strlen(pvar->ssh2_username) > 0) { |
| 270 |
SetDlgItemText(dlg, IDC_RSAFILENAME, |
SetDlgItemText(dlg, IDC_SSHUSERNAME, pvar->ssh2_username); |
|
pvar->session_settings.DefaultRSAPrivateKeyFile); |
|
|
SetDlgItemText(dlg, IDC_HOSTRSAFILENAME, |
|
|
pvar->session_settings.DefaultRhostsHostPrivateKeyFile); |
|
|
SetDlgItemText(dlg, IDC_LOCALUSERNAME, |
|
|
pvar->session_settings.DefaultRhostsLocalUserName); |
|
|
|
|
|
update_server_supported_types(pvar, dlg); |
|
|
|
|
|
// SSH2 autologin |
|
|
// ユーザ、パスワード、認証メソッドを自動設定して、一定時間後にOKボタンを押下する。 |
|
|
// |
|
|
// (2004.12.1 yutaka) |
|
|
// (2005.1.26 yutaka) 公開鍵認証サポート |
|
|
// 自動ログインでないときは、自動設定はするが変更可能 (2006.9.18 maya) |
|
|
#if 0 |
|
|
if (pvar->ssh2_autologin == 1) { |
|
|
#endif |
|
|
if (strlen(pvar->ssh2_username) > 0) { |
|
|
SetDlgItemText(dlg, IDC_SSHUSERNAME, pvar->ssh2_username); |
|
|
} |
|
| 271 |
if (pvar->ssh2_autologin == 1) { |
if (pvar->ssh2_autologin == 1) { |
| 272 |
EnableWindow(GetDlgItem(dlg, IDC_SSHUSERNAME), FALSE); |
EnableWindow(GetDlgItem(dlg, IDC_SSHUSERNAME), FALSE); |
| 273 |
EnableWindow(GetDlgItem(dlg, IDC_SSHUSERNAMELABEL), FALSE); |
EnableWindow(GetDlgItem(dlg, IDC_SSHUSERNAMELABEL), FALSE); |
| 274 |
} |
} |
| 275 |
|
} |
| 276 |
|
else if (pvar->session_settings.DefaultUserName[0] != 0) { |
| 277 |
|
SetDlgItemText(dlg, IDC_SSHUSERNAME, |
| 278 |
|
pvar->session_settings.DefaultUserName); |
| 279 |
|
} |
| 280 |
|
|
| 281 |
|
if (strlen(pvar->ssh2_password) > 0) { |
| 282 |
SetDlgItemText(dlg, IDC_SSHPASSWORD, pvar->ssh2_password); |
SetDlgItemText(dlg, IDC_SSHPASSWORD, pvar->ssh2_password); |
| 283 |
if (pvar->ssh2_autologin == 1) { |
if (pvar->ssh2_autologin == 1) { |
| 284 |
EnableWindow(GetDlgItem(dlg, IDC_SSHPASSWORD), FALSE); |
EnableWindow(GetDlgItem(dlg, IDC_SSHPASSWORD), FALSE); |
| 285 |
EnableWindow(GetDlgItem(dlg, IDC_SSHPASSWORDCAPTION), FALSE); |
EnableWindow(GetDlgItem(dlg, IDC_SSHPASSWORDCAPTION), FALSE); |
| 286 |
} |
} |
| 287 |
|
} |
| 288 |
|
|
| 289 |
// '/I' 指定があるときのみ最小化する (2005.9.5 yutaka) |
SetDlgItemText(dlg, IDC_RSAFILENAME, |
| 290 |
if (pvar->ts->Minimize) { |
pvar->session_settings.DefaultRSAPrivateKeyFile); |
| 291 |
//20050822追加 start T.Takahashi |
SetDlgItemText(dlg, IDC_HOSTRSAFILENAME, |
| 292 |
ShowWindow(dlg,SW_MINIMIZE); |
pvar->session_settings.DefaultRhostsHostPrivateKeyFile); |
| 293 |
//20050822追加 end T.Takahashi |
SetDlgItemText(dlg, IDC_LOCALUSERNAME, |
| 294 |
} |
pvar->session_settings.DefaultRhostsLocalUserName); |
|
|
|
|
if (pvar->ssh2_authmethod == SSH_AUTH_PASSWORD) { |
|
|
CheckRadioButton(dlg, IDC_SSHUSEPASSWORD, MAX_AUTH_CONTROL, IDC_SSHUSEPASSWORD); |
|
| 295 |
|
|
| 296 |
} else if (pvar->ssh2_authmethod == SSH_AUTH_RSA) { |
if (pvar->ssh2_authmethod == SSH_AUTH_PASSWORD) { |
| 297 |
CheckRadioButton(dlg, IDC_SSHUSEPASSWORD, MAX_AUTH_CONTROL, IDC_SSHUSERSA); |
CheckRadioButton(dlg, IDC_SSHUSEPASSWORD, MAX_AUTH_CONTROL, IDC_SSHUSEPASSWORD); |
| 298 |
|
|
| 299 |
SetDlgItemText(dlg, IDC_RSAFILENAME, pvar->ssh2_keyfile); |
} else if (pvar->ssh2_authmethod == SSH_AUTH_RSA) { |
| 300 |
if (pvar->ssh2_autologin == 1) { |
CheckRadioButton(dlg, IDC_SSHUSEPASSWORD, MAX_AUTH_CONTROL, IDC_SSHUSERSA); |
|
EnableWindow(GetDlgItem(dlg, IDC_CHOOSERSAFILE), FALSE); |
|
|
EnableWindow(GetDlgItem(dlg, IDC_RSAFILENAME), FALSE); |
|
|
} |
|
| 301 |
|
|
| 302 |
// /auth=challenge を追加 (2007.10.5 maya) |
SetDlgItemText(dlg, IDC_RSAFILENAME, pvar->ssh2_keyfile); |
| 303 |
} else if (pvar->ssh2_authmethod == SSH_AUTH_TIS) { |
if (pvar->ssh2_autologin == 1) { |
| 304 |
CheckRadioButton(dlg, IDC_SSHUSEPASSWORD, MAX_AUTH_CONTROL, IDC_SSHUSETIS); |
EnableWindow(GetDlgItem(dlg, IDC_CHOOSERSAFILE), FALSE); |
| 305 |
EnableWindow(GetDlgItem(dlg, IDC_SSHPASSWORD), FALSE); |
EnableWindow(GetDlgItem(dlg, IDC_RSAFILENAME), FALSE); |
| 306 |
SetDlgItemText(dlg, IDC_SSHPASSWORD, ""); |
} |
| 307 |
|
|
| 308 |
// /auth=pageant を追加 |
// /auth=challenge を追加 (2007.10.5 maya) |
| 309 |
} else if (pvar->ssh2_authmethod == SSH_AUTH_PAGEANT) { |
} else if (pvar->ssh2_authmethod == SSH_AUTH_TIS) { |
| 310 |
CheckRadioButton(dlg, IDC_SSHUSEPASSWORD, MAX_AUTH_CONTROL, IDC_SSHUSEPAGEANT); |
CheckRadioButton(dlg, IDC_SSHUSEPASSWORD, MAX_AUTH_CONTROL, IDC_SSHUSETIS); |
| 311 |
EnableWindow(GetDlgItem(dlg, IDC_SSHPASSWORD), FALSE); |
EnableWindow(GetDlgItem(dlg, IDC_SSHPASSWORD), FALSE); |
| 312 |
SetDlgItemText(dlg, IDC_SSHPASSWORD, ""); |
SetDlgItemText(dlg, IDC_SSHPASSWORD, ""); |
| 313 |
|
|
| 314 |
|
// /auth=pageant を追加 |
| 315 |
|
} else if (pvar->ssh2_authmethod == SSH_AUTH_PAGEANT) { |
| 316 |
|
CheckRadioButton(dlg, IDC_SSHUSEPASSWORD, MAX_AUTH_CONTROL, IDC_SSHUSEPAGEANT); |
| 317 |
|
EnableWindow(GetDlgItem(dlg, IDC_SSHPASSWORD), FALSE); |
| 318 |
|
SetDlgItemText(dlg, IDC_SSHPASSWORD, ""); |
| 319 |
|
|
| 320 |
} else { |
} else { |
| 321 |
// TODO |
// デフォルトの認証メソッドをダイアログに反映 |
| 322 |
|
set_auth_options_status(dlg, auth_types_to_control_IDs[default_method]); |
| 323 |
|
|
| 324 |
} |
update_server_supported_types(pvar, dlg); |
| 325 |
|
|
| 326 |
GetDlgItemText(dlg, IDC_SSHUSERNAME, uimsg, sizeof(uimsg)); |
// ホスト確認ダイアログから抜けたとき=ウィンドウがアクティブになったとき |
| 327 |
if (uimsg[0] == 0) { |
// に SetFocus が実行され、コマンドラインで渡された認証方式が上書きされて |
| 328 |
SetFocus(GetDlgItem(dlg, IDC_SSHUSERNAME)); |
// しまうので、自動ログイン有効時は SetFocus しない (2009.1.31 maya) |
| 329 |
|
if (default_method == SSH_AUTH_TIS) { |
| 330 |
|
/* we disabled the password control, so fix the focus */ |
| 331 |
|
SetFocus(GetDlgItem(dlg, IDC_SSHUSETIS)); |
| 332 |
} |
} |
| 333 |
else if (pvar->ask4passwd == 1) { |
else if (default_method == SSH_AUTH_PAGEANT) { |
| 334 |
SetFocus(GetDlgItem(dlg, IDC_SSHPASSWORD)); |
SetFocus(GetDlgItem(dlg, IDC_SSHUSEPAGEANT)); |
| 335 |
} |
} |
|
#if 0 |
|
|
} |
|
|
#endif |
|
| 336 |
|
|
|
#if 1 |
|
|
if (pvar->settings.ssh_protocol_version == 1) { |
|
|
UTIL_get_lang_msg("DLG_AUTH_METHOD_CHALLENGE1", pvar, |
|
|
"Use challenge/response to log in(&TIS)"); |
|
|
SetDlgItemText(dlg, IDC_SSHUSETIS, pvar->ts->UIMsg); |
|
|
} else { |
|
|
UTIL_get_lang_msg("DLG_AUTH_METHOD_CHALLENGE2", pvar, |
|
|
"Use &challenge/response to log in(keyboard-interactive)"); |
|
|
SetDlgItemText(dlg, IDC_SSHUSETIS, pvar->ts->UIMsg); |
|
| 337 |
} |
} |
|
#endif |
|
| 338 |
|
|
| 339 |
// パスワードを覚えておくチェックボックスにはデフォルトで有効とする (2006.8.3 yutaka) |
if (GetWindowTextLength(GetDlgItem(dlg, IDC_SSHUSERNAME)) == 0) { |
| 340 |
if (pvar->ts_SSH->remember_password) { |
SetFocus(GetDlgItem(dlg, IDC_SSHUSERNAME)); |
| 341 |
SendMessage(GetDlgItem(dlg, IDC_REMEMBER_PASSWORD), BM_SETCHECK, BST_CHECKED, 0); |
} |
| 342 |
} else { |
else if (pvar->ask4passwd == 1) { |
| 343 |
SendMessage(GetDlgItem(dlg, IDC_REMEMBER_PASSWORD), BM_SETCHECK, BST_UNCHECKED, 0); |
SetFocus(GetDlgItem(dlg, IDC_SSHPASSWORD)); |
| 344 |
} |
} |
| 345 |
|
|
| 346 |
// settings から現在の設定を持ってくる (2008.12.4 maya) |
// '/I' 指定があるときのみ最小化する (2005.9.5 yutaka) |
| 347 |
CheckDlgButton(dlg, IDC_FORWARD_AGENT, pvar->settings.ForwardAgent); |
if (pvar->ts->Minimize) { |
| 348 |
|
//20050822追加 start T.Takahashi |
| 349 |
|
ShowWindow(dlg,SW_MINIMIZE); |
| 350 |
|
//20050822追加 end T.Takahashi |
| 351 |
|
} |
| 352 |
} |
} |
| 353 |
|
|
| 354 |
static char FAR *alloc_control_text(HWND ctl) |
static char FAR *alloc_control_text(HWND ctl) |
| 624 |
static BOOL CALLBACK auth_dlg_proc(HWND dlg, UINT msg, WPARAM wParam, |
static BOOL CALLBACK auth_dlg_proc(HWND dlg, UINT msg, WPARAM wParam, |
| 625 |
LPARAM lParam) |
LPARAM lParam) |
| 626 |
{ |
{ |
| 627 |
const int IDC_TIMER1 = 300; // 自動ログイン |
const int IDC_TIMER1 = 300; // 自動ログインが有効なとき |
| 628 |
const int IDC_TIMER2 = 301; // サポートされているメソッドをチェック |
const int IDC_TIMER2 = 301; // サポートされているメソッドを自動チェック(CheckAuthListFirst) |
| 629 |
const int IDC_TIMER3 = 302; // チャレンジレスポンス |
const int IDC_TIMER3 = 302; // challenge で ask4passwd でCheckAuthListFirst が FALSE のとき |
| 630 |
const int autologin_timeout = 10; // ミリ秒 |
const int autologin_timeout = 10; // ミリ秒 |
| 631 |
PTInstVar pvar; |
PTInstVar pvar; |
| 632 |
LOGFONT logfont; |
LOGFONT logfont; |
| 682 |
GetWindowTextLength(GetDlgItem(dlg, IDC_SSHUSERNAME)) > 0) { |
GetWindowTextLength(GetDlgItem(dlg, IDC_SSHUSERNAME)) > 0) { |
| 683 |
SetTimer(dlg, IDC_TIMER2, autologin_timeout, 0); |
SetTimer(dlg, IDC_TIMER2, autologin_timeout, 0); |
| 684 |
} |
} |
| 685 |
// /auth=challenge が指定されていてユーザ名が確定していない |
// /auth=challenge と /ask4passwd が指定されていてユーザ名が確定している |
| 686 |
// ということはないと思われるので、OK ボタンを押して |
// 場合は、OK ボタンを押して TIS auth ダイアログを出す |
| 687 |
// TIS auth ダイアログを出す |
else if (pvar->ssh2_authmethod == SSH_AUTH_TIS && |
| 688 |
else { |
pvar->ask4passwd && |
| 689 |
|
GetWindowTextLength(GetDlgItem(dlg, IDC_SSHUSERNAME)) > 0) { |
| 690 |
SetTimer(dlg, IDC_TIMER3, autologin_timeout, 0); |
SetTimer(dlg, IDC_TIMER3, autologin_timeout, 0); |
| 691 |
} |
} |
| 692 |
} |
} |
| 703 |
pvar->session_settings.CheckAuthListFirst && |
pvar->session_settings.CheckAuthListFirst && |
| 704 |
!pvar->tryed_ssh2_authlist) { |
!pvar->tryed_ssh2_authlist) { |
| 705 |
if (!autologin_sent_none) { |
if (!autologin_sent_none) { |
| 706 |
|
autologin_sent_none = TRUE; |
| 707 |
|
|
| 708 |
// ダイアログのユーザ名を取得する |
// ダイアログのユーザ名を取得する |
| 709 |
if (pvar->auth_state.user == NULL) { |
if (pvar->auth_state.user == NULL) { |
| 710 |
pvar->auth_state.user = |
pvar->auth_state.user = |
| 711 |
alloc_control_text(GetDlgItem(dlg, IDC_SSHUSERNAME)); |
alloc_control_text(GetDlgItem(dlg, IDC_SSHUSERNAME)); |
| 712 |
} |
} |
| 713 |
|
|
| 714 |
// AuthList が帰ってきていないと IDOK を押しても |
// CheckAuthListFirst が TRUE のときは AuthList が帰ってきていないと |
| 715 |
// 進まないので、認証メソッド none を送る (2008.10.12 maya) |
// IDOK を押しても進まないので、認証メソッド none を送る (2008.10.12 maya) |
| 716 |
do_SSH2_userauth(pvar); |
do_SSH2_userauth(pvar); |
|
autologin_sent_none = TRUE; |
|
| 717 |
} |
} |
| 718 |
//else { |
//else { |
| 719 |
// none を送ってから帰ってくるまで待つ |
// none を送ってから帰ってくるまで待つ |
| 720 |
//} |
//} |
| 721 |
} |
} |
| 722 |
else { |
else { |
| 723 |
|
// SSH1 のとき |
| 724 |
|
// または CheckAuthListFirst が FALSE のとき |
| 725 |
|
// または CheckAuthListFirst TRUE で、authlist が帰ってきたあと |
| 726 |
|
|
| 727 |
|
// ダイアログのユーザ名を取得する |
| 728 |
|
if (pvar->auth_state.user == NULL) { |
| 729 |
|
pvar->auth_state.user = |
| 730 |
|
alloc_control_text(GetDlgItem(dlg, IDC_SSHUSERNAME)); |
| 731 |
|
} |
| 732 |
|
|
| 733 |
KillTimer(dlg, IDC_TIMER1); |
KillTimer(dlg, IDC_TIMER1); |
| 734 |
SendMessage(dlg, WM_COMMAND, IDOK, 0); |
SendMessage(dlg, WM_COMMAND, IDOK, 0); |
| 735 |
} |
} |
| 751 |
// ユーザ名を変更させない |
// ユーザ名を変更させない |
| 752 |
EnableWindow(GetDlgItem(dlg, IDC_SSHUSERNAME), FALSE); |
EnableWindow(GetDlgItem(dlg, IDC_SSHUSERNAME), FALSE); |
| 753 |
|
|
| 754 |
// none を送る |
// 認証メソッド none を送る |
| 755 |
do_SSH2_userauth(pvar); |
do_SSH2_userauth(pvar); |
| 756 |
|
|
| 757 |
// TIS 用に OK を押すタイマーを仕掛けるのは |
// TIS 用に OK を押すのは認証に失敗したあとにしないと |
|
// 認証に失敗したあとにしないと |
|
| 758 |
// Unexpected SSH2 message になる。 |
// Unexpected SSH2 message になる。 |
| 759 |
} |
} |
| 760 |
} |
} |
| 761 |
else if (SSHv1(pvar)) { |
else if (SSHv1(pvar)) { |
| 762 |
KillTimer(dlg, IDC_TIMER2); |
KillTimer(dlg, IDC_TIMER2); |
| 763 |
// TIS 用に OK を押すタイマーを仕掛ける |
// TIS 用に OK を押す |
| 764 |
if (pvar->ssh2_authmethod == SSH_AUTH_TIS) { |
if (pvar->ssh2_authmethod == SSH_AUTH_TIS) { |
| 765 |
SendMessage(dlg, WM_COMMAND, IDOK, 0); |
SendMessage(dlg, WM_COMMAND, IDOK, 0); |
| 766 |
} |
} |
| 838 |
// ユーザ名を変更させない |
// ユーザ名を変更させない |
| 839 |
EnableWindow(GetDlgItem(dlg, IDC_SSHUSERNAME), FALSE); |
EnableWindow(GetDlgItem(dlg, IDC_SSHUSERNAME), FALSE); |
| 840 |
|
|
| 841 |
// none を送る |
// 認証メソッド none を送る |
| 842 |
do_SSH2_userauth(pvar); |
do_SSH2_userauth(pvar); |
| 843 |
return TRUE; |
return TRUE; |
| 844 |
} |
} |