From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Thu, 09 Dec 2021 11:51:58 +0100 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mvH1q-0010Ui-J5 for lore@lore.pengutronix.de; Thu, 09 Dec 2021 11:51:58 +0100 Received: from localhost ([127.0.0.1] helo=metis.ext.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1mvH1p-0008Em-UL; Thu, 09 Dec 2021 11:51:57 +0100 Received: from mail.thorsis.com ([92.198.35.195]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mvH1f-0008Eb-Oh for ptxdist@pengutronix.de; Thu, 09 Dec 2021 11:51:48 +0100 Received: from localhost (localhost [127.0.0.1]) by mail.thorsis.com (Postfix) with ESMTP id 3D009334A for ; Thu, 9 Dec 2021 11:51:46 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.thorsis.com Received: from mail.thorsis.com ([127.0.0.1]) by localhost (mail.thorsis.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vZRnM10T8uPQ for ; Thu, 9 Dec 2021 11:51:41 +0100 (CET) Received: by mail.thorsis.com (Postfix, from userid 109) id 634481106; Thu, 9 Dec 2021 11:51:40 +0100 (CET) From: Alexander Dahl To: ptxdist@pengutronix.de Date: Thu, 9 Dec 2021 11:51:27 +0100 Message-Id: <20211209105127.120588-1-ada@thorsis.com> X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on metis.ext.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-2.6 required=4.0 tests=AWL,BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Subject: [ptxdist] [PATCH] dropbear: rc-once: Fix error handling X-BeenThere: ptxdist@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Cc: Alexander Dahl MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "ptxdist" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: ptxdist-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false 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 --- projectroot/etc/rc.once.d/dropbear | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/projectroot/etc/rc.once.d/dropbear b/projectroot/etc/rc.once.d/dropbear index 8a0440624..a8725616a 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" base-commit: 70205d7cc77ff2bd36860291bf767f91bb4bc989 -- 2.20.1 _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de