summaryrefslogtreecommitdiff
path: root/libcacard/vcard_emul_nss.c
diff options
context:
space:
mode:
authorMarc-André Lureau <mlureau@redhat.com>2013-02-27 21:08:06 +0100
committerAlon Levy <alevy@redhat.com>2013-04-24 11:47:36 +0300
commite2d9c5e769d59f2bca649b8286892d49bdcfc2b1 (patch)
tree3575e680d0a544c23eb7d3979523b283f7e19501 /libcacard/vcard_emul_nss.c
parentda000a4867749434e03896a5072321771736352a (diff)
libcacard: use system config directory for nss db on win32
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 <mlureau@redhat.com> Reviewed-by: Alon Levy <alevy@redhat.com>
Diffstat (limited to 'libcacard/vcard_emul_nss.c')
-rw-r--r--libcacard/vcard_emul_nss.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/libcacard/vcard_emul_nss.c b/libcacard/vcard_emul_nss.c
index df79476db8..21d4689313 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;