Mercurial > trustbridge
changeset 308:ab69d268b5c8
Add NSS shared DB on Linux to stores operated on.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Thu, 03 Apr 2014 18:23:09 +0200 |
parents | a0c5eba8eb41 |
children | fa37384b86b6 |
files | cinst/mozilla.c |
diffstat | 1 files changed, 27 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/cinst/mozilla.c Wed Apr 02 15:31:42 2014 +0200 +++ b/cinst/mozilla.c Thu Apr 03 18:23:09 2014 +0200 @@ -66,6 +66,7 @@ #ifndef _WIN32 #define CONFDIRS ".mozilla", ".thunderbird" +#define NSSSHARED ".pki/nssdb" #define TARGET_LINUX 1 #else #define CONFDIRS "Mozilla", "Thunderbird" @@ -281,10 +282,11 @@ * caller. */ static char** -get_all_profile_dirs() +get_all_nssdb_dirs() { char **mozinis, **pdirs; char **alldirs = NULL; + /* Search Mozilla/Firefox/Thunderbird profiles */ if ((mozinis = get_profile_inis()) != NULL) { for (int i=0; mozinis[i] != NULL; i++) @@ -302,6 +304,19 @@ } strv_free(mozinis); } + /* Search for NSS shared DB (used by Chrome/Chromium on GNU/Linux) */ + if (TARGET_LINUX) + { + char buf[LINEBUFLEN], *fqpath; + snprintf(buf, LINEBUFLEN, "%s/%s", + get_conf_basedir(), NSSSHARED); + if ((fqpath = port_realpath(buf)) != NULL) + { + snprintf(buf, LINEBUFLEN, "sql:%s", fqpath); + strv_append(&alldirs, buf, strlen(buf)); + free(fqpath); + } + } return alldirs; } @@ -585,36 +600,36 @@ int main () { - char **pdirs; + char **dbdirs; seciteml_t *certs_to_remove = NULL; seciteml_t *certs_to_add = NULL; - pdirs = - get_all_profile_dirs(); + dbdirs = + get_all_nssdb_dirs(); - if (pdirs != NULL) + if (dbdirs != NULL) { parse_commands(&certs_to_add, &certs_to_remove); #ifdef DEBUGOUTPUT DEBUGPRINTF("OLD List of installed certs:\n"); - for (int i=0; pdirs[i] != NULL; i++) - DEBUG_nss_list_certs(pdirs[i]); + for (int i=0; dbdirs[i] != NULL; i++) + DEBUG_nss_list_certs(dbdirs[i]); #endif - if (! apply_to_certs_and_profiles(remove_cert, &certs_to_remove, pdirs)) + if (! apply_to_certs_and_profiles(remove_cert, &certs_to_remove, dbdirs)) return_code |= WARN_MOZ_COULD_NOT_REMOVE_CERT; - if (! apply_to_certs_and_profiles(import_cert, &certs_to_add, pdirs)) + if (! apply_to_certs_and_profiles(import_cert, &certs_to_add, dbdirs)) return_code |= WARN_MOZ_COULD_NOT_ADD_CERT; #ifdef DEBUGOUTPUT DEBUGPRINTF("NEW List of installed certs:\n"); - for (int i=0; pdirs[i] != NULL; i++) - DEBUG_nss_list_certs(pdirs[i]); + for (int i=0; dbdirs[i] != NULL; i++) + DEBUG_nss_list_certs(dbdirs[i]); #endif - strv_free(pdirs); + strv_free(dbdirs); } exit(return_code); }