Bug 723567

Summary: virtual smardcard support doesn't work
Product: Red Hat Enterprise Linux 6 Reporter: Gerd Hoffmann <kraxel>
Component: spice-clientAssignee: Alon Levy <alevy>
Status: CLOSED ERRATA QA Contact: Desktop QE <desktop-qa-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.2CC: alevy, cmeadors, dblechte, djasa, mkenneth, tpelka, uril
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: spice-client-0.8.2-1.el6 spicec-win-0.1-5 Doc Type: Bug Fix
Doc Text:
Cause The --smartcard-db client command line option was not handled. Consequence Using --smartcard-db on the client results in an error message Error: unhandled exception: cmd line error. Fix Handle the --smartcard-db option Result "--smartcard-db" is now handled.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 15:22:37 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Gerd Hoffmann 2011-07-20 15:26:27 UTC
Description of problem:
smardcard support doesn't work

Version-Release number of selected component (if applicable):
spice-client-0.8.0-2.el6.x86_64

How reproducible:
spicec -h localhost -p 5900 --smartcard --smartcard-db /home/kraxel/projects/ccid/db/ --smartcard-cert fedora,test1,test2

Actual results:
get an error message:
Error: unhandled exception: cmd line error

Expected results:
Works.

Additional info:
Tried to build from latest spice git tree instead.
spicec accepts the command line then, but crashes.

Comment 1 Gerd Hoffmann 2011-07-20 15:34:03 UTC
script which creates the certificate db:

#!/bin/sh

DB="$(pwd)/db"

echo "### reinit $DB"
rm -rf "$DB"
mkdir "$DB"

set -ex
certutil -d "$DB" -N
certutil -d "$DB" -t "CT,C,C" -n test1   -S -s "CN=test1" -x -v 24
certutil -d "$DB" -t "CT,C,C" -n test2   -S -s "CN=test2" -x -v 24
certutil -d "$DB" -t "CT,C,C" -n test3   -S -s "CN=test3" -x -v 24
certutil -d "$DB" -t "CT,C,C" -n fedora  -A -i ~/.fedora.cert
certutil -d "$DB" -L

Comment 4 Alon Levy 2011-07-20 18:28:03 UTC
Fixed by upstream commit e1ec222.

commit e1ec222e8bdf4b02f511666656ce1d6bd60d0988
Author: Alon Levy <alevy>
Date:   Fri Mar 4 09:36:49 2011 +0200

    client/smartcard: handle the --smartcard-db option

diff --git a/client/application.cpp b/client/application.cpp
index ea88dc5..9257eb2 100644
--- a/client/application.cpp
+++ b/client/application.cpp
@@ -2271,7 +2271,7 @@ bool Application::process_cmd_line(int argc, char** argv, bool &full_screen)
     parser.add(SPICE_OPT_SMARTCARD_CERT, "smartcard-cert", "Use virtual reader+card with given cert(s)",
         "smartcard-cert", true);
     parser.set_multi(SPICE_OPT_SMARTCARD_CERT, ',');
-    parser.add(SPICE_OPT_SMARTCARD_DB, "smartcard-db", "Use given db for smartcard certs");
+    parser.add(SPICE_OPT_SMARTCARD_DB, "smartcard-db", "Use given db for smartcard certs", "smartcard-db", true);
 #endif
 
     for (int i = SPICE_CHANNEL_MAIN; i < SPICE_END_CHANNEL; i++) {
@@ -2395,6 +2395,9 @@ bool Application::process_cmd_line(int argc, char** argv, bool &full_screen)
                     _smartcard_options->certs.end(), std::string(val));
             } while ((val=parser.next_argument()));
             break;
+        case SPICE_OPT_SMARTCARD_DB:
+            _smartcard_options->dbname = val;
+            break;
 #endif
         case CmdLineParser::OPTION_HELP:
             parser.show_help();

Comment 10 David Jaša 2011-10-19 12:14:39 UTC
VERIFIED in spice-client-0.8.2-7.el6.x86_64

Comment 11 Alon Levy 2011-11-21 10:27:10 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause
    The --smartcard-db client command line option was not handled.
Consequence
    Using --smartcard-db on the client results in an error message Error: unhandled exception: cmd line error.
Fix
    Handle the --smartcard-db option
Result
    "--smartcard-db" is now handled.

Comment 12 errata-xmlrpc 2011-12-06 15:22:37 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2011-1518.html