From patchwork Wed Feb 2 20:28:15 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 81539 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 27E69B70EE for ; Thu, 3 Feb 2011 07:48:15 +1100 (EST) Received: from localhost ([127.0.0.1]:39120 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PkjcD-00082I-I3 for incoming@patchwork.ozlabs.org; Wed, 02 Feb 2011 15:47:49 -0500 Received: from [140.186.70.92] (port=54501 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PkjKK-0007zy-N0 for qemu-devel@nongnu.org; Wed, 02 Feb 2011 15:29:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PkjKC-0000Os-Ii for qemu-devel@nongnu.org; Wed, 02 Feb 2011 15:29:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:26673) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PkjKC-0000Of-Bw for qemu-devel@nongnu.org; Wed, 02 Feb 2011 15:29:12 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p12KTB3E006273 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 2 Feb 2011 15:29:11 -0500 Received: from playa.redhat.com (vpn-200-14.tlv.redhat.com [10.35.200.14]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p12KSLpf025755 for ; Wed, 2 Feb 2011 15:29:10 -0500 From: Alon Levy To: qemu-devel@nongnu.org Date: Wed, 2 Feb 2011 22:28:15 +0200 Message-Id: <1296678500-19497-16-git-send-email-alevy@redhat.com> In-Reply-To: <1296678500-19497-1-git-send-email-alevy@redhat.com> References: <1296678500-19497-1-git-send-email-alevy@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 15/20] ccid-card-emulated: review fixes (v15->v16) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org * fix error reporting in initfn * bump copyright year * update copyright license Signed-off-by: Alon Levy --- 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 @@ -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); }