mirror of https://github.com/cy384/ssheven.git
add error alert if keys failed to load
This commit is contained in:
parent
749b6a3a22
commit
7f2779c9ba
|
@ -71,6 +71,10 @@
|
|||
#define DLOG_KEY_PASSWORD 138
|
||||
#define DITL_KEY_PASSWORD 138
|
||||
|
||||
/* alert for key file read failure */
|
||||
#define ALRT_FILE_FAIL 139
|
||||
#define DITL_FILE_FAIL 139
|
||||
|
||||
/* menus */
|
||||
#define MBAR_SSHEVEN 128
|
||||
#define MENU_APPLE 128
|
||||
|
|
|
@ -23,9 +23,12 @@ enum { WAIT, READ, EXIT } read_thread_command = WAIT;
|
|||
enum { UNINTIALIZED, OPEN, CLEANUP, DONE } read_thread_state = UNINTIALIZED;
|
||||
enum { KEY_LOGIN, PASSWORD_LOGIN } login_type = PASSWORD_LOGIN;
|
||||
|
||||
// pascal strings
|
||||
char hostname[512] = {0};
|
||||
char username[256] = {0};
|
||||
char password[256] = {0};
|
||||
|
||||
// malloc'd c strings
|
||||
char* pubkey_path = NULL;
|
||||
char* privkey_path = NULL;
|
||||
|
||||
|
@ -847,7 +850,8 @@ void* read_thread(void* arg)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (rc == LIBSSH2_ERROR_AUTHENTICATION_FAILED) StopAlert(ALRT_PW_FAIL, nil);
|
||||
if (rc == LIBSSH2_ERROR_AUTHENTICATION_FAILED && login_type == PASSWORD_LOGIN) StopAlert(ALRT_PW_FAIL, nil);
|
||||
if (rc == LIBSSH2_ERROR_FILE) StopAlert(ALRT_FILE_FAIL, nil);
|
||||
printf_i("failure: %s\r\n", libssh2_error_string(rc));
|
||||
ok = 0;
|
||||
}
|
||||
|
|
24
ssheven.r
24
ssheven.r
|
@ -308,6 +308,30 @@ resource 'ALRT' (ALRT_PRIVKEY, purgeable) {
|
|||
alertPositionMainScreen
|
||||
};
|
||||
|
||||
resource 'DITL' (DITL_FILE_FAIL) {
|
||||
{
|
||||
{ 50, 260, 70, 340 },
|
||||
Button { enabled, "OK" };
|
||||
|
||||
{ 10, 70, 30, 340 },
|
||||
StaticText { enabled, "Couldn't load key files!" };
|
||||
}
|
||||
};
|
||||
|
||||
resource 'ALRT' (ALRT_FILE_FAIL, purgeable) {
|
||||
{ 50, 100, 50+80, 100+350 },
|
||||
DITL_FILE_FAIL,
|
||||
|
||||
/* OK means draw default border on first button */
|
||||
{
|
||||
OK, visible, silent,
|
||||
OK, visible, silent,
|
||||
OK, visible, silent,
|
||||
OK, visible, silent
|
||||
},
|
||||
alertPositionMainScreen
|
||||
};
|
||||
|
||||
#include "Processes.r"
|
||||
|
||||
resource 'SIZE' (-1) {
|
||||
|
|
Loading…
Reference in New Issue