summaryrefslogtreecommitdiff
path: root/usr.bin/ssh
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2002-01-29 14:27:58 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2002-01-29 14:27:58 +0000
commitc739c4ff4246270aaea8b91d4b7080990f158850 (patch)
tree4d820e781ce8806762bc32ca18d329a495f9c6c5 /usr.bin/ssh
parentd608d9f4dd387b7b3b72c4ddcaff7fec55fe2eeb (diff)
exit 2 if no agent, exit 1 if list fails; debian#61078; ok djm@
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r--usr.bin/ssh/ssh-add.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.bin/ssh/ssh-add.c b/usr.bin/ssh/ssh-add.c
index 28728f35ef4..c7079f7fb82 100644
--- a/usr.bin/ssh/ssh-add.c
+++ b/usr.bin/ssh/ssh-add.c
@@ -35,7 +35,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh-add.c,v 1.49 2001/12/24 07:29:43 deraadt Exp $");
+RCSID("$OpenBSD: ssh-add.c,v 1.50 2002/01/29 14:27:57 markus Exp $");
#include <openssl/evp.h>
@@ -181,7 +181,7 @@ update_card(AuthenticationConnection *ac, int add, const char *id)
}
}
-static void
+static int
list_identities(AuthenticationConnection *ac, int do_fp)
{
Key *key;
@@ -209,8 +209,11 @@ list_identities(AuthenticationConnection *ac, int do_fp)
xfree(comment);
}
}
- if (!had_identities)
+ if (!had_identities) {
printf("The agent has no identities.\n");
+ return -1;
+ }
+ return 0;
}
static int
@@ -256,13 +259,14 @@ main(int argc, char **argv)
ac = ssh_get_authentication_connection();
if (ac == NULL) {
fprintf(stderr, "Could not open a connection to your authentication agent.\n");
- exit(1);
+ exit(2);
}
while ((ch = getopt(argc, argv, "lLdDe:s:")) != -1) {
switch (ch) {
case 'l':
case 'L':
- list_identities(ac, ch == 'l' ? 1 : 0);
+ if (list_identities(ac, ch == 'l' ? 1 : 0) == -1)
+ ret = 1;
goto done;
break;
case 'd':