| OLD | NEW |
| 1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 /* | 4 /* |
| 5 * This file implements PKCS 11 on top of our existing security modules | 5 * This file implements PKCS 11 on top of our existing security modules |
| 6 * | 6 * |
| 7 * For more information about PKCS 11 See PKCS 11 Token Inteface Standard. | 7 * For more information about PKCS 11 See PKCS 11 Token Inteface Standard. |
| 8 * This implementation has two slots: | 8 * This implementation has two slots: |
| 9 * slot 1 is our generic crypto support. It does not require login. | 9 * slot 1 is our generic crypto support. It does not require login. |
| 10 * It supports Public Key ops, and all they bulk ciphers and hashes. | 10 * It supports Public Key ops, and all they bulk ciphers and hashes. |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 "/var/tmp", | 228 "/var/tmp", |
| 229 "/usr/tmp", | 229 "/usr/tmp", |
| 230 "/tmp", | 230 "/tmp", |
| 231 NULL /* List terminator */ | 231 NULL /* List terminator */ |
| 232 }; | 232 }; |
| 233 unsigned int i; | 233 unsigned int i; |
| 234 struct stat buf; | 234 struct stat buf; |
| 235 const char *zDir = NULL; | 235 const char *zDir = NULL; |
| 236 | 236 |
| 237 azDirs[0] = sqlite3_temp_directory; | 237 azDirs[0] = sqlite3_temp_directory; |
| 238 azDirs[1] = getenv("TMPDIR"); | 238 azDirs[1] = PR_GetEnvSecure("TMPDIR"); |
| 239 | 239 |
| 240 for (i = 0; i < PR_ARRAY_SIZE(azDirs); i++) { | 240 for (i = 0; i < PR_ARRAY_SIZE(azDirs); i++) { |
| 241 zDir = azDirs[i]; | 241 zDir = azDirs[i]; |
| 242 if (zDir == NULL) continue; | 242 if (zDir == NULL) continue; |
| 243 if (stat(zDir, &buf)) continue; | 243 if (stat(zDir, &buf)) continue; |
| 244 if (!S_ISDIR(buf.st_mode)) continue; | 244 if (!S_ISDIR(buf.st_mode)) continue; |
| 245 if (access(zDir, 07)) continue; | 245 if (access(zDir, 07)) continue; |
| 246 break; | 246 break; |
| 247 } | 247 } |
| 248 | 248 |
| (...skipping 1606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1855 * NSS_SDB_USE_CACHE environment variable is set to "no": cache will not | 1855 * NSS_SDB_USE_CACHE environment variable is set to "no": cache will not |
| 1856 * be used. | 1856 * be used. |
| 1857 * | 1857 * |
| 1858 * NSS_SDB_USE_CACHE environment variable is set to "yes": cache will | 1858 * NSS_SDB_USE_CACHE environment variable is set to "yes": cache will |
| 1859 * always be used. | 1859 * always be used. |
| 1860 * | 1860 * |
| 1861 * It is expected that most applications would use the "auto" selection, | 1861 * It is expected that most applications would use the "auto" selection, |
| 1862 * the environment variable is primarily to simplify testing, and to | 1862 * the environment variable is primarily to simplify testing, and to |
| 1863 * correct potential corner cases where */ | 1863 * correct potential corner cases where */ |
| 1864 | 1864 |
| 1865 env = PR_GetEnv("NSS_SDB_USE_CACHE"); | 1865 env = PR_GetEnvSecure("NSS_SDB_USE_CACHE"); |
| 1866 | 1866 |
| 1867 if (env && PORT_Strcasecmp(env,"no") == 0) { | 1867 if (env && PORT_Strcasecmp(env,"no") == 0) { |
| 1868 enableCache = PR_FALSE; | 1868 enableCache = PR_FALSE; |
| 1869 } else if (env && PORT_Strcasecmp(env,"yes") == 0) { | 1869 } else if (env && PORT_Strcasecmp(env,"yes") == 0) { |
| 1870 enableCache = PR_TRUE; | 1870 enableCache = PR_TRUE; |
| 1871 } else { | 1871 } else { |
| 1872 char *tempDir = NULL; | 1872 char *tempDir = NULL; |
| 1873 PRUint32 tempOps = 0; | 1873 PRUint32 tempOps = 0; |
| 1874 /* | 1874 /* |
| 1875 * Use PR_Access to determine how expensive it | 1875 * Use PR_Access to determine how expensive it |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2006 goto loser; | 2006 goto loser; |
| 2007 } | 2007 } |
| 2008 } | 2008 } |
| 2009 #endif | 2009 #endif |
| 2010 | 2010 |
| 2011 /* how long does it take to test for a non-existant file in our working | 2011 /* how long does it take to test for a non-existant file in our working |
| 2012 * directory? Allows us to test if we may be on a network file system */ | 2012 * directory? Allows us to test if we may be on a network file system */ |
| 2013 accessOps = 1; | 2013 accessOps = 1; |
| 2014 { | 2014 { |
| 2015 char *env; | 2015 char *env; |
| 2016 env = PR_GetEnv("NSS_SDB_USE_CACHE"); | 2016 env = PR_GetEnvSecure("NSS_SDB_USE_CACHE"); |
| 2017 /* If the environment variable is set to yes or no, sdb_init() will | 2017 /* If the environment variable is set to yes or no, sdb_init() will |
| 2018 * ignore the value of accessOps, and we can skip the measuring.*/ | 2018 * ignore the value of accessOps, and we can skip the measuring.*/ |
| 2019 if (!env || ((PORT_Strcasecmp(env, "no") != 0) && | 2019 if (!env || ((PORT_Strcasecmp(env, "no") != 0) && |
| 2020 (PORT_Strcasecmp(env, "yes") != 0))){ | 2020 (PORT_Strcasecmp(env, "yes") != 0))){ |
| 2021 accessOps = sdb_measureAccess(directory); | 2021 accessOps = sdb_measureAccess(directory); |
| 2022 } | 2022 } |
| 2023 } | 2023 } |
| 2024 | 2024 |
| 2025 /* | 2025 /* |
| 2026 * open the cert data base | 2026 * open the cert data base |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2078 s_shutdown() | 2078 s_shutdown() |
| 2079 { | 2079 { |
| 2080 #ifdef SQLITE_UNSAFE_THREADS | 2080 #ifdef SQLITE_UNSAFE_THREADS |
| 2081 if (sqlite_lock) { | 2081 if (sqlite_lock) { |
| 2082 PR_DestroyLock(sqlite_lock); | 2082 PR_DestroyLock(sqlite_lock); |
| 2083 sqlite_lock = NULL; | 2083 sqlite_lock = NULL; |
| 2084 } | 2084 } |
| 2085 #endif | 2085 #endif |
| 2086 return CKR_OK; | 2086 return CKR_OK; |
| 2087 } | 2087 } |
| OLD | NEW |