зеркало из https://github.com/github/putty.git
Oops. That is to say, only loading and saving of PuTTY private keys
should default to .PPK - loading and saving of public keys and of foreign key formats still defaults to All Files. Ahem. [originally from svn r1809]
This commit is contained in:
Родитель
afbd7779e4
Коммит
452adcc952
17
puttygen.c
17
puttygen.c
|
@ -172,7 +172,7 @@ static int CALLBACK PassphraseProc(HWND hwnd, UINT msg,
|
||||||
* FILENAME_MAX.
|
* FILENAME_MAX.
|
||||||
*/
|
*/
|
||||||
static int prompt_keyfile(HWND hwnd, char *dlgtitle,
|
static int prompt_keyfile(HWND hwnd, char *dlgtitle,
|
||||||
char *filename, int save)
|
char *filename, int save, int ppk)
|
||||||
{
|
{
|
||||||
OPENFILENAME of;
|
OPENFILENAME of;
|
||||||
memset(&of, 0, sizeof(of));
|
memset(&of, 0, sizeof(of));
|
||||||
|
@ -182,7 +182,12 @@ static int prompt_keyfile(HWND hwnd, char *dlgtitle,
|
||||||
of.lStructSize = sizeof(of);
|
of.lStructSize = sizeof(of);
|
||||||
#endif
|
#endif
|
||||||
of.hwndOwner = hwnd;
|
of.hwndOwner = hwnd;
|
||||||
of.lpstrFilter = "PuTTY Private Key Files\0*.PPK\0AllFiles\0*\0\0\0";
|
if (ppk) {
|
||||||
|
of.lpstrFilter = "PuTTY Private Key Files\0*.PPK\0All Files\0*\0\0\0";
|
||||||
|
of.lpstrDefExt = ".ppk";
|
||||||
|
} else {
|
||||||
|
of.lpstrFilter = "All Files\0*\0\0\0";
|
||||||
|
}
|
||||||
of.lpstrCustomFilter = NULL;
|
of.lpstrCustomFilter = NULL;
|
||||||
of.nFilterIndex = 1;
|
of.nFilterIndex = 1;
|
||||||
of.lpstrFile = filename;
|
of.lpstrFile = filename;
|
||||||
|
@ -190,7 +195,6 @@ static int prompt_keyfile(HWND hwnd, char *dlgtitle,
|
||||||
of.nMaxFile = FILENAME_MAX;
|
of.nMaxFile = FILENAME_MAX;
|
||||||
of.lpstrFileTitle = NULL;
|
of.lpstrFileTitle = NULL;
|
||||||
of.lpstrInitialDir = NULL;
|
of.lpstrInitialDir = NULL;
|
||||||
of.lpstrDefExt = ".ppk";
|
|
||||||
of.lpstrTitle = dlgtitle;
|
of.lpstrTitle = dlgtitle;
|
||||||
of.Flags = 0;
|
of.Flags = 0;
|
||||||
if (save)
|
if (save)
|
||||||
|
@ -961,7 +965,7 @@ static int CALLBACK MainDlgProc(HWND hwnd, UINT msg,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (prompt_keyfile(hwnd, "Save private key as:",
|
if (prompt_keyfile(hwnd, "Save private key as:",
|
||||||
filename, 1)) {
|
filename, 1, (type == realtype))) {
|
||||||
int ret;
|
int ret;
|
||||||
FILE *fp = fopen(filename, "r");
|
FILE *fp = fopen(filename, "r");
|
||||||
if (fp) {
|
if (fp) {
|
||||||
|
@ -1004,7 +1008,7 @@ static int CALLBACK MainDlgProc(HWND hwnd, UINT msg,
|
||||||
if (state->key_exists) {
|
if (state->key_exists) {
|
||||||
char filename[FILENAME_MAX];
|
char filename[FILENAME_MAX];
|
||||||
if (prompt_keyfile(hwnd, "Save public key as:",
|
if (prompt_keyfile(hwnd, "Save public key as:",
|
||||||
filename, 1)) {
|
filename, 1, 0)) {
|
||||||
int ret;
|
int ret;
|
||||||
FILE *fp = fopen(filename, "r");
|
FILE *fp = fopen(filename, "r");
|
||||||
if (fp) {
|
if (fp) {
|
||||||
|
@ -1035,7 +1039,8 @@ static int CALLBACK MainDlgProc(HWND hwnd, UINT msg,
|
||||||
(struct MainDlgState *) GetWindowLong(hwnd, GWL_USERDATA);
|
(struct MainDlgState *) GetWindowLong(hwnd, GWL_USERDATA);
|
||||||
if (!state->generation_thread_exists) {
|
if (!state->generation_thread_exists) {
|
||||||
char filename[FILENAME_MAX];
|
char filename[FILENAME_MAX];
|
||||||
if (prompt_keyfile(hwnd, "Load private key:", filename, 0)) {
|
if (prompt_keyfile(hwnd, "Load private key:",
|
||||||
|
filename, 0, LOWORD(wParam)==IDC_LOAD)) {
|
||||||
char passphrase[PASSPHRASE_MAXLEN];
|
char passphrase[PASSPHRASE_MAXLEN];
|
||||||
int needs_pass;
|
int needs_pass;
|
||||||
int type, realtype;
|
int type, realtype;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче