From patchwork Mon Apr 22 15:04:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 238568 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 A68052C009F for ; Tue, 23 Apr 2013 01:10:16 +1000 (EST) Received: from localhost ([::1]:33137 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUINh-0005qb-Bc for incoming@patchwork.ozlabs.org; Mon, 22 Apr 2013 11:10:13 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53178) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUIIu-0000DN-5O for qemu-devel@nongnu.org; Mon, 22 Apr 2013 11:05:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UUIIo-0001UM-Vl for qemu-devel@nongnu.org; Mon, 22 Apr 2013 11:05:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56810) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUIIo-0001U7-Ml for qemu-devel@nongnu.org; Mon, 22 Apr 2013 11:05:10 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3MF5AVD017589 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 22 Apr 2013 11:05:10 -0400 Received: from localhost.localdomain (vpn1-6-224.ams2.redhat.com [10.36.6.224]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3MF4xGo020026; Mon, 22 Apr 2013 11:05:08 -0400 From: Alon Levy To: qemu-devel@nongnu.org Date: Mon, 22 Apr 2013 18:04:35 +0300 Message-Id: <1366643098-2566-6-git-send-email-alevy@redhat.com> In-Reply-To: <1366643098-2566-1-git-send-email-alevy@redhat.com> References: <1366643098-2566-1-git-send-email-alevy@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id r3MF5AVD017589 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 v3 05/28] 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;