|
@@ -128,6 +128,12 @@ void checkPassword(shellmatta_handle_t handle, uint32_t userId, char *password)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /** -# call log function - only for unsuccessful logins - successful logins are handled by #shellmatta_auth_login */
|
|
|
+ if ((inst->logFct) && (0u == approvedUserId))
|
|
|
+ {
|
|
|
+ inst->logFct(userId, false);
|
|
|
+ }
|
|
|
+
|
|
|
/** -# print login result */
|
|
|
if (0 == approvedUserId)
|
|
|
{
|
|
@@ -301,6 +307,7 @@ const shellmatta_cmd_t shellmatta_auth_logoutCmd = {"logout"
|
|
|
* @param[in] permListLength length of the perm list
|
|
|
* @param[in] customLogin true: no internal login command is provided
|
|
|
* @param[in] checkFct pointer to custom credential check function of type shellmatta_check_t
|
|
|
+ * @param[in] logFct pointer to login log function of type shellmatta_auth_log_t
|
|
|
* @return errorcode #SHELLMATTA_OK
|
|
|
* #SHELLMATTA_USE_FAULT (param err)
|
|
|
*/
|
|
@@ -310,7 +317,8 @@ shellmatta_retCode_t shellmatta_auth_init(shellmatta_handle_t handle,
|
|
|
shellmatta_auth_perm_t *permList,
|
|
|
uint32_t permListLength,
|
|
|
bool customLogin,
|
|
|
- shellmatta_auth_check_t checkFct)
|
|
|
+ shellmatta_auth_check_t checkFct,
|
|
|
+ shellmatta_auth_log_t logFct)
|
|
|
{
|
|
|
shellmatta_retCode_t ret = SHELLMATTA_OK;
|
|
|
shellmatta_instance_t *inst = (shellmatta_instance_t*)handle;
|
|
@@ -337,7 +345,8 @@ shellmatta_retCode_t shellmatta_auth_init(shellmatta_handle_t handle,
|
|
|
{
|
|
|
inst->helpCmd.next = &inst->logoutCmd;
|
|
|
}
|
|
|
- inst->checkFct = checkFct;
|
|
|
+ inst->checkFct = checkFct;
|
|
|
+ inst->logFct = logFct;
|
|
|
|
|
|
/** -# assign links to the perm list to each command */
|
|
|
cmd = inst->cmdList;
|
|
@@ -401,6 +410,12 @@ shellmatta_retCode_t shellmatta_auth_login(shellmatta_handle_t handle, uint32_t
|
|
|
{
|
|
|
inst->userPointer = NULL;
|
|
|
}
|
|
|
+
|
|
|
+ /** -# call log function */
|
|
|
+ if (inst->logFct)
|
|
|
+ {
|
|
|
+ inst->logFct(userId, userId != 0u ? true : false);
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|