[openssh-commits] [openssh] 17/18: upstream: check valid before merging

git+noreply at mindrot.org git+noreply at mindrot.org
Wed Nov 25 19:56:12 AEDT 2026


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit 0ff72cd88814b57cf8c6040c5e98575b4341321a
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Fri Nov 20 22:53:47 2026 +0000

    upstream: check valid before merging
    
    OpenBSD-Regress-ID: bc4182bafaae3548b207eb8f7319eaf9400bc610
---
 regress/unittests/authopt/tests.c | 43 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)

diff --git a/regress/unittests/authopt/tests.c b/regress/unittests/authopt/tests.c
index 18265edcf..5a2ed8013 100644
--- a/regress/unittests/authopt/tests.c
+++ b/regress/unittests/authopt/tests.c
@@ -1,4 +1,4 @@
-/* 	$OpenBSD: tests.c,v 1.7 2026/09/16 04:56:12 djm Exp $ */
+/* 	$OpenBSD: tests.c,v 1.8 2026/11/20 22:53:47 djm Exp $ */
 
 /*
  * Regress test for keys options functions.
@@ -102,6 +102,7 @@ compare_opts(const struct sshauthopt *opts,
 	FLAG_EQ(restricted);
 	FLAG_EQ(cert_authority);
 #undef FLAG_EQ
+	ASSERT_U64_EQ(opts->valid_before, expected->valid_before);
 
 #define STR_EQ(x) \
 	do { \
@@ -561,6 +562,46 @@ test_merge(void)
 	expected->env = commasplit("foo=a,bar=b", &expected->nenv);
 	CHECK_SUCCESS_AND_CLEANUP();
 	TEST_DONE();
+
+	PREPARE("expiry-time primary only", "all_permit",
+	    "expiry-time=\"20300101\"");
+	expected = default_authkey_opts();
+	expected->valid_before = key_opts->valid_before;
+	ASSERT_U64_NE(expected->valid_before, 0);
+	CHECK_SUCCESS_AND_CLEANUP();
+	TEST_DONE();
+
+	TEST_START("sshauthopt_merge expiry-time additional only");
+	key_opts = default_authkey_opts();
+	cert_opts = sshauthopt_parse("expiry-time=\"20300101\"", &errstr);
+	ASSERT_PTR_NE(cert_opts, NULL);
+	merge_opts = sshauthopt_merge(key_opts, cert_opts, &errstr);
+	expected = default_authkey_opts();
+	expected->valid_before = cert_opts->valid_before;
+	compare_opts(merge_opts, expected);
+	sshauthopt_free(expected);
+	sshauthopt_free(merge_opts);
+	sshauthopt_free(key_opts);
+	sshauthopt_free(cert_opts);
+	TEST_DONE();
+
+	TEST_START("sshauthopt_merge expiry-time earliest wins");
+	key_opts = sshauthopt_parse("expiry-time=\"20310101\"", &errstr);
+	ASSERT_PTR_NE(key_opts, NULL);
+	cert_opts = sshauthopt_parse("expiry-time=\"20300101\"", &errstr);
+	ASSERT_PTR_NE(cert_opts, NULL);
+	merge_opts = sshauthopt_merge(key_opts, cert_opts, &errstr);
+	expected = default_authkey_opts();
+	expected->valid_before = cert_opts->valid_before;
+	compare_opts(merge_opts, expected);
+	sshauthopt_free(merge_opts);
+	merge_opts = sshauthopt_merge(cert_opts, key_opts, &errstr);
+	compare_opts(merge_opts, expected);
+	sshauthopt_free(expected);
+	sshauthopt_free(merge_opts);
+	sshauthopt_free(key_opts);
+	sshauthopt_free(cert_opts);
+	TEST_DONE();
 }
 
 void

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list