[LEDE-DEV] Procd and askconsole

Alberto Bursi alberto.bursi at outlook.it
Fri Sep 16 08:59:17 PDT 2016



On 09/16/2016 10:48 AM, Lebleu Pierre wrote:
> Hi all,
>
> I am new to this mailing list and I would like to present me as Pierre.
>
> I recently play a bit with procd and I found an "issue". Indeed, if I do
> a factory reset, I am able to login as root without login. I have some
> scripts in /etc/uci-defaults and one of them set the password for the
> root account. So, this behaviour looks like to me a bug.
>
> For my understanding, when procd reaches STATE_INIT, it runs
> the inittab and one of them is "askconsole". The problem is the system
> is not completely ready to receive the user : the hostname is not even
> set.
>
> In the old sysvinit, the inittab contains an entry called "bootwait"
> wich is executed after the termination of init (eg : "/etc/rc.d").
> I purpose to move the "askconsole" entry to STATE_RUNNING or to create
> a new entry called "askconsolewait" in order to keep backward
> compatibility.
>
> diff --git a/inittab.c b/inittab.c
> index ae2c431..2d590e4 100644
> --- a/inittab.c
> +++ b/inittab.c
> @@ -228,6 +228,10 @@ static struct init_handler handlers[] = {
>                  .name = "respawn",
>                  .cb = rcrespawn,
>                  .multi = 1,
> +       }, {
> +               .name = "askconsolewait",
> +               .cb = askconsole,
> +               .multi = 1,
>          }
>   };
>   
> @@ -251,11 +255,9 @@ void procd_inittab_run(const char *handler)
>   
>          list_for_each_entry(a, &actions, list)
>                  if (!strcmp(a->handler->name, handler)) {
> -                       if (a->handler->multi) {
> -                               a->handler->cb(a);
> -                               continue;
> -                       }
>                          a->handler->cb(a);
> +                       if (a->handler->multi)
> +                               continue;
>                          break;
>                  }
>   }
> diff --git a/state.c b/state.c
> index 4ad9e2d..fe37419 100644
> --- a/state.c
> +++ b/state.c
> @@ -128,6 +128,7 @@ static void state_enter(void)
>   
>          case STATE_RUNNING:
>                  LOG("- init complete -\n");
> +               procd_inittab_run("askconsolewait");
>                  break;
>   
>          case STATE_SHUTDOWN:
>
> What is your view ? Thank you.
>
> Cheers,
>
> Pierre
>
Is this fixing this issue ? 
https://bugs.lede-project.org/index.php?do=details&task_id=123



More information about the Lede-dev mailing list