]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream commit
authormarkus@openbsd.org <markus@openbsd.org>
Wed, 25 Mar 2015 19:29:58 +0000 (19:29 +0000)
committerDamien Miller <djm@mindrot.org>
Fri, 27 Mar 2015 01:02:16 +0000 (12:02 +1100)
ignore v1 errors on ssh-add -D; only try v2 keys on
 -l/-L (unless WITH_SSH1) ok djm@

ssh-add.c

index 98d46d3e5eadce99711245af0d89054efd3ba33f..37e4cc580509e2ca66357e78558b9bdb7eb1b541 100644 (file)
--- a/ssh-add.c
+++ b/ssh-add.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-add.c,v 1.120 2015/02/21 21:46:57 halex Exp $ */
+/* $OpenBSD: ssh-add.c,v 1.121 2015/03/25 19:29:58 markus Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -164,11 +164,10 @@ delete_all(int agent_fd)
 {
        int ret = -1;
 
-       if (ssh_remove_all_identities(agent_fd, 1) == 0)
+       if (ssh_remove_all_identities(agent_fd, 2) == 0)
                ret = 0;
-       /* ignore error-code for ssh2 */
-       /* XXX revisit */
-       ssh_remove_all_identities(agent_fd, 2);
+       /* ignore error-code for ssh1 */
+       ssh_remove_all_identities(agent_fd, 1);
 
        if (ret == 0)
                fprintf(stderr, "All identities removed.\n");
@@ -364,11 +363,16 @@ static int
 list_identities(int agent_fd, int do_fp)
 {
        char *fp;
-       int version, r, had_identities = 0;
+       int r, had_identities = 0;
        struct ssh_identitylist *idlist;
        size_t i;
+#ifdef WITH_SSH1
+       int version = 1;
+#else
+       int version = 2;
+#endif
 
-       for (version = 1; version <= 2; version++) {
+       for (; version <= 2; version++) {
                if ((r = ssh_fetch_identitylist(agent_fd, version,
                    &idlist)) != 0) {
                        if (r != SSH_ERR_AGENT_NO_IDENTITIES)