Skip to content

Commit fda31e1

Browse files
committed
upstream: avoid spurious error message when loading certificates
only bz3869 OpenBSD-Commit-ID: e7848fec50d15cc142fed946aa8f79abef3c5be7
1 parent bcd88de commit fda31e1

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

ssh-add.c

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: ssh-add.c,v 1.180 2025/09/25 07:00:43 djm Exp $ */
1+
/* $OpenBSD: ssh-add.c,v 1.181 2025/09/29 03:17:54 djm Exp $ */
22
/*
33
* Author: Tatu Ylonen <ylo@cs.hut.fi>
44
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -354,26 +354,27 @@ add_file(int agent_fd, const char *filename, int key_only, int cert_only,
354354
skprovider = NULL;
355355
}
356356

357-
if (!cert_only &&
358-
(r = ssh_add_identity_constrained(agent_fd, private, comment,
359-
lifetime, confirm, skprovider,
360-
dest_constraints, ndest_constraints)) == 0) {
361-
ret = 0;
362-
if (!qflag) {
363-
fprintf(stderr, "Identity added: %s (%s)\n",
364-
filename, comment);
365-
if (lifetime != 0) {
366-
fprintf(stderr, "Lifetime set to %s\n",
367-
fmt_timeframe((time_t)lifetime));
368-
}
369-
if (confirm != 0) {
370-
fprintf(stderr, "The user must confirm "
371-
"each use of the key\n");
357+
if (!cert_only) {
358+
if ((r = ssh_add_identity_constrained(agent_fd, private,
359+
comment, lifetime, confirm, skprovider,
360+
dest_constraints, ndest_constraints)) == 0) {
361+
ret = 0;
362+
if (!qflag) {
363+
fprintf(stderr, "Identity added: %s (%s)\n",
364+
filename, comment);
365+
if (lifetime != 0) {
366+
fprintf(stderr, "Lifetime set to %s\n",
367+
fmt_timeframe((time_t)lifetime));
368+
}
369+
if (confirm != 0) {
370+
fprintf(stderr, "The user must confirm "
371+
"each use of the key\n");
372+
}
372373
}
374+
} else {
375+
fprintf(stderr, "Could not add identity \"%s\": %s\n",
376+
filename, ssh_err(r));
373377
}
374-
} else {
375-
fprintf(stderr, "Could not add identity \"%s\": %s\n",
376-
filename, ssh_err(r));
377378
}
378379

379380
/* Skip trying to load the cert if requested */

0 commit comments

Comments
 (0)