|
@@ -213,9 +213,9 @@ static shellmatta_retCode_t loginCmdFct(const shellmatta_handle_t handle, const
|
|
|
inst->tmpUserId = getUserIdFromName(inst, username);
|
|
|
checkPassword(handle, inst->tmpUserId, password);
|
|
|
}
|
|
|
+ /** -# user passed username and start interactive password input */
|
|
|
else if(NULL != username)
|
|
|
{
|
|
|
- /** -# reinitialize input */
|
|
|
inst->inputCount = 0u;
|
|
|
inst->cursor = 0u;
|
|
|
|
|
@@ -231,10 +231,9 @@ static shellmatta_retCode_t loginCmdFct(const shellmatta_handle_t handle, const
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- /** -# no credentials are passed with the command - start the input */
|
|
|
+ /** -# no credentials are passed with the command - start the interactive input */
|
|
|
inst->inputCount = 0u;
|
|
|
inst->cursor = 0u;
|
|
|
- /** -# store pointer to username in buffer */
|
|
|
shellmatta_write(handle, "enter username:\r\n", 17);
|
|
|
inst->loginState = SHELLMATTA_AUTH_USERNAME;
|
|
|
ret = SHELLMATTA_CONTINUE;
|
|
@@ -288,7 +287,7 @@ static shellmatta_retCode_t loginCmdFct(const shellmatta_handle_t handle, const
|
|
|
const shellmatta_cmd_t shellmatta_auth_loginCmd = {"login"
|
|
|
, "li"
|
|
|
, "Login command"
|
|
|
- , "interactive or use -u <username> -p <password>"
|
|
|
+ , "login interactively or use -u <username> -p <password>"
|
|
|
, loginCmdFct
|
|
|
, NULL
|
|
|
, NULL};
|
|
@@ -330,6 +329,7 @@ const shellmatta_cmd_t shellmatta_auth_logoutCmd = {"logout"
|
|
|
* @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_DUPLICATE (login/logout commands already existed)
|
|
|
* #SHELLMATTA_USE_FAULT (param err)
|
|
|
*/
|
|
|
shellmatta_retCode_t shellmatta_auth_init(shellmatta_handle_t handle,
|
|
@@ -362,9 +362,10 @@ shellmatta_retCode_t shellmatta_auth_init(shellmatta_handle_t handle,
|
|
|
inst->userListLength = userListLength;
|
|
|
inst->permList = permList;
|
|
|
inst->permListLength = permListLength;
|
|
|
- if(customLogin)
|
|
|
+ SHELLMATTA_RET(ret, shellmatta_addCmd(handle, &inst->logoutCmd));
|
|
|
+ if(!customLogin)
|
|
|
{
|
|
|
- inst->helpCmd.next = &inst->logoutCmd;
|
|
|
+ SHELLMATTA_RET(ret, shellmatta_addCmd(handle, &inst->loginCmd));
|
|
|
}
|
|
|
inst->checkFct = checkFct;
|
|
|
inst->logFct = logFct;
|