зеркало из https://github.com/github/putty.git
Save Key now prompts before overwriting an existing file
[originally from svn r719]
This commit is contained in:
Родитель
e0ad00f264
Коммит
918c9ddfc5
14
puttygen.c
14
puttygen.c
|
@ -22,7 +22,6 @@
|
|||
|
||||
/*
|
||||
* TODO:
|
||||
* - prompt before overwriting an existing file
|
||||
* - check the return value from saversakey()
|
||||
* - test the generated keys for actual working-RSA-key-hood
|
||||
* - variable key size
|
||||
|
@ -509,7 +508,18 @@ static int CALLBACK MainDlgProc (HWND hwnd, UINT msg,
|
|||
}
|
||||
if (prompt_keyfile(hwnd, "Save private key as:",
|
||||
filename, 1)) {
|
||||
/* FIXME: prompt before overwriting */
|
||||
FILE *fp = fopen(filename, "r");
|
||||
if (fp) {
|
||||
int ret;
|
||||
char buffer[FILENAME_MAX+80];
|
||||
fclose(fp);
|
||||
sprintf(buffer, "Overwrite existing file\n%.*s?",
|
||||
FILENAME_MAX, filename);
|
||||
ret = MessageBox(hwnd, buffer, "PuTTYgen Warning",
|
||||
MB_YESNO | MB_ICONWARNING);
|
||||
if (ret != IDYES)
|
||||
break;
|
||||
}
|
||||
saversakey(filename, &state->key, &state->aux,
|
||||
*passphrase ? passphrase : NULL);
|
||||
/* FIXME: check return value */
|
||||
|
|
Загрузка…
Ссылка в новой задаче