From 94baf30d14ec1fb5b483ccca983d9faf3ef0ae2e Mon Sep 17 00:00:00 2001 From: Ben Lindstrom Date: Mon, 6 Aug 2001 21:25:38 +0000 Subject: - jakob@cvs.openbsd.org 2001/07/31 08:41:10 [scard.c] do not complain about missing smartcards. ok markus@ --- ChangeLog | 5 ++++- scard.c | 12 +++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0ddd6786d..4ad73258c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -72,6 +72,9 @@ >I am not sure which version of my old code you are using but I am >happy for the notice above to be substituted for my existing copyright >intent if this meets your purpose. + - jakob@cvs.openbsd.org 2001/07/31 08:41:10 + [scard.c] + do not complain about missing smartcards. ok markus@ 20010803 - (djm) Fix interrupted read in entropy gatherer. Spotted by markus@ on @@ -6182,4 +6185,4 @@ - Wrote replacements for strlcpy and mkdtemp - Released 1.0pre1 -$Id: ChangeLog,v 1.1444 2001/08/06 21:24:11 mouring Exp $ +$Id: ChangeLog,v 1.1445 2001/08/06 21:25:38 mouring Exp $ diff --git a/scard.c b/scard.c index 951d868c8..9f22fdf39 100644 --- a/scard.c +++ b/scard.c @@ -24,7 +24,7 @@ #ifdef SMARTCARD #include "includes.h" -RCSID("$OpenBSD: scard.c,v 1.8 2001/07/30 16:06:07 jakob Exp $"); +RCSID("$OpenBSD: scard.c,v 1.9 2001/07/31 08:41:10 jakob Exp $"); #include #include @@ -62,7 +62,7 @@ sc_open(void) return SCARD_ERROR_FAIL; } if (! sectok_cardpresent(sc_fd)) { - error("smartcard in reader %d not present, skipping", + debug("smartcard in reader %d not present, skipping", sc_reader_num); return SCARD_ERROR_NOCARD; } @@ -328,13 +328,19 @@ Key * sc_get_key(int num) { Key *k; + int status; sc_reader_num = num; k = key_new(KEY_RSA); if (k == NULL) { return NULL; } - if (sc_read_pubkey(k) < 0) { + status = sc_read_pubkey(k); + if (status == SCARD_ERROR_NOCARD) { + key_free(k); + return NULL; + } + if (status < 0 ) { error("sc_read_pubkey failed"); key_free(k); return NULL; -- cgit v1.2.3