[openssh-commits] [openssh] 10/13: upstream: when building a KRL from a control file, do not treat a
git+noreply at mindrot.org
git+noreply at mindrot.org
Fri Nov 27 08:18:26 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 f154eff2a9e8796ddb3034acda677af9016d945e
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Thu Nov 26 20:09:35 2026 +0000
upstream: when building a KRL from a control file, do not treat a
# character that is not at the start of a line or preceeded by whitespace as
the start of a comment, as key IDs may legitimately contain these
Anthropic ANT-2026-ZF4XFAKS
OpenBSD-Commit-ID: 6f040cc449ba7a7ea0d12a24f38f7abd3f22e207
---
ssh-keygen.1 | 9 +++++++--
ssh-keygen.c | 13 +++++++++----
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/ssh-keygen.1 b/ssh-keygen.1
index 13ee7be51..8877ad6cc 100644
--- a/ssh-keygen.1
+++ b/ssh-keygen.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ssh-keygen.1,v 1.245 2026/11/25 08:48:52 djm Exp $
+.\" $OpenBSD: ssh-keygen.1,v 1.246 2026/11/26 20:09:35 djm Exp $
.\"
.\" Author: Tatu Ylonen <ylo at cs.hut.fi>
.\" Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -35,7 +35,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: November 25 2026 $
+.Dd $Mdocdate: November 26 2026 $
.Dt SSH-KEYGEN 1
.Os
.Sh NAME
@@ -1204,6 +1204,11 @@ certificates by serial number or key ID without having the complete original
certificate on hand.
A KRL specification consists of lines containing one of the following directives
followed by a colon and some directive-specific information.
+Empty lines and leading or trailing whitespace are ignored.
+A
+.Ql #
+at the start of a line or following whitespace begins a comment that
+extends to the end of the line.
.Bl -tag -width Ds
.It Cm serial : Ar serial_number Ns Op - Ns Ar serial_number
Revokes a certificate with the specified serial number.
diff --git a/ssh-keygen.c b/ssh-keygen.c
index acf8eb61a..52b3914f1 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keygen.c,v 1.504 2026/11/26 06:24:26 djm Exp $ */
+/* $OpenBSD: ssh-keygen.c,v 1.505 2026/11/26 20:09:35 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo at cs.hut.fi>
* Copyright (c) 1994 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -2380,13 +2380,18 @@ update_krl_from_file(struct passwd *pw, const char *file, int wild_ca,
lnum++;
was_explicit_key = was_sha1 = was_sha256 = was_hash = 0;
cp = line + strspn(line, " \t");
- /* Trim trailing space, comments and strip \n */
+ /*
+ * Trim trailing space, comments and strip \n. A '#' starts a
+ * comment only at the start of the line or after whitespace,
+ * since key IDs may legitimately contain this character.
+ */
for (i = 0, r = -1; cp[i] != '\0'; i++) {
- if (cp[i] == '#' || cp[i] == '\n') {
+ if (cp[i] == '\n' ||
+ (cp[i] == '#' && (i == 0 || r != -1))) {
cp[i] = '\0';
break;
}
- if (cp[i] == ' ' || cp[i] == '\t') {
+ if (cp[i] == ' ' || cp[i] == '\t' || cp[i] == '\r') {
/* Remember the start of a span of whitespace */
if (r == -1)
r = i;
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list