86 lines
2.9 KiB
Diff
86 lines
2.9 KiB
Diff
From 2a28dcd3f6e4af7a5b2d7d7810b26b6321dd1bf1 Mon Sep 17 00:00:00 2001
|
|
From: Jakub Jelen <jjelen@redhat.com>
|
|
Date: Tue, 10 Nov 2020 14:44:43 +0100
|
|
Subject: [PATCH 1/3] ctx: Use more standard cache directory
|
|
|
|
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
|
---
|
|
src/libopensc/ctx.c | 9 +++++++--
|
|
1 file changed, 7 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/libopensc/ctx.c b/src/libopensc/ctx.c
|
|
index 6b57170f01..d6058c070e 100644
|
|
--- a/src/libopensc/ctx.c
|
|
+++ b/src/libopensc/ctx.c
|
|
@@ -1008,7 +1008,12 @@ int sc_get_cache_dir(sc_context_t *ctx, char *buf, size_t bufsize)
|
|
}
|
|
|
|
#ifndef _WIN32
|
|
- cache_dir = ".eid/cache";
|
|
+ cache_dir = getenv("XDG_CACHE_HOME");
|
|
+ if (cache_dir != NULL && cache_dir[0] != '\0') {
|
|
+ snprintf(buf, bufsize, "%s/%s", cache_dir, "opensc");
|
|
+ return SC_SUCCESS;
|
|
+ }
|
|
+ cache_dir = ".cache/opensc";
|
|
homedir = getenv("HOME");
|
|
#else
|
|
cache_dir = "eid-cache";
|
|
@@ -1020,7 +1025,7 @@ int sc_get_cache_dir(sc_context_t *ctx, char *buf, size_t bufsize)
|
|
homedir = temp_path;
|
|
}
|
|
#endif
|
|
- if (homedir == NULL)
|
|
+ if (homedir == NULL || homedir[0] == '\0')
|
|
return SC_ERROR_INTERNAL;
|
|
if (snprintf(buf, bufsize, "%s/%s", homedir, cache_dir) < 0)
|
|
return SC_ERROR_BUFFER_TOO_SMALL;
|
|
|
|
From 7c1c6f6be47f55693647827259edcacc98761371 Mon Sep 17 00:00:00 2001
|
|
From: Jakub Jelen <jjelen@redhat.com>
|
|
Date: Tue, 10 Nov 2020 15:07:42 +0100
|
|
Subject: [PATCH 3/3] doc: Update documentation about the cache location
|
|
|
|
---
|
|
doc/files/opensc.conf.5.xml.in | 9 +++++++--
|
|
2 files changed, 11 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/doc/files/opensc.conf.5.xml.in b/doc/files/opensc.conf.5.xml.in
|
|
index 118922a877..791f11669a 100644
|
|
--- a/doc/files/opensc.conf.5.xml.in
|
|
+++ b/doc/files/opensc.conf.5.xml.in
|
|
@@ -1116,12 +1116,17 @@ app <replaceable>application</replaceable> {
|
|
<itemizedlist>
|
|
<listitem>
|
|
<para>
|
|
- <filename><envar>HOME</envar>/.eid/cache/</filename> (Unix)
|
|
+ <filename><envar>$XDG_CACHE_HOME</envar>/opensc/</filename> (If <envar>$XDG_CACHE_HOME</envar> is defined)
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para>
|
|
- <filename><envar>USERPROFILE</envar>\.eid-cache\</filename> (Windows)
|
|
+ <filename><envar>$HOME</envar>/.cache/opensc/</filename> (Unix)
|
|
+ </para>
|
|
+ </listitem>
|
|
+ <listitem>
|
|
+ <para>
|
|
+ <filename><envar>$USERPROFILE</envar>\.eid-cache\</filename> (Windows)
|
|
</para>
|
|
</listitem>
|
|
</itemizedlist>
|
|
|
|
diff -up opensc-0.20.0/etc/opensc.conf.file-cache opensc-0.20.0/etc/opensc.conf
|
|
--- opensc-0.20.0/etc/opensc.conf.file-cache 2020-11-20 16:49:30.995526825 +0100
|
|
+++ opensc-0.20.0/etc/opensc.conf 2020-11-20 16:50:07.665053280 +0100
|
|
@@ -2,7 +2,7 @@ app default {
|
|
# debug = 3;
|
|
# debug_file = opensc-debug.txt;
|
|
framework pkcs15 {
|
|
- # use_file_caching = true;
|
|
+ use_file_caching = true;
|
|
}
|
|
reader_driver pcsc {
|
|
# The pinpad is disabled by default,
|
|
|