mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-16 12:03:03 -05:00
Check whether key was actually saved, and warn if not
[originally from svn r720]
This commit is contained in:
parent
918c9ddfc5
commit
8c138ebd41
13
puttygen.c
13
puttygen.c
@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO:
|
* TODO:
|
||||||
* - check the return value from saversakey()
|
|
||||||
* - test the generated keys for actual working-RSA-key-hood
|
* - test the generated keys for actual working-RSA-key-hood
|
||||||
* - variable key size
|
* - variable key size
|
||||||
*/
|
*/
|
||||||
@ -508,9 +507,9 @@ static int CALLBACK MainDlgProc (HWND hwnd, UINT msg,
|
|||||||
}
|
}
|
||||||
if (prompt_keyfile(hwnd, "Save private key as:",
|
if (prompt_keyfile(hwnd, "Save private key as:",
|
||||||
filename, 1)) {
|
filename, 1)) {
|
||||||
|
int ret;
|
||||||
FILE *fp = fopen(filename, "r");
|
FILE *fp = fopen(filename, "r");
|
||||||
if (fp) {
|
if (fp) {
|
||||||
int ret;
|
|
||||||
char buffer[FILENAME_MAX+80];
|
char buffer[FILENAME_MAX+80];
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
sprintf(buffer, "Overwrite existing file\n%.*s?",
|
sprintf(buffer, "Overwrite existing file\n%.*s?",
|
||||||
@ -520,9 +519,13 @@ static int CALLBACK MainDlgProc (HWND hwnd, UINT msg,
|
|||||||
if (ret != IDYES)
|
if (ret != IDYES)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
saversakey(filename, &state->key, &state->aux,
|
ret = saversakey(filename, &state->key, &state->aux,
|
||||||
*passphrase ? passphrase : NULL);
|
*passphrase ? passphrase : NULL);
|
||||||
/* FIXME: check return value */
|
if (ret <= 0) {
|
||||||
|
MessageBox(hwnd, "Unable to save key file",
|
||||||
|
"PuTTYgen Error",
|
||||||
|
MB_OK | MB_ICONERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user