|
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 $ */ |
2 | 2 | /* |
3 | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | 4 | * 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, |
354 | 354 | skprovider = NULL; |
355 | 355 | } |
356 | 356 |
|
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 | + } |
372 | 373 | } |
| 374 | + } else { |
| 375 | + fprintf(stderr, "Could not add identity \"%s\": %s\n", |
| 376 | + filename, ssh_err(r)); |
373 | 377 | } |
374 | | - } else { |
375 | | - fprintf(stderr, "Could not add identity \"%s\": %s\n", |
376 | | - filename, ssh_err(r)); |
377 | 378 | } |
378 | 379 |
|
379 | 380 | /* Skip trying to load the cert if requested */ |
|
0 commit comments