From ca9b7dd291b73243b21c03c472544387f4886dae Mon Sep 17 00:00:00 2001 From: "pvalchev@google.com" Date: Wed, 24 Feb 2010 23:40:30 +0000 Subject: - USE_NSS instead of LINUX where applicable - Rename nss_decryptor_linux to nss_decryptor_posix as it's more appropriate Review URL: http://codereview.chromium.org/656012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39949 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/importer/nss_decryptor.cc | 8 +- chrome/browser/importer/nss_decryptor.h | 6 +- chrome/browser/importer/nss_decryptor_linux.cc | 217 --------------------- chrome/browser/importer/nss_decryptor_linux.h | 59 ------ .../browser/importer/nss_decryptor_system_nss.cc | 217 +++++++++++++++++++++ chrome/browser/importer/nss_decryptor_system_nss.h | 59 ++++++ chrome/browser/net/chrome_url_request_context.cc | 6 +- chrome/browser/options_util.cc | 2 +- chrome/chrome_browser.gypi | 9 +- 9 files changed, 294 insertions(+), 289 deletions(-) delete mode 100644 chrome/browser/importer/nss_decryptor_linux.cc delete mode 100644 chrome/browser/importer/nss_decryptor_linux.h create mode 100644 chrome/browser/importer/nss_decryptor_system_nss.cc create mode 100644 chrome/browser/importer/nss_decryptor_system_nss.h diff --git a/chrome/browser/importer/nss_decryptor.cc b/chrome/browser/importer/nss_decryptor.cc index c30aabd..b5893e1 100644 --- a/chrome/browser/importer/nss_decryptor.cc +++ b/chrome/browser/importer/nss_decryptor.cc @@ -8,10 +8,10 @@ #include "build/build_config.h" #include "chrome/common/sqlite_utils.h" -#if defined(OS_LINUX) +#if defined(USE_NSS) #include #include -#endif // defined(OS_LINUX) +#endif // defined(USE_NSS) #include "base/base64.h" #include "base/utf_string_conversions.h" @@ -84,11 +84,11 @@ string16 NSSDecryptor::Decrypt(const std::string& crypt) const { SECItem reply; reply.data = NULL; reply.len = 0; -#if defined(OS_LINUX) +#if defined(USE_NSS) result = PK11SDR_DecryptWithSlot(slot, &request, &reply, NULL); #else result = PK11SDR_Decrypt(&request, &reply, NULL); -#endif // defined(OS_LINUX) +#endif // defined(USE_NSS) if (result == SECSuccess) plain.assign(reinterpret_cast(reply.data), reply.len); diff --git a/chrome/browser/importer/nss_decryptor.h b/chrome/browser/importer/nss_decryptor.h index d2ef391..c133665 100644 --- a/chrome/browser/importer/nss_decryptor.h +++ b/chrome/browser/importer/nss_decryptor.h @@ -7,12 +7,12 @@ #include "build/build_config.h" -#if defined(OS_LINUX) -#include "chrome/browser/importer/nss_decryptor_linux.h" -#elif defined(OS_MACOSX) +#if defined(OS_MACOSX) #include "chrome/browser/importer/nss_decryptor_mac.h" #elif defined(OS_WIN) #include "chrome/browser/importer/nss_decryptor_win.h" +#elif defined(USE_NSS) +#include "chrome/browser/importer/nss_decryptor_system_nss.h" #endif #endif // CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_H_ diff --git a/chrome/browser/importer/nss_decryptor_linux.cc b/chrome/browser/importer/nss_decryptor_linux.cc deleted file mode 100644 index 2fc083e..0000000 --- a/chrome/browser/importer/nss_decryptor_linux.cc +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/importer/nss_decryptor_linux.h" - -#include -#include - -#include "base/basictypes.h" -#include "base/nss_util.h" -#include "base/string_util.h" -#include "base/sys_string_conversions.h" - -NSSDecryptor::NSSDecryptor() : is_nss_initialized_(false), db_slot_(NULL) {} -NSSDecryptor::~NSSDecryptor() { - if (db_slot_) { - // Deliberately leave the user db open, just in case we need to open more - // than one, because there's an NSS bug with reopening user dbs. - // https://bugzilla.mozilla.org/show_bug.cgi?id=506140 - // SECMOD_CloseUserDB(db_slot_); - PK11_FreeSlot(db_slot_); - } -} - -bool NSSDecryptor::Init(const std::wstring& /* dll_path */, - const std::wstring& db_path) { - base::EnsureNSSInit(); - is_nss_initialized_ = true; - const std::string modspec = - StringPrintf("configDir='%s' tokenDescription='Firefox NSS database' " - "flags=readOnly", base::SysWideToNativeMB(db_path).c_str()); - db_slot_ = SECMOD_OpenUserDB(modspec.c_str()); - return db_slot_ != NULL; -} - -// This method is based on some NSS code in -// security/nss/lib/pk11wrap/pk11sdr.c -// This code is copied because the implementation assumes the use of the -// internal key slot for decryption, but we need to use another slot. -// The license block is: -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is the Netscape security libraries. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1994-2000 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * thayes@netscape.com - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -/* - * Data structure and template for encoding the result of an SDR operation - * This is temporary. It should include the algorithm ID of the encryption - * mechanism - */ -struct SDRResult -{ - SECItem keyid; - SECAlgorithmID alg; - SECItem data; -}; -typedef struct SDRResult SDRResult; - -static SEC_ASN1Template g_template[] = { - { SEC_ASN1_SEQUENCE, 0, NULL, sizeof (SDRResult) }, - { SEC_ASN1_OCTET_STRING, offsetof(SDRResult, keyid) }, - { SEC_ASN1_INLINE | SEC_ASN1_XTRN, offsetof(SDRResult, alg), - SEC_ASN1_SUB(SECOID_AlgorithmIDTemplate) }, - { SEC_ASN1_OCTET_STRING, offsetof(SDRResult, data) }, - { 0 } -}; - -static SECStatus -unpadBlock(SECItem *data, int blockSize, SECItem *result) -{ - SECStatus rv = SECSuccess; - int padLength; - int i; - - result->data = 0; - result->len = 0; - - /* Remove the padding from the end if the input data */ - if (data->len == 0 || data->len % blockSize != 0) { - rv = SECFailure; - goto loser; - } - - padLength = data->data[data->len-1]; - if (padLength > blockSize) { rv = SECFailure; goto loser; } - - /* verify padding */ - for (i=data->len - padLength; static_cast(i) < data->len; i++) { - if (data->data[i] != padLength) { - rv = SECFailure; - goto loser; - } - } - - result->len = data->len - padLength; - result->data = (unsigned char *)PORT_Alloc(result->len); - if (!result->data) { rv = SECFailure; goto loser; } - - PORT_Memcpy(result->data, data->data, result->len); - - if (padLength < 2) { - return SECWouldBlock; - } - -loser: - return rv; -} - -/* decrypt a block */ -static SECStatus -pk11Decrypt(PK11SlotInfo *slot, PLArenaPool *arena, - CK_MECHANISM_TYPE type, PK11SymKey *key, - SECItem *params, SECItem *in, SECItem *result) -{ - PK11Context *ctx = 0; - SECItem paddedResult; - SECStatus rv; - - paddedResult.len = 0; - paddedResult.data = 0; - - ctx = PK11_CreateContextBySymKey(type, CKA_DECRYPT, key, params); - if (!ctx) { rv = SECFailure; goto loser; } - - paddedResult.len = in->len; - paddedResult.data = static_cast( - PORT_ArenaAlloc(arena, paddedResult.len)); - - rv = PK11_CipherOp(ctx, paddedResult.data, - (int*)&paddedResult.len, paddedResult.len, - in->data, in->len); - if (rv != SECSuccess) goto loser; - - PK11_Finalize(ctx); - - /* Remove the padding */ - rv = unpadBlock(&paddedResult, PK11_GetBlockSize(type, 0), result); - if (rv) goto loser; - -loser: - if (ctx) PK11_DestroyContext(ctx, PR_TRUE); - return rv; -} - -SECStatus NSSDecryptor::PK11SDR_DecryptWithSlot( - PK11SlotInfo* slot, SECItem* data, SECItem* result, void* cx) const { - SECStatus rv = SECSuccess; - PK11SymKey *key = 0; - CK_MECHANISM_TYPE type; - SDRResult sdrResult; - SECItem *params = 0; - SECItem possibleResult = { static_cast(0), NULL, 0 }; - PLArenaPool *arena = 0; - - arena = PORT_NewArena(SEC_ASN1_DEFAULT_ARENA_SIZE); - if (!arena) { rv = SECFailure; goto loser; } - - /* Decode the incoming data */ - memset(&sdrResult, 0, sizeof sdrResult); - rv = SEC_QuickDERDecodeItem(arena, &sdrResult, g_template, data); - if (rv != SECSuccess) goto loser; /* Invalid format */ - - /* Get the parameter values from the data */ - params = PK11_ParamFromAlgid(&sdrResult.alg); - if (!params) { rv = SECFailure; goto loser; } - - /* Use triple-DES (Should look up the algorithm) */ - type = CKM_DES3_CBC; - key = PK11_FindFixedKey(slot, type, &sdrResult.keyid, cx); - if (!key) { - rv = SECFailure; - } else { - rv = pk11Decrypt(slot, arena, type, key, params, - &sdrResult.data, result); - } - - loser: - if (arena) PORT_FreeArena(arena, PR_TRUE); - if (key) PK11_FreeSymKey(key); - if (params) SECITEM_ZfreeItem(params, PR_TRUE); - if (possibleResult.data) SECITEM_ZfreeItem(&possibleResult, PR_FALSE); - - return rv; -} diff --git a/chrome/browser/importer/nss_decryptor_linux.h b/chrome/browser/importer/nss_decryptor_linux.h deleted file mode 100644 index 918a063..0000000 --- a/chrome/browser/importer/nss_decryptor_linux.h +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_LINUX_H_ -#define CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_LINUX_H_ - -#include -#include -#include - -#include "base/basictypes.h" -#include "base/file_path.h" - -namespace webkit_glue { -struct PasswordForm; -} - -// A wrapper for Firefox NSS decrypt component. -class NSSDecryptor { - public: - NSSDecryptor(); - ~NSSDecryptor(); - - // Initializes NSS if it hasn't already been initialized. - bool Init(const std::wstring& /* dll_path */, - const std::wstring& db_path); - - // Decrypts Firefox stored passwords. Before using this method, - // make sure Init() returns true. - string16 Decrypt(const std::string& crypt) const; - - // Parses the Firefox password file content, decrypts the - // username/password and reads other related information. - // The result will be stored in |forms|. - void ParseSignons(const std::string& content, - std::vector* forms); - - // Reads and parses the Firefox password sqlite db, decrypts the - // username/password and reads other related information. - // The result will be stored in |forms|. - bool ReadAndParseSignons(const FilePath& sqlite_file, - std::vector* forms); - private: - // Does not actually free the slot, since we'll free it when NSSDecryptor is - // destroyed. - void FreeSlot(PK11SlotInfo* slot) const {} - PK11SlotInfo* GetKeySlotForDB() const { return db_slot_; } - - SECStatus PK11SDR_DecryptWithSlot( - PK11SlotInfo* slot, SECItem* data, SECItem* result, void* cx) const; - - bool is_nss_initialized_; - PK11SlotInfo* db_slot_; - - DISALLOW_COPY_AND_ASSIGN(NSSDecryptor); -}; - -#endif // CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_LINUX_H_ diff --git a/chrome/browser/importer/nss_decryptor_system_nss.cc b/chrome/browser/importer/nss_decryptor_system_nss.cc new file mode 100644 index 0000000..c15f8a6 --- /dev/null +++ b/chrome/browser/importer/nss_decryptor_system_nss.cc @@ -0,0 +1,217 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/importer/nss_decryptor_system_nss.h" + +#include +#include + +#include "base/basictypes.h" +#include "base/nss_util.h" +#include "base/string_util.h" +#include "base/sys_string_conversions.h" + +NSSDecryptor::NSSDecryptor() : is_nss_initialized_(false), db_slot_(NULL) {} +NSSDecryptor::~NSSDecryptor() { + if (db_slot_) { + // Deliberately leave the user db open, just in case we need to open more + // than one, because there's an NSS bug with reopening user dbs. + // https://bugzilla.mozilla.org/show_bug.cgi?id=506140 + // SECMOD_CloseUserDB(db_slot_); + PK11_FreeSlot(db_slot_); + } +} + +bool NSSDecryptor::Init(const std::wstring& /* dll_path */, + const std::wstring& db_path) { + base::EnsureNSSInit(); + is_nss_initialized_ = true; + const std::string modspec = + StringPrintf("configDir='%s' tokenDescription='Firefox NSS database' " + "flags=readOnly", base::SysWideToNativeMB(db_path).c_str()); + db_slot_ = SECMOD_OpenUserDB(modspec.c_str()); + return db_slot_ != NULL; +} + +// This method is based on some NSS code in +// security/nss/lib/pk11wrap/pk11sdr.c +// This code is copied because the implementation assumes the use of the +// internal key slot for decryption, but we need to use another slot. +// The license block is: +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is the Netscape security libraries. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1994-2000 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * thayes@netscape.com + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* + * Data structure and template for encoding the result of an SDR operation + * This is temporary. It should include the algorithm ID of the encryption + * mechanism + */ +struct SDRResult +{ + SECItem keyid; + SECAlgorithmID alg; + SECItem data; +}; +typedef struct SDRResult SDRResult; + +static SEC_ASN1Template g_template[] = { + { SEC_ASN1_SEQUENCE, 0, NULL, sizeof (SDRResult) }, + { SEC_ASN1_OCTET_STRING, offsetof(SDRResult, keyid) }, + { SEC_ASN1_INLINE | SEC_ASN1_XTRN, offsetof(SDRResult, alg), + SEC_ASN1_SUB(SECOID_AlgorithmIDTemplate) }, + { SEC_ASN1_OCTET_STRING, offsetof(SDRResult, data) }, + { 0 } +}; + +static SECStatus +unpadBlock(SECItem *data, int blockSize, SECItem *result) +{ + SECStatus rv = SECSuccess; + int padLength; + int i; + + result->data = 0; + result->len = 0; + + /* Remove the padding from the end if the input data */ + if (data->len == 0 || data->len % blockSize != 0) { + rv = SECFailure; + goto loser; + } + + padLength = data->data[data->len-1]; + if (padLength > blockSize) { rv = SECFailure; goto loser; } + + /* verify padding */ + for (i=data->len - padLength; static_cast(i) < data->len; i++) { + if (data->data[i] != padLength) { + rv = SECFailure; + goto loser; + } + } + + result->len = data->len - padLength; + result->data = (unsigned char *)PORT_Alloc(result->len); + if (!result->data) { rv = SECFailure; goto loser; } + + PORT_Memcpy(result->data, data->data, result->len); + + if (padLength < 2) { + return SECWouldBlock; + } + +loser: + return rv; +} + +/* decrypt a block */ +static SECStatus +pk11Decrypt(PK11SlotInfo *slot, PLArenaPool *arena, + CK_MECHANISM_TYPE type, PK11SymKey *key, + SECItem *params, SECItem *in, SECItem *result) +{ + PK11Context *ctx = 0; + SECItem paddedResult; + SECStatus rv; + + paddedResult.len = 0; + paddedResult.data = 0; + + ctx = PK11_CreateContextBySymKey(type, CKA_DECRYPT, key, params); + if (!ctx) { rv = SECFailure; goto loser; } + + paddedResult.len = in->len; + paddedResult.data = static_cast( + PORT_ArenaAlloc(arena, paddedResult.len)); + + rv = PK11_CipherOp(ctx, paddedResult.data, + (int*)&paddedResult.len, paddedResult.len, + in->data, in->len); + if (rv != SECSuccess) goto loser; + + PK11_Finalize(ctx); + + /* Remove the padding */ + rv = unpadBlock(&paddedResult, PK11_GetBlockSize(type, 0), result); + if (rv) goto loser; + +loser: + if (ctx) PK11_DestroyContext(ctx, PR_TRUE); + return rv; +} + +SECStatus NSSDecryptor::PK11SDR_DecryptWithSlot( + PK11SlotInfo* slot, SECItem* data, SECItem* result, void* cx) const { + SECStatus rv = SECSuccess; + PK11SymKey *key = 0; + CK_MECHANISM_TYPE type; + SDRResult sdrResult; + SECItem *params = 0; + SECItem possibleResult = { static_cast(0), NULL, 0 }; + PLArenaPool *arena = 0; + + arena = PORT_NewArena(SEC_ASN1_DEFAULT_ARENA_SIZE); + if (!arena) { rv = SECFailure; goto loser; } + + /* Decode the incoming data */ + memset(&sdrResult, 0, sizeof sdrResult); + rv = SEC_QuickDERDecodeItem(arena, &sdrResult, g_template, data); + if (rv != SECSuccess) goto loser; /* Invalid format */ + + /* Get the parameter values from the data */ + params = PK11_ParamFromAlgid(&sdrResult.alg); + if (!params) { rv = SECFailure; goto loser; } + + /* Use triple-DES (Should look up the algorithm) */ + type = CKM_DES3_CBC; + key = PK11_FindFixedKey(slot, type, &sdrResult.keyid, cx); + if (!key) { + rv = SECFailure; + } else { + rv = pk11Decrypt(slot, arena, type, key, params, + &sdrResult.data, result); + } + + loser: + if (arena) PORT_FreeArena(arena, PR_TRUE); + if (key) PK11_FreeSymKey(key); + if (params) SECITEM_ZfreeItem(params, PR_TRUE); + if (possibleResult.data) SECITEM_ZfreeItem(&possibleResult, PR_FALSE); + + return rv; +} diff --git a/chrome/browser/importer/nss_decryptor_system_nss.h b/chrome/browser/importer/nss_decryptor_system_nss.h new file mode 100644 index 0000000..7071428 --- /dev/null +++ b/chrome/browser/importer/nss_decryptor_system_nss.h @@ -0,0 +1,59 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_SYSTEM_NSS_H_ +#define CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_SYSTEM_NSS_H_ + +#include +#include +#include + +#include "base/basictypes.h" +#include "base/file_path.h" + +namespace webkit_glue { +struct PasswordForm; +} + +// A wrapper for Firefox NSS decrypt component. +class NSSDecryptor { + public: + NSSDecryptor(); + ~NSSDecryptor(); + + // Initializes NSS if it hasn't already been initialized. + bool Init(const std::wstring& /* dll_path */, + const std::wstring& db_path); + + // Decrypts Firefox stored passwords. Before using this method, + // make sure Init() returns true. + string16 Decrypt(const std::string& crypt) const; + + // Parses the Firefox password file content, decrypts the + // username/password and reads other related information. + // The result will be stored in |forms|. + void ParseSignons(const std::string& content, + std::vector* forms); + + // Reads and parses the Firefox password sqlite db, decrypts the + // username/password and reads other related information. + // The result will be stored in |forms|. + bool ReadAndParseSignons(const FilePath& sqlite_file, + std::vector* forms); + private: + // Does not actually free the slot, since we'll free it when NSSDecryptor is + // destroyed. + void FreeSlot(PK11SlotInfo* slot) const {} + PK11SlotInfo* GetKeySlotForDB() const { return db_slot_; } + + SECStatus PK11SDR_DecryptWithSlot( + PK11SlotInfo* slot, SECItem* data, SECItem* result, void* cx) const; + + bool is_nss_initialized_; + PK11SlotInfo* db_slot_; + + DISALLOW_COPY_AND_ASSIGN(NSSDecryptor); +}; + +#endif // CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_SYSTEM_NSS_H_ diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc index 01181bc2..5550496 100644 --- a/chrome/browser/net/chrome_url_request_context.cc +++ b/chrome/browser/net/chrome_url_request_context.cc @@ -33,7 +33,7 @@ #include "net/url_request/url_request.h" #include "webkit/glue/webkit_glue.h" -#if defined(OS_LINUX) +#if defined(USE_NSS) #include "net/ocsp/nss_ocsp.h" #endif @@ -196,7 +196,7 @@ ChromeURLRequestContext* FactoryForOriginal::Create() { context->set_appcache_service( new ChromeAppCacheService(profile_dir_path_, context)); -#if defined(OS_LINUX) +#if defined(USE_NSS) // TODO(ukai): find a better way to set the URLRequestContext for OCSP. net::SetURLRequestContextForOCSP(context); #endif @@ -613,7 +613,7 @@ ChromeURLRequestContext::~ChromeURLRequestContext() { proxy_service_->SetProxyScriptFetcher(NULL); } -#if defined(OS_LINUX) +#if defined(USE_NSS) if (this == net::GetURLRequestContextForOCSP()) { // We are releasing the URLRequestContext used by OCSP handlers. net::SetURLRequestContextForOCSP(NULL); diff --git a/chrome/browser/options_util.cc b/chrome/browser/options_util.cc index 7b78051..d7e82ba 100644 --- a/chrome/browser/options_util.cc +++ b/chrome/browser/options_util.cc @@ -27,7 +27,7 @@ void OptionsUtil::ResetToDefaults(Profile* profile) { prefs::kCookieBehavior, prefs::kDefaultCharset, prefs::kDnsPrefetchingEnabled, -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_OPENBSD) prefs::kCertRevocationCheckingEnabled, prefs::kSSL2Enabled, prefs::kSSL3Enabled, diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index d74a627..cf0779c 100755 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -1297,10 +1297,10 @@ 'browser/importer/mork_reader.h', 'browser/importer/nss_decryptor.cc', 'browser/importer/nss_decryptor.h', - 'browser/importer/nss_decryptor_linux.cc', - 'browser/importer/nss_decryptor_linux.h', 'browser/importer/nss_decryptor_mac.h', 'browser/importer/nss_decryptor_mac.mm', + 'browser/importer/nss_decryptor_system_nss.cc', + 'browser/importer/nss_decryptor_system_nss.h', 'browser/importer/nss_decryptor_win.cc', 'browser/importer/nss_decryptor_win.h', 'browser/importer/safari_importer.h', @@ -2262,6 +2262,7 @@ ['OS=="freebsd" or OS=="openbsd"', { 'dependencies': [ '../build/linux/system.gyp:gtk', + '../build/linux/system.gyp:gtkprint', '../build/linux/system.gyp:nss', ], }], @@ -2271,6 +2272,8 @@ 'browser/bookmarks/bookmark_context_menu.cc', 'browser/bookmarks/bookmark_drop_info.cc', 'browser/dock_info.cc', + 'browser/importer/nss_decryptor_system_nss.cc', + 'browser/importer/nss_decryptor_system_nss.h', 'browser/jankometer.cc', 'browser/password_manager/password_store_gnome.h', 'browser/password_manager/password_store_gnome.cc', @@ -2436,6 +2439,8 @@ 'sources!': [ 'browser/browser_list_stub.cc', 'browser/history/history_publisher_none.cc', + 'browser/importer/nss_decryptor_system_nss.cc', + 'browser/importer/nss_decryptor_system_nss.h', 'browser/password_manager/password_store_gnome.h', 'browser/password_manager/password_store_gnome.cc', 'browser/password_manager/password_store_kwallet.h', -- cgit v1.1