summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarmink <[email protected]>2017-08-30 20:42:36 +0800
committerarmink <[email protected]>2017-08-30 20:42:36 +0800
commitc36a628ff4249ae9ee9bec35054dc779b92b034a (patch)
tree5cd80125da98122ac0b7012e159e3df5bed180ee
parentf3f523d22fbbf4766b05290b6160a2bb19309da1 (diff)
[Finsh] Fix finsh password auth not valid when RT_DEBUG is not definition.
-rw-r--r--components/finsh/shell.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/components/finsh/shell.c b/components/finsh/shell.c
index 7e8a84ab27..2d157be3bd 100644
--- a/components/finsh/shell.c
+++ b/components/finsh/shell.c
@@ -214,6 +214,9 @@ static void finsh_wait_auth(void)
rt_bool_t input_finish = RT_FALSE;
char password[FINSH_PASSWORD_MAX] = { 0 };
rt_size_t cur_pos = 0;
+ /* password not set */
+ if (rt_strlen(finsh_get_password()) == 0) return;
+
while (1)
{
rt_kprintf("Password for finsh: ");
@@ -410,7 +413,12 @@ void finsh_thread_entry(void *parameter)
#ifdef FINSH_USING_AUTH
/* set the default password when the password isn't setting */
if (rt_strlen(finsh_get_password()) == 0)
- RT_ASSERT(finsh_set_password(FINSH_DEFAULT_PASSWORD) == RT_EOK);
+ {
+ if (finsh_set_password(FINSH_DEFAULT_PASSWORD) != RT_EOK)
+ {
+ rt_kprintf("Finsh password set failed.\n");
+ }
+ }
/* waiting authenticate success */
finsh_wait_auth();
#endif