| 45 |
#include <fcntl.h> |
#include <fcntl.h> |
| 46 |
#include <sys/stat.h> |
#include <sys/stat.h> |
| 47 |
#include <time.h> |
#include <time.h> |
| 48 |
|
#include <mbstring.h> |
| 49 |
|
|
| 50 |
#include "resource.h" |
#include "resource.h" |
| 51 |
#include <commctrl.h> |
#include <commctrl.h> |
| 1654 |
optlen = strlen(option); |
optlen = strlen(option); |
| 1655 |
|
|
| 1656 |
// 最初の':'の前の文字が数字だった場合、それをsshプロトコルバージョンとみなす |
// 最初の':'の前の文字が数字だった場合、それをsshプロトコルバージョンとみなす |
| 1657 |
p = strchr(option, ':'); |
p = _mbschr(option, ':'); |
| 1658 |
switch (*(p-1)) { |
switch (*(p-1)) { |
| 1659 |
case '1': |
case '1': |
| 1660 |
pvar->settings.ssh_protocol_version = 1; |
pvar->settings.ssh_protocol_version = 1; |
| 1668 |
p += 3; |
p += 3; |
| 1669 |
|
|
| 1670 |
// path part を切り捨てる |
// path part を切り捨てる |
| 1671 |
if ((p2 = strchr(p, '/')) != NULL) { |
if ((p2 = _mbschr(p, '/')) != NULL) { |
| 1672 |
*p2 = 0; |
*p2 = 0; |
| 1673 |
} |
} |
| 1674 |
|
|
| 1675 |
// '@'があった場合、それより前はユーザ情報 |
// '@'があった場合、それより前はユーザ情報 |
| 1676 |
if ((p2 = strchr(p, '@')) != NULL) { |
if ((p2 = _mbschr(p, '@')) != NULL) { |
| 1677 |
*p2 = 0; |
*p2 = 0; |
| 1678 |
// ':'以降はパスワード |
// ':'以降はパスワード |
| 1679 |
if ((p3 = strchr(p, ':')) != NULL) { |
if ((p3 = _mbschr(p, ':')) != NULL) { |
| 1680 |
*p3 = 0; |
*p3 = 0; |
| 1681 |
percent_decode(pvar->ssh2_password, sizeof(pvar->ssh2_password), p3 + 1); |
percent_decode(pvar->ssh2_password, sizeof(pvar->ssh2_password), p3 + 1); |
| 1682 |
pvar->ssh2_autologin = 1; |
pvar->ssh2_autologin = 1; |
| 1695 |
// ポート指定が無い時は":22"を足す |
// ポート指定が無い時は":22"を足す |
| 1696 |
#ifndef NO_INET6 |
#ifndef NO_INET6 |
| 1697 |
if (option[0] == '[' && option[hostlen-1] == ']' || // IPv6 raw address without port |
if (option[0] == '[' && option[hostlen-1] == ']' || // IPv6 raw address without port |
| 1698 |
option[0] != '[' && strchr(option, ':') == NULL) { // hostname or IPv4 raw address without port |
option[0] != '[' && _mbschr(option, ':') == NULL) { // hostname or IPv4 raw address without port |
| 1699 |
#else |
#else |
| 1700 |
if (strchr(option, ':') == NULL) { |
if (_mbschr(option, ':') == NULL) { |
| 1701 |
#endif /* NO_INET6 */ |
#endif /* NO_INET6 */ |
| 1702 |
memcpy_s(option+hostlen, optlen-hostlen, ":22", 3); |
memcpy_s(option+hostlen, optlen-hostlen, ":22", 3); |
| 1703 |
hostlen += 3; |
hostlen += 3; |
| 1710 |
|
|
| 1711 |
return OPTION_REPLACE; |
return OPTION_REPLACE; |
| 1712 |
} |
} |
| 1713 |
else if (strchr(option, '@') != NULL) { |
else if (_mbschr(option, '@') != NULL) { |
| 1714 |
// |
// |
| 1715 |
// user@host 形式のサポート |
// user@host 形式のサポート |
| 1716 |
// 取り合えずsshでのみサポートの為、ユーザ名はttssh内で潰す。 |
// 取り合えずsshでのみサポートの為、ユーザ名はttssh内で潰す。 |
| 1719 |
// Tera Term本体で処理するようにする予定。 |
// Tera Term本体で処理するようにする予定。 |
| 1720 |
// |
// |
| 1721 |
char *p; |
char *p; |
| 1722 |
p = strchr(option, '@'); |
p = _mbschr(option, '@'); |
| 1723 |
*p = 0; |
*p = 0; |
| 1724 |
|
|
| 1725 |
strncpy_s(pvar->ssh2_username, sizeof(pvar->ssh2_username), option, _TRUNCATE); |
strncpy_s(pvar->ssh2_username, sizeof(pvar->ssh2_username), option, _TRUNCATE); |