| 515 |
index--; |
index--; |
| 516 |
do { |
do { |
| 517 |
int negated; |
int negated; |
| 518 |
|
int bracketed; |
| 519 |
|
char *end_bracket; |
| 520 |
|
int host_matched = 0; |
| 521 |
|
unsigned short keyfile_port = 22; |
| 522 |
|
|
| 523 |
index++; |
index++; |
| 524 |
negated = data[index] == '!'; |
negated = data[index] == '!'; |
| 525 |
|
|
| 526 |
if (negated) { |
if (negated) { |
| 527 |
index++; |
index++; |
| 528 |
if (match_pattern(data + index, hostname)) { |
bracketed = data[index] == '['; |
| 529 |
|
if (bracketed) { |
| 530 |
|
end_bracket = strstr(data + index + 1, "]:"); |
| 531 |
|
if (end_bracket != NULL) { |
| 532 |
|
*end_bracket = ' '; |
| 533 |
|
index++; |
| 534 |
|
} |
| 535 |
|
} |
| 536 |
|
host_matched = match_pattern(data + index, hostname); |
| 537 |
|
if (bracketed && end_bracket != NULL) { |
| 538 |
|
*end_bracket = ']'; |
| 539 |
|
keyfile_port = atoi(end_bracket + 2); |
| 540 |
|
} |
| 541 |
|
if (host_matched && keyfile_port == tcpport) { |
| 542 |
return index + eat_to_end_of_line(data + index); |
return index + eat_to_end_of_line(data + index); |
| 543 |
} |
} |
| 544 |
} else if (match_pattern(data + index, hostname)) { |
} else { |
| 545 |
matched = 1; |
bracketed = data[index] == '['; |
| 546 |
|
if (bracketed) { |
| 547 |
|
end_bracket = strstr(data + index + 1, "]:"); |
| 548 |
|
if (end_bracket != NULL) { |
| 549 |
|
*end_bracket = ' '; |
| 550 |
|
index++; |
| 551 |
|
} |
| 552 |
|
} |
| 553 |
|
host_matched = match_pattern(data + index, hostname); |
| 554 |
|
if (bracketed && end_bracket != NULL) { |
| 555 |
|
*end_bracket = ']'; |
| 556 |
|
keyfile_port = atoi(end_bracket + 2); |
| 557 |
|
} |
| 558 |
|
if (host_matched && keyfile_port == tcpport) { |
| 559 |
|
matched = 1; |
| 560 |
|
} |
| 561 |
} |
} |
| 562 |
|
|
| 563 |
index += eat_to_end_of_pattern(data + index); |
index += eat_to_end_of_pattern(data + index); |
| 883 |
enum hostkey_type type = pvar->hosts_state.hostkey.type; |
enum hostkey_type type = pvar->hosts_state.hostkey.type; |
| 884 |
|
|
| 885 |
if (type == KEY_RSA1) { |
if (type == KEY_RSA1) { |
| 886 |
int result_len = host_len + 50 + |
int result_len = host_len + 50 + 8 + |
| 887 |
get_ushort16_MSBfirst(pvar->hosts_state.hostkey.exp) / 3 + |
get_ushort16_MSBfirst(pvar->hosts_state.hostkey.exp) / 3 + |
| 888 |
get_ushort16_MSBfirst(pvar->hosts_state.hostkey.mod) / 3; |
get_ushort16_MSBfirst(pvar->hosts_state.hostkey.mod) / 3; |
| 889 |
result = (char FAR *) malloc(result_len); |
result = (char FAR *) malloc(result_len); |
| 890 |
|
|
| 891 |
strncpy_s(result, result_len, pvar->hosts_state.prefetched_hostname, _TRUNCATE); |
if (pvar->ssh_state.tcpport == 22) { |
| 892 |
index = host_len; |
strncpy_s(result, result_len, pvar->hosts_state.prefetched_hostname, _TRUNCATE); |
| 893 |
|
index = host_len; |
| 894 |
|
} |
| 895 |
|
else { |
| 896 |
|
_snprintf_s(result, result_len, _TRUNCATE, "[%s]:%d", |
| 897 |
|
pvar->hosts_state.prefetched_hostname, |
| 898 |
|
pvar->ssh_state.tcpport); |
| 899 |
|
index = strlen(result); |
| 900 |
|
} |
| 901 |
|
|
| 902 |
_snprintf_s(result + index, result_len - host_len, _TRUNCATE, |
_snprintf_s(result + index, result_len - host_len, _TRUNCATE, |
| 903 |
" %d ", pvar->hosts_state.hostkey.bits); |
" %d ", pvar->hosts_state.hostkey.bits); |
| 930 |
} |
} |
| 931 |
|
|
| 932 |
// setup |
// setup |
| 933 |
_snprintf_s(result, msize, _TRUNCATE, "%s %s %s\r\n", |
if (pvar->ssh_state.tcpport == 22) { |
| 934 |
pvar->hosts_state.prefetched_hostname, |
_snprintf_s(result, msize, _TRUNCATE, "%s %s %s\r\n", |
| 935 |
get_sshname_from_key(key), |
pvar->hosts_state.prefetched_hostname, |
| 936 |
uu); |
get_sshname_from_key(key), |
| 937 |
|
uu); |
| 938 |
|
} else { |
| 939 |
|
_snprintf_s(result, msize, _TRUNCATE, "[%s]:%d %s %s\r\n", |
| 940 |
|
pvar->hosts_state.prefetched_hostname, |
| 941 |
|
pvar->ssh_state.tcpport, |
| 942 |
|
get_sshname_from_key(key), |
| 943 |
|
uu); |
| 944 |
|
} |
| 945 |
} |
} |
| 946 |
error: |
error: |
| 947 |
if (blob != NULL) |
if (blob != NULL) |
| 1108 |
host_index--; |
host_index--; |
| 1109 |
do { |
do { |
| 1110 |
int negated; |
int negated; |
| 1111 |
|
int bracketed; |
| 1112 |
|
char *end_bracket; |
| 1113 |
|
int host_matched = 0; |
| 1114 |
|
unsigned short keyfile_port = 22; |
| 1115 |
|
|
| 1116 |
host_index++; |
host_index++; |
| 1117 |
negated = data[host_index] == '!'; |
negated = data[host_index] == '!'; |
| 1118 |
|
|
| 1119 |
if (negated) { |
if (negated) { |
| 1120 |
host_index++; |
host_index++; |
| 1121 |
if (match_pattern(data + host_index, |
bracketed = data[host_index] == '['; |
| 1122 |
pvar->ssh_state.hostname)) { |
if (bracketed) { |
| 1123 |
|
end_bracket = strstr(data + host_index + 1, "]:"); |
| 1124 |
|
if (end_bracket != NULL) { |
| 1125 |
|
*end_bracket = ' '; |
| 1126 |
|
host_index++; |
| 1127 |
|
} |
| 1128 |
|
} |
| 1129 |
|
host_matched = match_pattern(data + host_index, pvar->ssh_state.hostname); |
| 1130 |
|
if (bracketed && end_bracket != NULL) { |
| 1131 |
|
*end_bracket = ']'; |
| 1132 |
|
keyfile_port = atoi(end_bracket + 2); |
| 1133 |
|
} |
| 1134 |
|
if (host_matched && keyfile_port == pvar->ssh_state.tcpport) { |
| 1135 |
matched = 0; |
matched = 0; |
| 1136 |
// 接続バージョンチェックのために host_index を進めてから抜ける |
// 接続バージョンチェックのために host_index を進めてから抜ける |
| 1137 |
host_index--; |
host_index--; |
| 1142 |
break; |
break; |
| 1143 |
} |
} |
| 1144 |
} |
} |
| 1145 |
else if (match_pattern(data + host_index, |
else { |
| 1146 |
pvar->ssh_state.hostname)) { |
bracketed = data[host_index] == '['; |
| 1147 |
matched = 1; |
if (bracketed) { |
| 1148 |
|
end_bracket = strstr(data + host_index + 1, "]:"); |
| 1149 |
|
if (end_bracket != NULL) { |
| 1150 |
|
*end_bracket = ' '; |
| 1151 |
|
host_index++; |
| 1152 |
|
} |
| 1153 |
|
} |
| 1154 |
|
host_matched = match_pattern(data + host_index, pvar->ssh_state.hostname); |
| 1155 |
|
if (bracketed && end_bracket != NULL) { |
| 1156 |
|
*end_bracket = ']'; |
| 1157 |
|
keyfile_port = atoi(end_bracket + 2); |
| 1158 |
|
} |
| 1159 |
|
if (host_matched && keyfile_port == pvar->ssh_state.tcpport) { |
| 1160 |
|
matched = 1; |
| 1161 |
|
} |
| 1162 |
} |
} |
| 1163 |
host_index += eat_to_end_of_pattern(data + host_index); |
host_index += eat_to_end_of_pattern(data + host_index); |
| 1164 |
} while (data[host_index] == ','); |
} while (data[host_index] == ','); |