From patchwork Mon Mar 18 13:10:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 228622 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 AD0F92C0097 for ; Tue, 19 Mar 2013 00:12:24 +1100 (EST) Received: from localhost ([::1]:49642 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHZrR-000478-Q3 for incoming@patchwork.ozlabs.org; Mon, 18 Mar 2013 09:12:21 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60945) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHZqd-0003sG-AJ for qemu-devel@nongnu.org; Mon, 18 Mar 2013 09:11:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UHZqV-0000kM-T1 for qemu-devel@nongnu.org; Mon, 18 Mar 2013 09:11:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45349) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHZqV-0000k9-C1 for qemu-devel@nongnu.org; Mon, 18 Mar 2013 09:11:23 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2IDBMi9014126 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 18 Mar 2013 09:11:22 -0400 Received: from garlic.tlv.redhat.com (spice-ovirt.tlv.redhat.com [10.35.4.71]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r2IDBCvs032376; Mon, 18 Mar 2013 09:11:22 -0400 From: Alon Levy To: qemu-devel@nongnu.org Date: Mon, 18 Mar 2013 15:10:51 +0200 Message-Id: <1363612272-13713-6-git-send-email-alevy@redhat.com> In-Reply-To: <1363612272-13713-1-git-send-email-alevy@redhat.com> References: <1363612272-13713-1-git-send-email-alevy@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id r2IDBMi9014126 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: mlureau@redhat.com Subject: [Qemu-devel] [PATCH 05/26] 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 From: Marc-André Lureau 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;