mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-16 14:08:46 +08:00
nshlib:add platform challenge function for nsh login
Signed-off-by: huangjian <huangjian@xiaomi.com>
This commit is contained in:
@@ -143,7 +143,10 @@ static void nsh_token(FAR struct console_stdio_s *pstate,
|
||||
int nsh_login(FAR struct console_stdio_s *pstate)
|
||||
{
|
||||
char username[16];
|
||||
char password[16];
|
||||
char password[128];
|
||||
#ifdef CONFIG_NSH_PLATFORM_CHALLENGE
|
||||
char challenge[128];
|
||||
#endif
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
@@ -168,6 +171,12 @@ int nsh_login(FAR struct console_stdio_s *pstate)
|
||||
nsh_token(pstate, username, sizeof(username));
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NSH_PLATFORM_CHALLENGE
|
||||
platform_challenge(challenge, sizeof(challenge));
|
||||
fputs(challenge, pstate->cn_outstream);
|
||||
fflush(pstate->cn_outstream);
|
||||
#endif
|
||||
|
||||
/* Ask for the login password */
|
||||
|
||||
fputs(g_passwordprompt, pstate->cn_outstream);
|
||||
@@ -188,7 +197,11 @@ int nsh_login(FAR struct console_stdio_s *pstate)
|
||||
if (PASSWORD_VERIFY_MATCH(ret))
|
||||
|
||||
#elif defined(CONFIG_NSH_LOGIN_PLATFORM)
|
||||
#ifdef CONFIG_NSH_PLATFORM_CHALLENGE
|
||||
ret = platform_user_verify(username, challenge, password);
|
||||
#else
|
||||
ret = platform_user_verify(username, password);
|
||||
#endif
|
||||
if (PASSWORD_VERIFY_MATCH(ret))
|
||||
|
||||
#elif defined(CONFIG_NSH_LOGIN_FIXED)
|
||||
|
Reference in New Issue
Block a user