Skip to content

Commit 080f804

Browse files
committed
1 parent 7de2037 commit 080f804

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

src/tools/pkcs11-register.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,10 @@ add_module_firefox(const char *module_path, const char *module_name, const char
230230
#elif defined(_WIN32)
231231
{"APPDATA", "Mozilla\\Firefox"},
232232
#else
233-
{"HOME", ".mozilla/firefox"},
234-
{"HOME", ".mozilla/firefox-esr"},
233+
{"XDG_CONFIG_HOME", "mozilla/firefox"}, /* Firefox >= 147 XDG profile */
234+
{"HOME", ".config/mozilla/firefox"}, /* XDG default when XDG_CONFIG_HOME unset */
235+
{"HOME", ".mozilla/firefox"},
236+
{"HOME", ".mozilla/firefox-esr"},
235237
#endif
236238
};
237239

@@ -294,6 +296,16 @@ add_module_chrome(const char *module_path, const char *module_name, const char *
294296
"%s%c%s", home, path_sep, ".pki/nssdb")) {
295297
add_module_pkcs11_txt(profile_path, module_path, module_name, exclude_module_path);
296298
}
299+
300+
/* Chrome M146+ uses XDG_DATA_HOME/pki/nssdb when ~/.pki doesn't exist */
301+
const char *xdg_data_home = getenv("XDG_DATA_HOME");
302+
if (xdg_data_home && 0 <= snprintf(profile_path, sizeof profile_path,
303+
"%s%c%s", xdg_data_home, path_sep, "pki/nssdb")) {
304+
add_module_pkcs11_txt(profile_path, module_path, module_name, exclude_module_path);
305+
} else if (home && 0 <= snprintf(profile_path, sizeof profile_path,
306+
"%s%c%s", home, path_sep, ".local/share/pki/nssdb")) {
307+
add_module_pkcs11_txt(profile_path, module_path, module_name, exclude_module_path);
308+
}
297309
#endif
298310
}
299311

src/tools/pkcs11-register.desktop.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@ Name=Install OpenSC PKCS#11 module
33
Type=Application
44
Exec=@bindir@/pkcs11-register --skip-chrome=off --skip-firefox=off
55
Categories=Security;System;
6-
X-GNOME-AutoRestart=true
7-
X-GNOME-Autostart-Phase=Initialization
86
NoDisplay=true

0 commit comments

Comments
 (0)