| 152 |
if (fd == -1) { |
if (fd == -1) { |
| 153 |
if (!suppress_errors) { |
if (!suppress_errors) { |
| 154 |
if (errno == ENOENT) { |
if (errno == ENOENT) { |
| 155 |
|
#ifdef I18N |
| 156 |
|
#else |
| 157 |
notify_nonfatal_error(pvar, |
notify_nonfatal_error(pvar, |
| 158 |
"An error occurred while trying to read a known_hosts file.\n" |
"An error occurred while trying to read a known_hosts file.\n" |
| 159 |
"The specified filename does not exist."); |
"The specified filename does not exist."); |
| 160 |
|
#endif |
| 161 |
} else { |
} else { |
| 162 |
|
#ifdef I18N |
| 163 |
|
#else |
| 164 |
notify_nonfatal_error(pvar, |
notify_nonfatal_error(pvar, |
| 165 |
"An error occurred while trying to read a known_hosts file."); |
"An error occurred while trying to read a known_hosts file."); |
| 166 |
|
#endif |
| 167 |
} |
} |
| 168 |
} |
} |
| 169 |
return 0; |
return 0; |
| 176 |
pvar->hosts_state.file_data = malloc(length + 1); |
pvar->hosts_state.file_data = malloc(length + 1); |
| 177 |
if (pvar->hosts_state.file_data == NULL) { |
if (pvar->hosts_state.file_data == NULL) { |
| 178 |
if (!suppress_errors) { |
if (!suppress_errors) { |
| 179 |
|
#ifdef I18N |
| 180 |
|
#else |
| 181 |
notify_nonfatal_error(pvar, |
notify_nonfatal_error(pvar, |
| 182 |
"Memory ran out while trying to allocate space to read a known_hosts file."); |
"Memory ran out while trying to allocate space to read a known_hosts file."); |
| 183 |
|
#endif |
| 184 |
} |
} |
| 185 |
_close(fd); |
_close(fd); |
| 186 |
return 0; |
return 0; |
| 187 |
} |
} |
| 188 |
} else { |
} else { |
| 189 |
if (!suppress_errors) { |
if (!suppress_errors) { |
| 190 |
|
#ifdef I18N |
| 191 |
|
#else |
| 192 |
notify_nonfatal_error(pvar, |
notify_nonfatal_error(pvar, |
| 193 |
"An error occurred while trying to read a known_hosts file."); |
"An error occurred while trying to read a known_hosts file."); |
| 194 |
|
#endif |
| 195 |
} |
} |
| 196 |
_close(fd); |
_close(fd); |
| 197 |
return 0; |
return 0; |
| 204 |
|
|
| 205 |
if (amount_read != length) { |
if (amount_read != length) { |
| 206 |
if (!suppress_errors) { |
if (!suppress_errors) { |
| 207 |
|
#ifdef I18N |
| 208 |
|
#else |
| 209 |
notify_nonfatal_error(pvar, |
notify_nonfatal_error(pvar, |
| 210 |
"An error occurred while trying to read a known_hosts file."); |
"An error occurred while trying to read a known_hosts file."); |
| 211 |
|
#endif |
| 212 |
} |
} |
| 213 |
free(pvar->hosts_state.file_data); |
free(pvar->hosts_state.file_data); |
| 214 |
pvar->hosts_state.file_data = NULL; |
pvar->hosts_state.file_data = NULL; |
| 639 |
|
|
| 640 |
if (!is_pattern_char(ch) || ch == '*' || ch == '?') { |
if (!is_pattern_char(ch) || ch == '*' || ch == '?') { |
| 641 |
if (!suppress_errors) { |
if (!suppress_errors) { |
| 642 |
|
#ifdef I18N |
| 643 |
|
#else |
| 644 |
notify_fatal_error(pvar, |
notify_fatal_error(pvar, |
| 645 |
"The host name contains an invalid character.\n" |
"The host name contains an invalid character.\n" |
| 646 |
"This session will be terminated."); |
"This session will be terminated."); |
| 647 |
|
#endif |
| 648 |
} |
} |
| 649 |
return 0; |
return 0; |
| 650 |
} |
} |
| 652 |
|
|
| 653 |
if (i == 0) { |
if (i == 0) { |
| 654 |
if (!suppress_errors) { |
if (!suppress_errors) { |
| 655 |
|
#ifdef I18N |
| 656 |
|
#else |
| 657 |
notify_fatal_error(pvar, "The host name should not be empty.\n" |
notify_fatal_error(pvar, "The host name should not be empty.\n" |
| 658 |
"This session will be terminated."); |
"This session will be terminated."); |
| 659 |
|
#endif |
| 660 |
} |
} |
| 661 |
return 0; |
return 0; |
| 662 |
} |
} |
| 930 |
char FAR *name = pvar->hosts_state.file_names[0]; |
char FAR *name = pvar->hosts_state.file_names[0]; |
| 931 |
|
|
| 932 |
if (name == NULL || name[0] == 0) { |
if (name == NULL || name[0] == 0) { |
| 933 |
|
#ifdef I18N |
| 934 |
|
#else |
| 935 |
notify_nonfatal_error(pvar, |
notify_nonfatal_error(pvar, |
| 936 |
"The host and its key cannot be added, because no known-hosts file has been specified.\n" |
"The host and its key cannot be added, because no known-hosts file has been specified.\n" |
| 937 |
"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."); |
| 938 |
|
#endif |
| 939 |
} else { |
} else { |
| 940 |
char FAR *keydata = format_host_key(pvar); |
char FAR *keydata = format_host_key(pvar); |
| 941 |
int length = strlen(keydata); |
int length = strlen(keydata); |
| 951 |
_S_IREAD | _S_IWRITE); |
_S_IREAD | _S_IWRITE); |
| 952 |
if (fd == -1) { |
if (fd == -1) { |
| 953 |
if (errno == EACCES) { |
if (errno == EACCES) { |
| 954 |
|
#ifdef I18N |
| 955 |
|
#else |
| 956 |
notify_nonfatal_error(pvar, |
notify_nonfatal_error(pvar, |
| 957 |
"An error occurred while trying to write the host key.\n" |
"An error occurred while trying to write the host key.\n" |
| 958 |
"You do not have permission to write to the known-hosts file."); |
"You do not have permission to write to the known-hosts file."); |
| 959 |
|
#endif |
| 960 |
} else { |
} else { |
| 961 |
|
#ifdef I18N |
| 962 |
|
#else |
| 963 |
notify_nonfatal_error(pvar, |
notify_nonfatal_error(pvar, |
| 964 |
"An error occurred while trying to write the host key.\n" |
"An error occurred while trying to write the host key.\n" |
| 965 |
"The host key could not be written."); |
"The host key could not be written."); |
| 966 |
|
#endif |
| 967 |
} |
} |
| 968 |
return; |
return; |
| 969 |
} |
} |
| 973 |
close_result = _close(fd); |
close_result = _close(fd); |
| 974 |
|
|
| 975 |
if (amount_written != length || close_result == -1) { |
if (amount_written != length || close_result == -1) { |
| 976 |
|
#ifdef I18N |
| 977 |
|
#else |
| 978 |
notify_nonfatal_error(pvar, |
notify_nonfatal_error(pvar, |
| 979 |
"An error occurred while trying to write the host key.\n" |
"An error occurred while trying to write the host key.\n" |
| 980 |
"The host key could not be written."); |
"The host key could not be written."); |
| 981 |
|
#endif |
| 982 |
} |
} |
| 983 |
} |
} |
| 984 |
} |
} |
| 1004 |
char FAR *name = pvar->hosts_state.file_names[0]; |
char FAR *name = pvar->hosts_state.file_names[0]; |
| 1005 |
|
|
| 1006 |
if (name == NULL || name[0] == 0) { |
if (name == NULL || name[0] == 0) { |
| 1007 |
|
#ifdef I18N |
| 1008 |
|
#else |
| 1009 |
notify_nonfatal_error(pvar, |
notify_nonfatal_error(pvar, |
| 1010 |
"The host and its key cannot be added, because no known-hosts file has been specified.\n" |
"The host and its key cannot be added, because no known-hosts file has been specified.\n" |
| 1011 |
"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."); |
| 1012 |
|
#endif |
| 1013 |
} |
} |
| 1014 |
else { |
else { |
| 1015 |
Key key; // 接続中のホストのキー |
Key key; // 接続中のホストのキー |
| 1031 |
|
|
| 1032 |
if (fd == -1) { |
if (fd == -1) { |
| 1033 |
if (errno == EACCES) { |
if (errno == EACCES) { |
| 1034 |
|
#ifdef I18N |
| 1035 |
|
#else |
| 1036 |
notify_nonfatal_error(pvar, |
notify_nonfatal_error(pvar, |
| 1037 |
"An error occurred while trying to write the host key.\n" |
"An error occurred while trying to write the host key.\n" |
| 1038 |
"You do not have permission to write to the known-hosts file."); |
"You do not have permission to write to the known-hosts file."); |
| 1039 |
|
#endif |
| 1040 |
} else { |
} else { |
| 1041 |
|
#ifdef I18N |
| 1042 |
|
#else |
| 1043 |
notify_nonfatal_error(pvar, |
notify_nonfatal_error(pvar, |
| 1044 |
"An error occurred while trying to write the host key.\n" |
"An error occurred while trying to write the host key.\n" |
| 1045 |
"The host key could not be written."); |
"The host key could not be written."); |
| 1046 |
|
#endif |
| 1047 |
} |
} |
| 1048 |
free(filename); |
free(filename); |
| 1049 |
return; |
return; |
| 1161 |
error1: |
error1: |
| 1162 |
close_result = _close(fd); |
close_result = _close(fd); |
| 1163 |
if (amount_written != length || close_result == -1) { |
if (amount_written != length || close_result == -1) { |
| 1164 |
|
#ifdef I18N |
| 1165 |
|
#else |
| 1166 |
notify_nonfatal_error(pvar, |
notify_nonfatal_error(pvar, |
| 1167 |
"An error occurred while trying to write the host key.\n" |
"An error occurred while trying to write the host key.\n" |
| 1168 |
"The host key could not be written."); |
"The host key could not be written."); |
| 1169 |
|
#endif |
| 1170 |
goto error2; |
goto error2; |
| 1171 |
} |
} |
| 1172 |
|
|
| 1491 |
|
|
| 1492 |
/* |
/* |
| 1493 |
* $Log: not supported by cvs2svn $ |
* $Log: not supported by cvs2svn $ |
| 1494 |
|
* Revision 1.10 2006/11/23 02:19:30 maya |
| 1495 |
|
* 表示メッセージを言語ファイルから読み込みむコードの作成を開始した。 |
| 1496 |
|
* |
| 1497 |
* Revision 1.9 2006/07/01 00:41:02 maya |
* Revision 1.9 2006/07/01 00:41:02 maya |
| 1498 |
* 書き込み用 ssh_known_hosts が指定されていないときに落ちる不具合を修正した。 |
* 書き込み用 ssh_known_hosts が指定されていないときに落ちる不具合を修正した。 |
| 1499 |
* |
* |