Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Unified Diff: base/nss_util.cc

Issue 6672034: Load additional NSS library files in zygote main if remoting is enabled (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/nss_util.h ('k') | content/browser/zygote_main_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/nss_util.cc
diff --git a/base/nss_util.cc b/base/nss_util.cc
index e4d1762baa75c572b07458bb43f3eed465edc922..3229149601abb9a42caafb06371fb455ea6c0e21 100644
--- a/base/nss_util.cc
+++ b/base/nss_util.cc
@@ -18,10 +18,14 @@
#include <sys/vfs.h>
#endif
+#include <vector>
+
#include "base/environment.h"
+#include "base/file_path.h"
#include "base/file_util.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
+#include "base/native_library.h"
#include "base/scoped_ptr.h"
#include "base/stringprintf.h"
#include "base/threading/thread_restrictions.h"
@@ -402,6 +406,47 @@ void DisableNSSForkCheck() {
env->SetVar("NSS_STRICT_NOFORK", "DISABLED");
}
+void LoadNSSLibraries() {
+ // Some NSS libraries are linked dynamically so load them here.
+#if defined(USE_NSS)
+ // Try to search for multiple directories to load the libraries.
+ std::vector<FilePath> paths;
+
+ // Use relative path to Search PATH for the library files.
wtc 2011/03/18 18:46:31 Nit: the PATH environment variable is only used fo
+ paths.push_back(FilePath());
+
+ // For Debian derivaties NSS libraries are located here.
wtc 2011/03/18 18:46:31 Nit: NSS libraries => dynamically loaded NSS libra
+ paths.push_back(FilePath("/usr/lib/nss"));
+
+ // A list of library files to load.
+ std::vector<std::string> libs;
+ libs.push_back("libsoftokn3.so");
+ libs.push_back("libfreebl3.so");
+
+ // For each combination of library file and path, check for existence and
+ // then load.
+ size_t loaded = 0;
+ for (size_t i = 0; i < libs.size(); ++i) {
+ for (size_t j = 0; j < paths.size(); ++j) {
+ FilePath path = paths[j].Append(libs[i]);
+ if (file_util::PathExists(path)) {
+ NativeLibrary lib = base::LoadNativeLibrary(path);
+ if (lib) {
+ ++loaded;
+ break;
+ }
+ }
+ }
+ }
+
+ if (loaded == libs.size()) {
+ VLOG(3) << "NSS libraries loaded.";
+ } else {
+ LOG(WARNING) << "Failed to load NSS libraries.";
+ }
+#endif
+}
+
bool CheckNSSVersion(const char* version) {
return !!NSS_VersionCheck(version);
}
« no previous file with comments | « base/nss_util.h ('k') | content/browser/zygote_main_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698