qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 15/20] ccid-card-emulated: review fixes (v15->v16)


From: Alon Levy
Subject: [Qemu-devel] [PATCH 15/20] ccid-card-emulated: review fixes (v15->v16)
Date: Wed, 2 Feb 2011 22:28:15 +0200

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

Signed-off-by: Alon Levy <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]