nshlib: Add login argument to nsh_session for controling the login process
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
7b4d34e352
commit
9ab5e2ff45
@ -860,7 +860,7 @@ int nsh_loginscript(FAR struct nsh_vtbl_s *vtbl);
|
||||
/* Basic session and message handling */
|
||||
|
||||
struct console_stdio_s;
|
||||
int nsh_session(FAR struct console_stdio_s *pstate);
|
||||
int nsh_session(FAR struct console_stdio_s *pstate, bool login);
|
||||
int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline);
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -317,7 +317,7 @@ int nsh_consolemain(int argc, char *argv[])
|
||||
|
||||
/* Execute the session */
|
||||
|
||||
nsh_session(pstate);
|
||||
nsh_session(pstate, true);
|
||||
|
||||
/* We lost the connection. Wait for the keyboard to
|
||||
* be re-connected.
|
||||
|
@ -106,7 +106,7 @@ int nsh_consolemain(int argc, char *argv[])
|
||||
|
||||
/* Execute the session */
|
||||
|
||||
ret = nsh_session(pstate);
|
||||
ret = nsh_session(pstate, true);
|
||||
|
||||
/* Exit upon return */
|
||||
|
||||
|
@ -79,7 +79,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int nsh_session(FAR struct console_stdio_s *pstate)
|
||||
int nsh_session(FAR struct console_stdio_s *pstate, bool login)
|
||||
{
|
||||
FAR struct nsh_vtbl_s *vtbl;
|
||||
int ret;
|
||||
@ -87,6 +87,8 @@ int nsh_session(FAR struct console_stdio_s *pstate)
|
||||
DEBUGASSERT(pstate);
|
||||
vtbl = &pstate->cn_vtbl;
|
||||
|
||||
if (login)
|
||||
{
|
||||
#ifdef CONFIG_NSH_CONSOLE_LOGIN
|
||||
/* Login User and Password Check */
|
||||
|
||||
@ -122,6 +124,7 @@ int nsh_session(FAR struct console_stdio_s *pstate)
|
||||
#ifdef CONFIG_NSH_ROMFSRC
|
||||
nsh_loginscript(vtbl);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Then enter the command line parsing loop */
|
||||
|
||||
|
@ -76,7 +76,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int nsh_session(FAR struct console_stdio_s *pstate)
|
||||
int nsh_session(FAR struct console_stdio_s *pstate, bool login)
|
||||
{
|
||||
FAR struct nsh_vtbl_s *vtbl;
|
||||
int ret;
|
||||
@ -84,6 +84,8 @@ int nsh_session(FAR struct console_stdio_s *pstate)
|
||||
DEBUGASSERT(pstate);
|
||||
vtbl = &pstate->cn_vtbl;
|
||||
|
||||
if (login)
|
||||
{
|
||||
#ifdef CONFIG_NSH_CONSOLE_LOGIN
|
||||
/* Login User and Password Check */
|
||||
|
||||
@ -112,6 +114,7 @@ int nsh_session(FAR struct console_stdio_s *pstate)
|
||||
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Then enter the command line parsing loop */
|
||||
|
||||
|
@ -339,7 +339,7 @@ int nsh_consolemain(int argc, char *argv[])
|
||||
|
||||
/* Execute the session */
|
||||
|
||||
nsh_session(pstate);
|
||||
nsh_session(pstate, true);
|
||||
|
||||
/* Switch to /dev/null because we probably no longer have a
|
||||
* valid console device.
|
||||
|
Loading…
Reference in New Issue
Block a user