Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions nshlib/nsh_prompt.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,11 @@ void nsh_update_prompt(void)
* Name: nsh_update_prompt_after_login
*
* Description:
* Enable privilege markers in the prompt and refresh it. Boot and
* no-login sessions keep NSH_PROMPT_STRING (for example, "nsh> ").
* Enable privilege markers in the prompt and refresh it. Call this
* after a successful console/telnet login or su. nsh_consolemain
* always passes NSH_LOGIN_LOCAL, so this must not run merely because
* the session type is local. Boot and no-login sessions keep
* NSH_PROMPT_STRING (for example, "nsh> ").
*
****************************************************************************/

Expand Down
16 changes: 11 additions & 5 deletions nshlib/nsh_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ int nsh_session(FAR struct console_stdio_s *pstate,
nsh_exit(vtbl, 1);
return -1; /* nsh_exit does not return */
}

#ifdef CONFIG_SCHED_USER_IDENTITY
/* nsh_consolemain always passes NSH_LOGIN_LOCAL, even when console
* login is disabled. Apply #/$ markers only after a real login
* so CI/NTFC still sees CONFIG_NSH_PROMPT_STRING at boot.
*/

nsh_update_prompt_after_login();
#endif
}
else
#endif /* CONFIG_NSH_CONSOLE_LOGIN */
Expand All @@ -100,15 +109,12 @@ int nsh_session(FAR struct console_stdio_s *pstate,
nsh_exit(vtbl, 1);
return -1; /* nsh_exit does not return */
}
}
#endif /* CONFIG_NSH_TELNET_LOGIN */

#ifdef CONFIG_SCHED_USER_IDENTITY
if (login != NSH_LOGIN_NONE)
{
nsh_update_prompt_after_login();
}
#endif
}
#endif /* CONFIG_NSH_TELNET_LOGIN */

if (login != NSH_LOGIN_NONE)
{
Expand Down
Loading