From patchwork Sat Jan 30 08:19:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Abramov X-Patchwork-Id: 26724 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 566F527BC1D; Sat, 30 Jan 2021 08:20:25 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 2261F27BC1D for ; Sat, 30 Jan 2021 08:20:25 +0000 (GMT) Received: from localhost ([::1]:35860 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5lUW-0007aH-Az for patchwork@mira.cbaines.net; Sat, 30 Jan 2021 03:20:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46246) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5lUB-0007a6-0b for guix-patches@gnu.org; Sat, 30 Jan 2021 03:20:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:42055) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5lU9-0000gM-UL for guix-patches@gnu.org; Sat, 30 Jan 2021 03:20:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l5lU9-0008Ta-R8 for guix-patches@gnu.org; Sat, 30 Jan 2021 03:20:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#46185] [PATCH] services: knot: Fix an acl and a key verification. Resent-From: Alexey Abramov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 30 Jan 2021 08:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 46185 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 46185@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.161199479832566 (code B ref -1); Sat, 30 Jan 2021 08:20:01 +0000 Received: (at submit) by debbugs.gnu.org; 30 Jan 2021 08:19:58 +0000 Received: from localhost ([127.0.0.1]:53601 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l5lU5-0008TB-50 for submit@debbugs.gnu.org; Sat, 30 Jan 2021 03:19:58 -0500 Received: from lists.gnu.org ([209.51.188.17]:58242) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l5lU0-0008Sx-7P for submit@debbugs.gnu.org; Sat, 30 Jan 2021 03:19:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46242) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5lU0-0007Zj-1W for guix-patches@gnu.org; Sat, 30 Jan 2021 03:19:52 -0500 Received: from mx4.mail.mmer.org ([178.22.66.29]:31965) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5lTy-0000bC-I7 for guix-patches@gnu.org; Sat, 30 Jan 2021 03:19:51 -0500 Received: from delta (unknown [10.147.19.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx4.mail.mmer.org (Postfix) with ESMTPSA id 97BF79CC4D for ; Sat, 30 Jan 2021 07:49:04 +0000 (UTC) From: Alexey Abramov Date: Sat, 30 Jan 2021 09:19:32 +0100 Message-Id: <20210130081932.31088-1-levenson@mmer.org> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Received-SPF: pass client-ip=178.22.66.29; envelope-from=levenson@mmer.org; helo=mx4.mail.mmer.org X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/services/dns.scm (verify-knot-key-configuration): Change the order of memq attributes. (verify-knot-keystore-configuration): Likewise. (verify-knot-acl-configuration): Replace fold with every procedure. --- gnu/services/dns.scm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gnu/services/dns.scm b/gnu/services/dns.scm index b339eb0619..d4aefe6285 100644 --- a/gnu/services/dns.scm +++ b/gnu/services/dns.scm @@ -256,9 +256,9 @@ (let ((id (knot-key-configuration-id key))) (unless (and (string? id) (not (equal? id ""))) (error-out "key id must be a non empty string."))) - (unless (memq '(#f hmac-md5 hmac-sha1 hmac-sha224 hmac-sha256 hmac-sha384 hmac-sha512) - (knot-key-configuration-algorithm key)) - (error-out "algorithm must be one of: #f, 'hmac-md5, 'hmac-sha1, + (unless (memq (knot-key-configuration-algorithm key) + '(#f hmac-md5 hmac-sha1 hmac-sha224 hmac-sha256 hmac-sha384 hmac-sha512)) + (error-out "algorithm must be one of: #f, 'hmac-md5, 'hmac-sha1, 'hmac-sha224, 'hmac-sha256, 'hmac-sha384 or 'hmac-sha512"))) (define (verify-knot-keystore-configuration keystore) @@ -267,9 +267,9 @@ (let ((id (knot-keystore-configuration-id keystore))) (unless (and (string? id) (not (equal? id ""))) (error-out "keystore id must be a non empty string."))) - (unless (memq '(pem pkcs11) - (knot-keystore-configuration-backend keystore)) - (error-out "backend must be one of: 'pem or 'pkcs11"))) + (unless (memq (knot-keystore-configuration-backend keystore) + '(pem pkcs11)) + (error-out "backend must be one of: 'pem or 'pkcs11"))) (define (verify-knot-policy-configuration policy) (unless (knot-policy-configuration? policy) @@ -288,7 +288,7 @@ (unless (and (string? id) (not (equal? id ""))) (error-out "acl id must be a non empty string.")) (unless (and (list? address) - (fold (lambda (x1 x2) (and (string? x1) (string? x2))) "" address)) + (every string? address)) (error-out "acl address must be a list of strings."))) (unless (boolean? (knot-acl-configuration-deny? acl)) (error-out "deny? must be #t or #f.")))