summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/ssh-add.c
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2001-08-01 22:03:34 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2001-08-01 22:03:34 +0000
commit8327c54231785fc6d95c26b14198cf8880de1713 (patch)
tree973006234d7fd405eb3a0600b797b4474affb05a /usr.bin/ssh/ssh-add.c
parent760cd39ba07ea3adf7b9ba4c3981b3c47b6cb7bb (diff)
use strings instead of ints for smartcard reader ids
Diffstat (limited to 'usr.bin/ssh/ssh-add.c')
-rw-r--r--usr.bin/ssh/ssh-add.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/usr.bin/ssh/ssh-add.c b/usr.bin/ssh/ssh-add.c
index 961fa5746ba..fa9a5122ecf 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.43 2001/06/27 06:26:36 markus Exp $");
+RCSID("$OpenBSD: ssh-add.c,v 1.44 2001/08/01 22:03:33 markus Exp $");
#include <openssl/evp.h>
@@ -144,13 +144,13 @@ add_file(AuthenticationConnection *ac, const char *filename)
}
static void
-update_card(AuthenticationConnection *ac, int add, int id)
+update_card(AuthenticationConnection *ac, int add, const char *id)
{
if (ssh_update_card(ac, add, id))
- fprintf(stderr, "Card %s: %d\n",
+ fprintf(stderr, "Card %s: %s\n",
add ? "added" : "removed", id);
else
- fprintf(stderr, "Could not %s card: %d\n",
+ fprintf(stderr, "Could not %s card: %s\n",
add ? "add" : "remove", id);
}
@@ -205,7 +205,8 @@ main(int argc, char **argv)
AuthenticationConnection *ac = NULL;
struct passwd *pw;
char buf[1024];
- int i, ch, deleting = 0, sc_reader_num = -1;
+ char *sc_reader_id = NULL;
+ int i, ch, deleting = 0;
SSLeay_add_all_algorithms();
@@ -230,11 +231,11 @@ main(int argc, char **argv)
goto done;
break;
case 's':
- sc_reader_num = atoi(optarg);
+ sc_reader_id = optarg;
break;
case 'e':
deleting = 1;
- sc_reader_num = atoi(optarg);
+ sc_reader_id = optarg;
break;
default:
usage();
@@ -244,8 +245,8 @@ main(int argc, char **argv)
}
argc -= optind;
argv += optind;
- if (sc_reader_num != -1) {
- update_card(ac, !deleting, sc_reader_num);
+ if (sc_reader_id != NULL) {
+ update_card(ac, !deleting, sc_reader_id);
goto done;
}
if (argc == 0) {