From: Michael Olbrich <m.olbrich@pengutronix.de>
To: ptxdist@pengutronix.de
Cc: Alexander Dahl <ada@thorsis.com>
Subject: Re: [ptxdist] [APPLIED] dropbear: rc-once: Fix error handling
Date: Fri, 10 Dec 2021 14:07:24 +0100 [thread overview]
Message-ID: <20211210130724.3903757-1-m.olbrich@pengutronix.de> (raw)
In-Reply-To: <20211209105127.120588-1-ada@thorsis.com>
Thanks, applied as a467e398aeed82d2a96e5e72a86aa9ac09f3e261.
Michael
[sent from post-receive hook]
On Fri, 10 Dec 2021 14:07:24 +0100, Alexander Dahl <ada@thorsis.com> wrote:
> The return of gen_keys() never threw an error, so last block was useless
> so far. Script worked because gen_key() exited instead of returning.
> Messages are done like in the openssh rc-once script now.
>
> Fixes: cf0424f8ba23 ("dropbear: Refactor rc-once and init to use KEYTYPES")
> Signed-off-by: Alexander Dahl <ada@thorsis.com>
> Message-Id: <20211209105127.120588-1-ada@thorsis.com>
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
>
> diff --git a/projectroot/etc/rc.once.d/dropbear b/projectroot/etc/rc.once.d/dropbear
> index 8a04406242e4..a8725616a7f2 100644
> --- a/projectroot/etc/rc.once.d/dropbear
> +++ b/projectroot/etc/rc.once.d/dropbear
> @@ -13,15 +13,9 @@ gen_key() {
>
> rm -f $key_file > /dev/null 2>&1
>
> - echo -n "generating $key_type key..."
> - dropbearkey -t $key_type -f $key_file > /dev/null 2>&1
> -
> - if [ "$?" = "0" ]; then
> - echo "done"
> - else
> - echo "failed"
> - exit 1
> - fi
> + echo "Create $key_type key; this may take some time ..."
> + dropbearkey -t $key_type -f $key_file > /dev/null 2>&1 || return
> + echo "Created $key_type key."
> }
>
> gen_keys() {
> @@ -29,10 +23,10 @@ gen_keys() {
> do
> case "$keytype" in
> rsa)
> - gen_key rsa "$DROPBEAR_RSAKEY"
> + gen_key rsa "$DROPBEAR_RSAKEY" || return
> ;;
> ecdsa)
> - gen_key ecdsa "$DROPBEAR_ECDSAKEY"
> + gen_key ecdsa "$DROPBEAR_ECDSAKEY" || return
> ;;
> *)
> echo "Key type '$keytype' not supported"
_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de
prev parent reply other threads:[~2021-12-10 13:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-09 10:51 [ptxdist] [PATCH] " Alexander Dahl
2021-12-10 13:07 ` Michael Olbrich [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211210130724.3903757-1-m.olbrich@pengutronix.de \
--to=m.olbrich@pengutronix.de \
--cc=ada@thorsis.com \
--cc=ptxdist@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox