| 48 |
#include <errno.h> |
#include <errno.h> |
| 49 |
#include <sys/stat.h> |
#include <sys/stat.h> |
| 50 |
|
|
| 51 |
#ifdef I18N |
#ifndef NO_I18N |
| 52 |
static HFONT DlgHostsAddFont; |
static HFONT DlgHostsAddFont; |
| 53 |
static HFONT DlgHostsReplaceFont; |
static HFONT DlgHostsReplaceFont; |
| 54 |
#endif |
#endif |
| 156 |
if (fd == -1) { |
if (fd == -1) { |
| 157 |
if (!suppress_errors) { |
if (!suppress_errors) { |
| 158 |
if (errno == ENOENT) { |
if (errno == ENOENT) { |
| 159 |
#ifdef I18N |
#ifndef NO_I18N |
| 160 |
strcpy(pvar->ts->UIMsg, "An error occurred while trying to read a known_hosts file.\n" |
strcpy(pvar->ts->UIMsg, "An error occurred while trying to read a known_hosts file.\n" |
| 161 |
"The specified filename does not exist."); |
"The specified filename does not exist."); |
| 162 |
UTIL_get_lang_msg("MSG_HOSTS_READ_ENOENT_ERROR", pvar); |
UTIL_get_lang_msg("MSG_HOSTS_READ_ENOENT_ERROR", pvar); |
| 167 |
"The specified filename does not exist."); |
"The specified filename does not exist."); |
| 168 |
#endif |
#endif |
| 169 |
} else { |
} else { |
| 170 |
#ifdef I18N |
#ifndef NO_I18N |
| 171 |
strcpy(pvar->ts->UIMsg, "An error occurred while trying to read a known_hosts file."); |
strcpy(pvar->ts->UIMsg, "An error occurred while trying to read a known_hosts file."); |
| 172 |
UTIL_get_lang_msg("MSG_HOSTS_READ_ERROR", pvar); |
UTIL_get_lang_msg("MSG_HOSTS_READ_ERROR", pvar); |
| 173 |
notify_nonfatal_error(pvar, pvar->ts->UIMsg); |
notify_nonfatal_error(pvar, pvar->ts->UIMsg); |
| 187 |
pvar->hosts_state.file_data = malloc(length + 1); |
pvar->hosts_state.file_data = malloc(length + 1); |
| 188 |
if (pvar->hosts_state.file_data == NULL) { |
if (pvar->hosts_state.file_data == NULL) { |
| 189 |
if (!suppress_errors) { |
if (!suppress_errors) { |
| 190 |
#ifdef I18N |
#ifndef NO_I18N |
| 191 |
strcpy(pvar->ts->UIMsg, "Memory ran out while trying to allocate space to read a known_hosts file."); |
strcpy(pvar->ts->UIMsg, "Memory ran out while trying to allocate space to read a known_hosts file."); |
| 192 |
UTIL_get_lang_msg("MSG_HOSTS_ALLOC_ERROR", pvar); |
UTIL_get_lang_msg("MSG_HOSTS_ALLOC_ERROR", pvar); |
| 193 |
notify_nonfatal_error(pvar, pvar->ts->UIMsg); |
notify_nonfatal_error(pvar, pvar->ts->UIMsg); |
| 201 |
} |
} |
| 202 |
} else { |
} else { |
| 203 |
if (!suppress_errors) { |
if (!suppress_errors) { |
| 204 |
#ifdef I18N |
#ifndef NO_I18N |
| 205 |
strcpy(pvar->ts->UIMsg, "An error occurred while trying to read a known_hosts file."); |
strcpy(pvar->ts->UIMsg, "An error occurred while trying to read a known_hosts file."); |
| 206 |
UTIL_get_lang_msg("MSG_HOSTS_READ_ERROR", pvar); |
UTIL_get_lang_msg("MSG_HOSTS_READ_ERROR", pvar); |
| 207 |
notify_nonfatal_error(pvar, pvar->ts->UIMsg); |
notify_nonfatal_error(pvar, pvar->ts->UIMsg); |
| 221 |
|
|
| 222 |
if (amount_read != length) { |
if (amount_read != length) { |
| 223 |
if (!suppress_errors) { |
if (!suppress_errors) { |
| 224 |
#ifdef I18N |
#ifndef NO_I18N |
| 225 |
strcpy(pvar->ts->UIMsg, "An error occurred while trying to read a known_hosts file."); |
strcpy(pvar->ts->UIMsg, "An error occurred while trying to read a known_hosts file."); |
| 226 |
UTIL_get_lang_msg("MSG_HOSTS_READ_ERROR", pvar); |
UTIL_get_lang_msg("MSG_HOSTS_READ_ERROR", pvar); |
| 227 |
notify_nonfatal_error(pvar, pvar->ts->UIMsg); |
notify_nonfatal_error(pvar, pvar->ts->UIMsg); |
| 659 |
|
|
| 660 |
if (!is_pattern_char(ch) || ch == '*' || ch == '?') { |
if (!is_pattern_char(ch) || ch == '*' || ch == '?') { |
| 661 |
if (!suppress_errors) { |
if (!suppress_errors) { |
| 662 |
#ifdef I18N |
#ifndef NO_I18N |
| 663 |
strcpy(pvar->ts->UIMsg, "The host name contains an invalid character.\n" |
strcpy(pvar->ts->UIMsg, "The host name contains an invalid character.\n" |
| 664 |
"This session will be terminated."); |
"This session will be terminated."); |
| 665 |
UTIL_get_lang_msg("MSG_HOSTS_HOSTNAME_INVALID_ERROR", pvar); |
UTIL_get_lang_msg("MSG_HOSTS_HOSTNAME_INVALID_ERROR", pvar); |
| 676 |
|
|
| 677 |
if (i == 0) { |
if (i == 0) { |
| 678 |
if (!suppress_errors) { |
if (!suppress_errors) { |
| 679 |
#ifdef I18N |
#ifndef NO_I18N |
| 680 |
strcpy(pvar->ts->UIMsg, "The host name should not be empty.\n" |
strcpy(pvar->ts->UIMsg, "The host name should not be empty.\n" |
| 681 |
"This session will be terminated."); |
"This session will be terminated."); |
| 682 |
UTIL_get_lang_msg("MSG_HOSTS_HOSTNAME_EMPTY_ERROR", pvar); |
UTIL_get_lang_msg("MSG_HOSTS_HOSTNAME_EMPTY_ERROR", pvar); |
| 958 |
char FAR *name = pvar->hosts_state.file_names[0]; |
char FAR *name = pvar->hosts_state.file_names[0]; |
| 959 |
|
|
| 960 |
if (name == NULL || name[0] == 0) { |
if (name == NULL || name[0] == 0) { |
| 961 |
#ifdef I18N |
#ifndef NO_I18N |
| 962 |
strcpy(pvar->ts->UIMsg, "The host and its key cannot be added, because no known-hosts file has been specified.\n" |
strcpy(pvar->ts->UIMsg, "The host and its key cannot be added, because no known-hosts file has been specified.\n" |
| 963 |
"Restart Teraterm and specify a read/write known-hosts file in the TTSSH Setup dialog box."); |
"Restart Teraterm and specify a read/write known-hosts file in the TTSSH Setup dialog box."); |
| 964 |
UTIL_get_lang_msg("MSG_HOSTS_FILE_UNSPECIFY_ERROR", pvar); |
UTIL_get_lang_msg("MSG_HOSTS_FILE_UNSPECIFY_ERROR", pvar); |
| 983 |
_S_IREAD | _S_IWRITE); |
_S_IREAD | _S_IWRITE); |
| 984 |
if (fd == -1) { |
if (fd == -1) { |
| 985 |
if (errno == EACCES) { |
if (errno == EACCES) { |
| 986 |
#ifdef I18N |
#ifndef NO_I18N |
| 987 |
strcpy(pvar->ts->UIMsg, "An error occurred while trying to write the host key.\n" |
strcpy(pvar->ts->UIMsg, "An error occurred while trying to write the host key.\n" |
| 988 |
"You do not have permission to write to the known-hosts file."); |
"You do not have permission to write to the known-hosts file."); |
| 989 |
UTIL_get_lang_msg("MSG_HOSTS_WRITE_EACCES_ERROR", pvar); |
UTIL_get_lang_msg("MSG_HOSTS_WRITE_EACCES_ERROR", pvar); |
| 994 |
"You do not have permission to write to the known-hosts file."); |
"You do not have permission to write to the known-hosts file."); |
| 995 |
#endif |
#endif |
| 996 |
} else { |
} else { |
| 997 |
#ifdef I18N |
#ifndef NO_I18N |
| 998 |
strcpy(pvar->ts->UIMsg, "An error occurred while trying to write the host key.\n" |
strcpy(pvar->ts->UIMsg, "An error occurred while trying to write the host key.\n" |
| 999 |
"The host key could not be written."); |
"The host key could not be written."); |
| 1000 |
UTIL_get_lang_msg("MSG_HOSTS_WRITE_ERROR", pvar); |
UTIL_get_lang_msg("MSG_HOSTS_WRITE_ERROR", pvar); |
| 1013 |
close_result = _close(fd); |
close_result = _close(fd); |
| 1014 |
|
|
| 1015 |
if (amount_written != length || close_result == -1) { |
if (amount_written != length || close_result == -1) { |
| 1016 |
#ifdef I18N |
#ifndef NO_I18N |
| 1017 |
strcpy(pvar->ts->UIMsg, "An error occurred while trying to write the host key.\n" |
strcpy(pvar->ts->UIMsg, "An error occurred while trying to write the host key.\n" |
| 1018 |
"The host key could not be written."); |
"The host key could not be written."); |
| 1019 |
UTIL_get_lang_msg("MSG_HOSTS_WRITE_ERROR", pvar); |
UTIL_get_lang_msg("MSG_HOSTS_WRITE_ERROR", pvar); |
| 1048 |
char FAR *name = pvar->hosts_state.file_names[0]; |
char FAR *name = pvar->hosts_state.file_names[0]; |
| 1049 |
|
|
| 1050 |
if (name == NULL || name[0] == 0) { |
if (name == NULL || name[0] == 0) { |
| 1051 |
#ifdef I18N |
#ifndef NO_I18N |
| 1052 |
strcpy(pvar->ts->UIMsg, "The host and its key cannot be added, because no known-hosts file has been specified.\n" |
strcpy(pvar->ts->UIMsg, "The host and its key cannot be added, because no known-hosts file has been specified.\n" |
| 1053 |
"Restart Teraterm and specify a read/write known-hosts file in the TTSSH Setup dialog box."); |
"Restart Teraterm and specify a read/write known-hosts file in the TTSSH Setup dialog box."); |
| 1054 |
UTIL_get_lang_msg("MSG_HOSTS_FILE_UNSPECIFY_ERROR", pvar); |
UTIL_get_lang_msg("MSG_HOSTS_FILE_UNSPECIFY_ERROR", pvar); |
| 1079 |
|
|
| 1080 |
if (fd == -1) { |
if (fd == -1) { |
| 1081 |
if (errno == EACCES) { |
if (errno == EACCES) { |
| 1082 |
#ifdef I18N |
#ifndef NO_I18N |
| 1083 |
strcpy(pvar->ts->UIMsg, "An error occurred while trying to write the host key.\n" |
strcpy(pvar->ts->UIMsg, "An error occurred while trying to write the host key.\n" |
| 1084 |
"You do not have permission to write to the known-hosts file."); |
"You do not have permission to write to the known-hosts file."); |
| 1085 |
UTIL_get_lang_msg("MSG_HOSTS_WRITE_EACCES_ERROR", pvar); |
UTIL_get_lang_msg("MSG_HOSTS_WRITE_EACCES_ERROR", pvar); |
| 1090 |
"You do not have permission to write to the known-hosts file."); |
"You do not have permission to write to the known-hosts file."); |
| 1091 |
#endif |
#endif |
| 1092 |
} else { |
} else { |
| 1093 |
#ifdef I18N |
#ifndef NO_I18N |
| 1094 |
strcpy(pvar->ts->UIMsg, "An error occurred while trying to write the host key.\n" |
strcpy(pvar->ts->UIMsg, "An error occurred while trying to write the host key.\n" |
| 1095 |
"The host key could not be written."); |
"The host key could not be written."); |
| 1096 |
UTIL_get_lang_msg("MSG_HOSTS_WRITE_ERROR", pvar); |
UTIL_get_lang_msg("MSG_HOSTS_WRITE_ERROR", pvar); |
| 1217 |
error1: |
error1: |
| 1218 |
close_result = _close(fd); |
close_result = _close(fd); |
| 1219 |
if (amount_written != length || close_result == -1) { |
if (amount_written != length || close_result == -1) { |
| 1220 |
#ifdef I18N |
#ifndef NO_I18N |
| 1221 |
strcpy(pvar->ts->UIMsg, "An error occurred while trying to write the host key.\n" |
strcpy(pvar->ts->UIMsg, "An error occurred while trying to write the host key.\n" |
| 1222 |
"The host key could not be written."); |
"The host key could not be written."); |
| 1223 |
UTIL_get_lang_msg("MSG_HOSTS_WRITE_ERROR", pvar); |
UTIL_get_lang_msg("MSG_HOSTS_WRITE_ERROR", pvar); |
| 1252 |
LPARAM lParam) |
LPARAM lParam) |
| 1253 |
{ |
{ |
| 1254 |
PTInstVar pvar; |
PTInstVar pvar; |
| 1255 |
#ifdef I18N |
#ifndef NO_I18N |
| 1256 |
LOGFONT logfont; |
LOGFONT logfont; |
| 1257 |
HFONT font; |
HFONT font; |
| 1258 |
#endif |
#endif |
| 1263 |
pvar->hosts_state.hosts_dialog = dlg; |
pvar->hosts_state.hosts_dialog = dlg; |
| 1264 |
SetWindowLong(dlg, DWL_USER, lParam); |
SetWindowLong(dlg, DWL_USER, lParam); |
| 1265 |
|
|
| 1266 |
#ifdef I18N |
#ifndef NO_I18N |
| 1267 |
// 追加・置き換えとも init_hosts_dlg を呼んでいるので、その前にセットする必要がある |
// 追加・置き換えとも init_hosts_dlg を呼んでいるので、その前にセットする必要がある |
| 1268 |
GetWindowText(dlg, pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg)); |
GetWindowText(dlg, pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg)); |
| 1269 |
UTIL_get_lang_msg("DLG_UNKNONWHOST_TITLE", pvar); |
UTIL_get_lang_msg("DLG_UNKNONWHOST_TITLE", pvar); |
| 1296 |
|
|
| 1297 |
init_hosts_dlg(pvar, dlg); |
init_hosts_dlg(pvar, dlg); |
| 1298 |
|
|
| 1299 |
#ifdef I18N |
#ifndef NO_I18N |
| 1300 |
font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0); |
font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0); |
| 1301 |
GetObject(font, sizeof(LOGFONT), &logfont); |
GetObject(font, sizeof(LOGFONT), &logfont); |
| 1302 |
if (UTIL_get_lang_font("DLG_TAHOMA_FONT", dlg, &logfont, &DlgHostsAddFont, pvar)) { |
if (UTIL_get_lang_font("DLG_TAHOMA_FONT", dlg, &logfont, &DlgHostsAddFont, pvar)) { |
| 1337 |
|
|
| 1338 |
EndDialog(dlg, 1); |
EndDialog(dlg, 1); |
| 1339 |
|
|
| 1340 |
#ifdef I18N |
#ifndef NO_I18N |
| 1341 |
if (DlgHostsAddFont != NULL) { |
if (DlgHostsAddFont != NULL) { |
| 1342 |
DeleteObject(DlgHostsAddFont); |
DeleteObject(DlgHostsAddFont); |
| 1343 |
} |
} |
| 1350 |
notify_closed_connection(pvar); |
notify_closed_connection(pvar); |
| 1351 |
EndDialog(dlg, 0); |
EndDialog(dlg, 0); |
| 1352 |
|
|
| 1353 |
#ifdef I18N |
#ifndef NO_I18N |
| 1354 |
if (DlgHostsAddFont != NULL) { |
if (DlgHostsAddFont != NULL) { |
| 1355 |
DeleteObject(DlgHostsAddFont); |
DeleteObject(DlgHostsAddFont); |
| 1356 |
} |
} |
| 1374 |
LPARAM lParam) |
LPARAM lParam) |
| 1375 |
{ |
{ |
| 1376 |
PTInstVar pvar; |
PTInstVar pvar; |
| 1377 |
#ifdef I18N |
#ifndef NO_I18N |
| 1378 |
LOGFONT logfont; |
LOGFONT logfont; |
| 1379 |
HFONT font; |
HFONT font; |
| 1380 |
#endif |
#endif |
| 1385 |
pvar->hosts_state.hosts_dialog = dlg; |
pvar->hosts_state.hosts_dialog = dlg; |
| 1386 |
SetWindowLong(dlg, DWL_USER, lParam); |
SetWindowLong(dlg, DWL_USER, lParam); |
| 1387 |
|
|
| 1388 |
#ifdef I18N |
#ifndef NO_I18N |
| 1389 |
// 追加・置き換えとも init_hosts_dlg を呼んでいるので、その前にセットする必要がある |
// 追加・置き換えとも init_hosts_dlg を呼んでいるので、その前にセットする必要がある |
| 1390 |
GetWindowText(dlg, pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg)); |
GetWindowText(dlg, pvar->ts->UIMsg, sizeof(pvar->ts->UIMsg)); |
| 1391 |
UTIL_get_lang_msg("DLG_DIFFERENTHOST_TITLE", pvar); |
UTIL_get_lang_msg("DLG_DIFFERENTHOST_TITLE", pvar); |
| 1418 |
|
|
| 1419 |
init_hosts_dlg(pvar, dlg); |
init_hosts_dlg(pvar, dlg); |
| 1420 |
|
|
| 1421 |
#ifdef I18N |
#ifndef NO_I18N |
| 1422 |
font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0); |
font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0); |
| 1423 |
GetObject(font, sizeof(LOGFONT), &logfont); |
GetObject(font, sizeof(LOGFONT), &logfont); |
| 1424 |
if (UTIL_get_lang_font("DLG_TAHOMA_FONT", dlg, &logfont, &DlgHostsReplaceFont, pvar)) { |
if (UTIL_get_lang_font("DLG_TAHOMA_FONT", dlg, &logfont, &DlgHostsReplaceFont, pvar)) { |
| 1457 |
|
|
| 1458 |
EndDialog(dlg, 1); |
EndDialog(dlg, 1); |
| 1459 |
|
|
| 1460 |
#ifdef I18N |
#ifndef NO_I18N |
| 1461 |
if (DlgHostsReplaceFont != NULL) { |
if (DlgHostsReplaceFont != NULL) { |
| 1462 |
DeleteObject(DlgHostsReplaceFont); |
DeleteObject(DlgHostsReplaceFont); |
| 1463 |
} |
} |
| 1470 |
notify_closed_connection(pvar); |
notify_closed_connection(pvar); |
| 1471 |
EndDialog(dlg, 0); |
EndDialog(dlg, 0); |
| 1472 |
|
|
| 1473 |
#ifdef I18N |
#ifndef NO_I18N |
| 1474 |
if (DlgHostsReplaceFont != NULL) { |
if (DlgHostsReplaceFont != NULL) { |
| 1475 |
DeleteObject(DlgHostsReplaceFont); |
DeleteObject(DlgHostsReplaceFont); |
| 1476 |
} |
} |
| 1620 |
|
|
| 1621 |
/* |
/* |
| 1622 |
* $Log: not supported by cvs2svn $ |
* $Log: not supported by cvs2svn $ |
| 1623 |
|
* Revision 1.15 2007/01/04 08:36:42 maya |
| 1624 |
|
* フォントを変更する部分を追加した。 |
| 1625 |
|
* |
| 1626 |
* Revision 1.14 2006/12/06 14:31:13 maya |
* Revision 1.14 2006/12/06 14:31:13 maya |
| 1627 |
* 表示メッセージの読み込み対応 |
* 表示メッセージの読み込み対応 |
| 1628 |
* |
* |