qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alon Levy <alevy@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 15/20] ccid-card-emulated: review fixes (v15->v16)
Date: Wed,  2 Feb 2011 22:28:15 +0200	[thread overview]
Message-ID: <1296678500-19497-16-git-send-email-alevy@redhat.com> (raw)
In-Reply-To: <1296678500-19497-1-git-send-email-alevy@redhat.com>

 * fix error reporting in initfn
 * bump copyright year
 * update copyright license

Signed-off-by: Alon Levy <alevy@redhat.com>
---
 hw/ccid-card-emulated.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/hw/ccid-card-emulated.c b/hw/ccid-card-emulated.c
index 3c5bf6c..09ce770 100644
--- a/hw/ccid-card-emulated.c
+++ b/hw/ccid-card-emulated.c
@@ -15,10 +15,10 @@
  * If you use a non default db for the certificates you can specify it using the db parameter.
  *
  *
- * Copyright (c) 2010 Red Hat.
+ * Copyright (c) 2011 Red Hat.
  * Written by Alon Levy.
  *
- * This code is licenced under the LGPL.
+ * This code is licenced under the GNU LGPL, version 2 or later.
  */
 
 #include <pthread.h>
@@ -458,20 +458,25 @@ static int emulated_initfn(CCIDCardState *base)
     }
     ASSERT(card->backend); /* 0 is not a value in the enumeration */
     /* TODO: a passthru backened that works on local machine. third card type? */
-    if (card->backend == BACKEND_CERTIFICATES
-        && card->cert1 != NULL && card->cert2 != NULL && card->cert3 != NULL) {
-        ret = emulated_initialize_vcard_from_certificates(card);
-    } else {
-        if (card->backend != BACKEND_CERTIFICATES) {
+    if (card->backend == BACKEND_CERTIFICATES) {
+        if (card->cert1 != NULL && card->cert2 != NULL && card->cert3 != NULL) {
+            ret = emulated_initialize_vcard_from_certificates(card);
+        } else {
             printf("%s: you must provide all three certs for certificates backend\n",
                 EMULATED_DEV_NAME);
             return -1;
         }
+    } else {
         if (card->backend != BACKEND_NSS_EMULATED) {
             printf("%s: bad backend specified. The options are:\n%s (default), %s.\n",
                 EMULATED_DEV_NAME, BACKEND_NSS_EMULATED_NAME, BACKEND_CERTIFICATES_NAME);
             return -1;
         }
+        if (card->cert1 != NULL || card->cert2 != NULL || card->cert3 != NULL) {
+            printf("%s: unexpected cert parameters to nss emulated backend\n",
+                   EMULATED_DEV_NAME);
+            return -1;
+        }
         /* default to mirroring the local hardware readers */
         ret = wrap_vcard_emul_init(NULL);
     }
-- 
1.7.4

  parent reply	other threads:[~2011-02-02 20:29 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-02 20:28 [Qemu-devel] [PATCH 00/20] usb-ccid (v16) Alon Levy
2011-02-02 20:28 ` [Qemu-devel] [PATCH 01/20] qdev: add print_options callback Alon Levy
2011-02-03 16:39   ` Anthony Liguori
2011-02-03 20:54     ` Alon Levy
2011-02-02 20:28 ` [Qemu-devel] [PATCH 02/20] qdev: add data pointer to Property Alon Levy
2011-02-02 20:28 ` [Qemu-devel] [PATCH 03/20] qdev-properties: add PROP_TYPE_ENUM Alon Levy
2011-02-03 16:44   ` Anthony Liguori
2011-02-03 20:59     ` Alon Levy
2011-02-02 20:28 ` [Qemu-devel] [PATCH 04/20] qdev-properties: parse_enum: don't cast a void* Alon Levy
2011-02-02 20:28 ` [Qemu-devel] [PATCH 05/20] usb-ccid: add CCID bus Alon Levy
2011-02-03 16:46   ` Anthony Liguori
2011-02-03 18:53     ` Alon Levy
2011-02-03 19:29       ` Alon Levy
2011-02-02 20:28 ` [Qemu-devel] [PATCH 06/20] usb-ccid: review fixes (v15-v16) Alon Levy
2011-02-03 16:48   ` Anthony Liguori
2011-02-03 18:53     ` Alon Levy
2011-02-02 20:28 ` [Qemu-devel] [PATCH 07/20] introduce libcacard/vscard_common.h Alon Levy
2011-02-02 20:28 ` [Qemu-devel] [PATCH 08/20] libcacard/vscard_common.h update (v15->v16) Alon Levy
2011-02-02 20:28 ` [Qemu-devel] [PATCH 09/20] ccid: add passthru card device Alon Levy
2011-02-02 20:28 ` [Qemu-devel] [PATCH 10/20] ccid-card-passthru: review fixes (v15->v16) Alon Levy
2011-02-02 20:28 ` [Qemu-devel] [PATCH 11/20] libcacard: initial commit after coding style fixes Alon Levy
2011-02-02 20:28 ` [Qemu-devel] [PATCH 12/20] libcacard: fixes from review (v15->v16) Alon Levy
2011-02-02 20:28 ` [Qemu-devel] [PATCH 13/20] ccid: add ccid-card-emulated device (v2) Alon Levy
2011-02-02 20:28 ` [Qemu-devel] [PATCH 14/20] ccid-card-emulated: use PROP_TYPE_ENUM for backend Alon Levy
2011-02-02 20:28 ` Alon Levy [this message]
2011-02-02 20:28 ` [Qemu-devel] [PATCH 16/20] ccid: add docs Alon Levy
2011-02-02 20:28 ` [Qemu-devel] [PATCH 17/20] ccid: configure: add --enable/disable and nss only disable Alon Levy
2011-02-02 20:28 ` [Qemu-devel] [PATCH 18/20] ccid: add qdev description strings Alon Levy
2011-02-02 20:28 ` [Qemu-devel] [PATCH 19/20] smartcard, configure: add --enable-smartcard-nss, report only nss Alon Levy
2011-02-02 20:28 ` [Qemu-devel] [PATCH 20/20] smartcard,configure: " Alon Levy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1296678500-19497-16-git-send-email-alevy@redhat.com \
    --to=alevy@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).