Clear Alarm

1. Add a user auth result callback function to clear the alarm on
   successful user authentication.
pull/461/head
John Safranek 2022-09-19 09:22:46 -07:00
parent cace79e915
commit d61cb264e5
No known key found for this signature in database
GPG Key ID: 8CE817DE0D3CCB4A
1 changed files with 19 additions and 0 deletions

View File

@ -230,6 +230,11 @@ static byte* getBufferFromFile(const char* fileName, word32* bufSz, void* heap)
}
#endif /* NO_FILESYSTEM */
static int UserAuthResult(byte result,
WS_UserAuthData* authData, void* userAuthResultCtx);
/* Initializes and sets up the WOLFSSH_CTX struct based on the configure options
* return WS_SUCCESS on success
*/
@ -252,6 +257,7 @@ static int SetupCTX(WOLFSSHD_CONFIG* conf, WOLFSSH_CTX** ctx)
/* setup authority callback for checking peer connections */
if (ret == WS_SUCCESS) {
wolfSSH_SetUserAuth(*ctx, DefaultUserAuth);
wolfSSH_SetUserAuthResult(*ctx, UserAuthResult);
}
/* set banner to display on connection */
@ -776,6 +782,19 @@ static void alarmCatch(int signum)
(void)signum;
}
static int UserAuthResult(byte result,
WS_UserAuthData* authData, void* userAuthResultCtx)
{
(void)authData;
(void)userAuthResultCtx;
if (result == WOLFSSH_USERAUTH_SUCCESS) {
alarm(0);
}
return WS_SUCCESS;
}
/* handle wolfSSH accept and directing to correct subsystem */
static void* HandleConnection(void* arg)
{