OpenCoverageOpenSSH

OpenSSH patch #13 - Test report of the modifications

Overview

Test Execution StatusStatistics
Passed
  0.000% (0/10)
Incident
  0.000% (0/10)
Skipped
  0.000% (0/10)
Failed
  0.000% (0/10)
Requires Manual Checking
  0.000% (0/10)
Unknown
  0.000% (0/10)
All
  0.000% (0/10)
CategoryRemoved LinesInserted LinesTotal
Modified lines executed:
  0.000% (0/23)
  0.000% (0/39)
  0.000% (0/62)
Modified lines not executed:
 95.652% (22/23)
 87.179% (34/39)
 90.323% (56/62)
Source code lines not instrumented:
  4.348% (1/23)
 12.821% (5/39)
  9.677% (6/62)

List of tests executing the changes

Execution NameState

Patch File

Showing: 

Modified File: ssh-add.c

LineTestsDifference Output
diff --git a/ssh-add.c b/ssh-add.c
index adcc4599..627c0298 100644
--- a/ssh-add.c
+++ b/ssh-add.c
@@ -1,4 +1,4 @@
1
-
No equivalent source code line in the reference code can be identified.
-/* $OpenBSD: ssh-add.c,v 1.135 2018/02/23 15:58:37 markus Exp $ */
1
-
+/* $OpenBSD: ssh-add.c,v 1.136 2018/09/19 02:03:02 djm Exp $ */
2 /*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -166,7 +166,7 @@ delete_file(int agent_fd, const char *filename, int key_only, int qflag)
166
167 /* Send a request to remove all identities. */
168 static int
169
0
-delete_all(int agent_fd)
169
-
+delete_all(int agent_fd, int qflag)
170 {
171 int ret = -1;
172
@@ -180,10 +180,10 @@ delete_all(int agent_fd)
180 /* ignore error-code for ssh1 */
181 ssh_remove_all_identities(agent_fd, 1);
182
183
0
- if (ret == 0)
184
0
- fprintf(stderr, "All identities removed.\n");
185
0
- else
183
0
+ if (ret != 0)
186 ➡ 184 fprintf(stderr, "Failed to remove all identities.\n");
185
0
+ else if (!qflag)
186
0
+ fprintf(stderr, "All identities removed.\n");
187
188 return ret;
189 }
@@ -310,14 +310,19 @@ add_file(int agent_fd, const char *filename, int key_only, int qflag)
310
311 if ((r = ssh_add_identity_constrained(agent_fd, private, comment,
312 lifetime, confirm, maxsign)) == 0) {
313
0
- fprintf(stderr, "Identity added: %s (%s)\n", filename, comment);
314 ➡ 313 ret = 0;
315
0
- if (lifetime != 0)
316
0
- fprintf(stderr,
317
0
- "Lifetime set to %d seconds\n", lifetime);
318
0
- if (confirm != 0)
319
0
- fprintf(stderr,
320
0
- "The user must confirm each use of the key\n");
314
0
+ if (!qflag) {
315
0
+ fprintf(stderr, "Identity added: %s (%s)\n",
316
0
+ filename, comment);
317
0
+ if (lifetime != 0) {
318
0
+ fprintf(stderr,
319
0
+ "Lifetime set to %d seconds\n", lifetime);
320
0
+ }
321
0
+ if (confirm != 0) {
322
0
+ fprintf(stderr, "The user must confirm "
323
0
+ "each use of the key\n");
324
0
+ }
325
0
+ }
321 ➡ 326 } else {
322 ➡ 327 fprintf(stderr, "Could not add identity \"%s\": %s\n",
323 ➡ 328 filename, ssh_err(r));
@@ -362,12 +367,20 @@ add_file(int agent_fd, const char *filename, int key_only, int qflag)
362 ➡ 367 private->cert->key_id, ssh_err(r));
363 ➡ 368 goto out;
364 ➡ 369 }
365
0
- fprintf(stderr, "Certificate added: %s (%s)\n", certpath,
366
0
- private->cert->key_id);
367
0
- if (lifetime != 0)
368
0
- fprintf(stderr, "Lifetime set to %d seconds\n", lifetime);
369
0
- if (confirm != 0)
370
0
- fprintf(stderr, "The user must confirm each use of the key\n");
370
-
+ /* success */
371
0
+ if (!qflag) {
372
0
+ fprintf(stderr, "Certificate added: %s (%s)\n", certpath,
373
0
+ private->cert->key_id);
374
0
+ if (lifetime != 0) {
375
0
+ fprintf(stderr, "Lifetime set to %d seconds\n",
376
0
+ lifetime);
377
0
+ }
378
0
+ if (confirm != 0) {
379
0
+ fprintf(stderr, "The user must confirm each use "
380
0
+ "of the key\n");
381
0
+ }
382
0
+ }
383
-
+
371 ➡ 384 out:
372 ➡ 385 free(certpath);
373 ➡ 386 free(comment);
@@ -377,7 +390,7 @@ add_file(int agent_fd, const char *filename, int key_only, int qflag)
377 ➡ 390 }
378 ➡ 391
379 ➡ 392 static int
380
0
-update_card(int agent_fd, int add, const char *id)
393
-
+update_card(int agent_fd, int add, const char *id, int qflag)
381 ➡ 394 {
382 ➡ 395 char *pin = NULL;
383 ➡ 396 int r, ret = -1;
@@ -390,9 +403,11 @@ update_card(int agent_fd, int add, const char *id)
390 ➡ 403
391 ➡ 404 if ((r = ssh_update_card(agent_fd, add, id, pin == NULL ? "" : pin,
392 ➡ 405 lifetime, confirm)) == 0) {
393
0
- fprintf(stderr, "Card %s: %s\n",
394
0
- add ? "added" : "removed", id);
395 ➡ 406 ret = 0;
407
0
+ if (!qflag) {
408
0
+ fprintf(stderr, "Card %s: %s\n",
409
0
+ add ? "added" : "removed", id);
410
0
+ }
396 ➡ 411 } else {
397 ➡ 412 fprintf(stderr, "Could not %s card \"%s\": %s\n",
398 ➡ 413 add ? "add" : "remove", id, ssh_err(r));
@@ -630,7 +645,7 @@ main(int argc, char **argv)
630 ➡ 645 ret = 1;
631 ➡ 646 goto done;
632 ➡ 647 } else if (Dflag) {
633
0
- if (delete_all(agent_fd) == -1)
648
0
+ if (delete_all(agent_fd, qflag) == -1)
634 ➡ 649 ret = 1;
635 ➡ 650 goto done;
636 ➡ 651 }
@@ -638,7 +653,8 @@ main(int argc, char **argv)
638 ➡ 653 argc -= optind;
639 ➡ 654 argv += optind;
640 ➡ 655 if (pkcs11provider != NULL) {
641
0
- if (update_card(agent_fd, !deleting, pkcs11provider) == -1)
656
0
+ if (update_card(agent_fd, !deleting, pkcs11provider,
657
0
+ qflag) == -1)
642 ➡ 658 ret = 1;
643 ➡ 659 goto done;
644 ➡ 660 }

Generated by Squish Coco 4.2.2