mirror of https://github.com/macssh/macssh.git
check that terminal is still opened before asking for password
This commit is contained in:
parent
f0145ce772
commit
db2e4b8916
|
@ -847,6 +847,9 @@ char *getpass( const char *prompt )
|
|||
return password;
|
||||
}
|
||||
LockDialog();
|
||||
/* may need to reload the window... */
|
||||
wind = ssh2_window();
|
||||
if ( wind ) {
|
||||
context->_pindex = index;
|
||||
if ( gApplicationPrefs->cachePassphrase && !wind->sshdata.password[0]
|
||||
&& getnextcachedpassphrase(cprompt, password, &context->_pindex) ) {
|
||||
|
@ -871,6 +874,10 @@ char *getpass( const char *prompt )
|
|||
addcachedpassphrase(context, cprompt, password);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// terminal has been closed
|
||||
valid = 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
/* encrypted private key */
|
||||
|
@ -883,6 +890,7 @@ char *getpass( const char *prompt )
|
|||
return context->_kpassword;
|
||||
}
|
||||
LockDialog();
|
||||
if (wind == ssh2_window()) {
|
||||
context->_kindex = index;
|
||||
if ( gApplicationPrefs->cachePassphrase
|
||||
&& getnextcachedpassphrase(prompt, context->_kpassword, &context->_kindex) ) {
|
||||
|
@ -901,6 +909,10 @@ char *getpass( const char *prompt )
|
|||
addcachedpassphrase(context, prompt, password);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// terminal has been closed
|
||||
valid = 0;
|
||||
}
|
||||
}
|
||||
UnlockDialog();
|
||||
return (valid) ? password : NULL;
|
||||
|
|
Loading…
Reference in New Issue