summaryrefslogtreecommitdiff
path: root/ssh-add.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-08-06 21:35:51 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-08-06 21:35:51 +0000
commitf7db3bb64caf8d7822a18d6fd4c0480df7d0086d (patch)
tree3167ed1f115185df591dc1c28c8aa33476194cbb /ssh-add.c
parent3ab1dfa2a654b6764eaa121f7111e94c35175894 (diff)
- markus@cvs.openbsd.org 2001/08/01 22:03:33
[authfd.c authfd.h readconf.c readconf.h scard.c scard.h ssh-add.c ssh-agent.c ssh.c] use strings instead of ints for smartcard reader ids
Diffstat (limited to 'ssh-add.c')
-rw-r--r--ssh-add.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/ssh-add.c b/ssh-add.c
index 711dca5e..b44c306b 100644
--- a/ssh-add.c
+++ b/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>
@@ -150,13 +150,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);
}
@@ -211,7 +211,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;
__progname = get_progname(argv[0]);
init_rng();
@@ -240,11 +241,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();
@@ -254,8 +255,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) {