Thread (41 messages) flat view 41 messages, 3 authors, 2021-12-09

Re: [PATCH v2 3/6] ssh signing: make verify-commit consider key lifetime

From: Fabian Stelzer <hidden>
Date: 2021-10-28 08:02:18

Possibly related (same subject, not in this thread)

On 27.10.21 22:30, Junio C Hamano wrote:
Fabian Stelzer [off-list ref] writes:
quoted
+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.
Thanks, will fix.
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.
Not really. I will add a BUG() to the default case and only ignore the
known cases that we don't want to handle.

Thanks

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help