From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id CCA8D1F953 for ; Wed, 27 Oct 2021 20:30:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240902AbhJ0UdT (ORCPT ); Wed, 27 Oct 2021 16:33:19 -0400 Received: from pb-smtp2.pobox.com ([64.147.108.71]:57307 "EHLO pb-smtp2.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240732AbhJ0UdT (ORCPT ); Wed, 27 Oct 2021 16:33:19 -0400 Received: from pb-smtp2.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 0D018EAD68; Wed, 27 Oct 2021 16:30:53 -0400 (EDT) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=VAAxSpQ3dCZKeIf2P6nSxbBjOsukQxJdSaIygs 0g/tY=; b=TXWjUVLTgBwfaBVISTP1Sqcy+Fmqb7VtsbfGzjxiIrVsmIq9fxVVLh Nd3xcEUJvIkZfxehvLlu326/03i7/oRLOaX+e+RCqtD8Jy8gY/aSCfuGuomabXZ6 ks6Z1IQBguDME3qjVoDLUPnpYH3lbuYBQd7K114ntz80Rr48cUpUA= Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id 02AA5EAD67; Wed, 27 Oct 2021 16:30:53 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [104.133.2.91]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp2.pobox.com (Postfix) with ESMTPSA id 5AF9BEAD66; Wed, 27 Oct 2021 16:30:52 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: Fabian Stelzer Cc: git@vger.kernel.org, =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason Subject: Re: [PATCH v2 3/6] ssh signing: make verify-commit consider key lifetime References: <20211027080616.619956-1-fs@gigacodes.de> <20211027080616.619956-4-fs@gigacodes.de> Date: Wed, 27 Oct 2021 13:30:51 -0700 In-Reply-To: <20211027080616.619956-4-fs@gigacodes.de> (Fabian Stelzer's message of "Wed, 27 Oct 2021 10:06:13 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: C7703ACC-3764-11EC-8A59-CD991BBA3BAF-77302942!pb-smtp2.pobox.com Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Fabian Stelzer writes: > +static int parse_payload_metadata(struct signature_check *sigc) > +{ > + const char *ident_line = NULL; > + size_t ident_len; > + struct ident_split ident; > + const char *signer_header; > + > + switch(sigc->payload_type) { > + case SIGNATURE_PAYLOAD_COMMIT: > + signer_header = "committer"; > + break; > + case SIGNATURE_PAYLOAD_TAG: > + signer_header = "tagger"; > + break; > + default: > + /* Ignore unknown payload types */ > + return 0; > + } The case arms should be indented to the same level as opening switch(). Have SP between keyword "switch" and the expression the statement switches on. More importantly, can you explain why it is necessary to allow callers to call this function with a random value in payload_type and have it silently succeed? Isn't it a programming error that deserves a call to BUG("...")? Thanks.