From patchwork Wed Feb 27 20:08:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 223688 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BF63D2C0077 for ; Thu, 28 Feb 2013 07:09:25 +1100 (EST) Received: from localhost ([::1]:51089 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAnJX-0000zf-OL for incoming@patchwork.ozlabs.org; Wed, 27 Feb 2013 15:09:19 -0500 Received: from eggs.gnu.org ([208.118.235.92]:45584) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAnJD-0000yY-LL for qemu-devel@nongnu.org; Wed, 27 Feb 2013 15:09:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UAnIs-0000C8-0v for qemu-devel@nongnu.org; Wed, 27 Feb 2013 15:08:53 -0500 Received: from mail-we0-x231.google.com ([2a00:1450:400c:c03::231]:64361) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAnIq-00007k-ND for qemu-devel@nongnu.org; Wed, 27 Feb 2013 15:08:37 -0500 Received: by mail-we0-f177.google.com with SMTP id d7so839872wer.36 for ; Wed, 27 Feb 2013 12:08:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:mime-version :content-type:content-transfer-encoding; bh=+pGqSTrdOuWUD8K6jqrpckqu108bCp9fM4bk6uW02xM=; b=VBn/S9L1G42KM7ytT/WDsznSVelxk31NPYdr/haoZlKMzfn7QIYeA08SHTeRVaoHnk N5U8C6buFYrSFn/WYQVF2lnvKzrNtMKkpj4kFQ95YXGKAQS10qVSpJliaFzonGFvIgOe y9qpk7E0wQMiQWvlH1wDYv6m0GYMz+mYxXbvljpEAqIsA/8nf0yAYLwlTXVqAXtieXQy qkpSjIgyeoxhFxxspYo9aniw8E9hhcsDXDzhAnmWfraXJ41HQAdBktVz0stPhaLmrRBY m715gvOzumhi+6x5hIe6QiV6svbEJvOUOLvYuvfObqeWfHLAqHXBlOVhHzoAOf+C1i2l 6MQA== X-Received: by 10.194.108.101 with SMTP id hj5mr6551069wjb.6.1361995697672; Wed, 27 Feb 2013 12:08:17 -0800 (PST) Received: from localhost (178.Red-83-54-7.dynamicIP.rima-tde.net. [83.54.7.178]) by mx.google.com with ESMTPS id n2sm29450984wiy.6.2013.02.27.12.08.15 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 27 Feb 2013 12:08:16 -0800 (PST) From: "=?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=" To: qemu-devel@nongnu.org Date: Wed, 27 Feb 2013 21:08:06 +0100 Message-Id: <1361995686-22732-1-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 1.8.1.1.439.g50a6b54 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c03::231 Cc: pbonzini@redhat.com, alevy@redhat.com, kraxel@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [Qemu-devel] [PATCH] libcacard: use system config directory for nss db on win32 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org It's a bit nicer to look for default database under CSIDL_COMMON_APPDATA\pki\nss rather that /etc/pki/nss. Signed-off-by: Marc-André Lureau --- libcacard/vcard_emul_nss.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/libcacard/vcard_emul_nss.c b/libcacard/vcard_emul_nss.c index df79476..21d4689 100644 --- a/libcacard/vcard_emul_nss.c +++ b/libcacard/vcard_emul_nss.c @@ -893,7 +893,23 @@ vcard_emul_init(const VCardEmulOptions *options) if (options->nss_db) { rv = NSS_Init(options->nss_db); } else { - rv = NSS_Init("sql:/etc/pki/nssdb"); + gchar *path, *db; +#ifndef _WIN32 + path = g_strdup("/etc/pki/nssdb"); +#else + if (g_get_system_config_dirs() == NULL || + g_get_system_config_dirs()[0] == NULL) { + return VCARD_EMUL_FAIL; + } + + path = g_build_filename( + g_get_system_config_dirs()[0], "pki", "nssdb", NULL); +#endif + db = g_strdup_printf("sql:%s", path); + + rv = NSS_Init(db); + g_free(db); + g_free(path); } if (rv != SECSuccess) { return VCARD_EMUL_FAIL;