svnno****@sourc*****
svnno****@sourc*****
2012年 10月 17日 (水) 21:34:48 JST
Revision: 5050 http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5050 Author: yutakapon Date: 2012-10-17 21:34:47 +0900 (Wed, 17 Oct 2012) Log Message: ----------- 一時ファイルを秘密鍵ファイルと同じディレクトリに作成するようにした。 当該ディレクトリに書き込み権限があることが前提となるが、一時ファイル削除までに、Tera Termが 落ちてファイルが残ったとしても、ユーザに分かりやすくできる。 残作業は、 ・一時ファイルを使わずに、オンメモリで鍵を変換する。 ・PuTTYライブラリのDLL化 Modified Paths: -------------- branches/ssh_putty_pubkey/ttssh2/ttxssh/keyfiles.c -------------- next part -------------- Modified: branches/ssh_putty_pubkey/ttssh2/ttxssh/keyfiles.c =================================================================== --- branches/ssh_putty_pubkey/ttssh2/ttxssh/keyfiles.c 2012-10-17 12:09:59 UTC (rev 5049) +++ branches/ssh_putty_pubkey/ttssh2/ttxssh/keyfiles.c 2012-10-17 12:34:47 UTC (rev 5050) @@ -345,6 +345,7 @@ { int ret = -1; int putty_key = 0, sshcom_key = 0; + char templates[2096]; // \x8Ag\x92\xA3\x8Eq\x82\xAA.ppk\x82Ȃ\xE7\x82APuTTY\x8C`\x8E\xAE\x82̌\xAE\x83t\x83@\x83C\x83\x8B\x82ƌ\xA9\x82Ȃ\xB7\x81B if (strstr(filename, ".ppk") != NULL) { @@ -356,9 +357,12 @@ } // \x88ꎞ\x83t\x83@\x83C\x83\x8B\x82̖\xBC\x91O\x82\xF0\x8E擾\x82\xB7\x82\xE9\x81B - if (tmpnam_s(newfile, newfilelen) != 0) + _snprintf_s(templates, sizeof(templates), _TRUNCATE, "%sXXXXXX", filename); + if (_mktemp_s(templates, strlen(templates)+1) != 0) goto error; + strncpy_s(newfile, newfilelen, templates, _TRUNCATE); + if (passphrase[0] == 0) // \x8B\xF3\x83p\x83X\x83\x8F\x81[\x83h\x82̏ꍇ passphrase = NULL;