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

Side by Side Diff: net/http/http_auth_gssapi_posix.cc

Issue 2826273004: Enable loading gssapi library for Chromad. (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
« net/features.gni ('K') | « net/features.gni ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_auth_gssapi_posix.h" 5 #include "net/http/http_auth_gssapi_posix.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/format_macros.h" 12 #include "base/format_macros.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
17 #include "base/threading/thread_restrictions.h" 17 #include "base/threading/thread_restrictions.h"
18 #include "net/base/net_errors.h" 18 #include "net/base/net_errors.h"
19 #include "net/http/http_auth_multi_round_parse.h" 19 #include "net/http/http_auth_multi_round_parse.h"
20 20
21 #if defined(OS_CHROMEOS)
22 #include "chrome/browser/browser_process.h"
asanka 2017/04/20 18:00:52 //net can't depend on //chrome. There are lots of
23 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
24 #endif
25
21 // These are defined for the GSSAPI library: 26 // These are defined for the GSSAPI library:
22 // Paraphrasing the comments from gssapi.h: 27 // Paraphrasing the comments from gssapi.h:
23 // "The implementation must reserve static storage for a 28 // "The implementation must reserve static storage for a
24 // gss_OID_desc object for each constant. That constant 29 // gss_OID_desc object for each constant. That constant
25 // should be initialized to point to that gss_OID_desc." 30 // should be initialized to point to that gss_OID_desc."
26 // These are encoded using ASN.1 BER encoding. 31 // These are encoded using ASN.1 BER encoding.
27 namespace { 32 namespace {
28 33
29 static gss_OID_desc GSS_C_NT_USER_NAME_VAL = { 34 static gss_OID_desc GSS_C_NT_USER_NAME_VAL = {
30 10, 35 10,
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 409
405 bool GSSAPISharedLibrary::Init() { 410 bool GSSAPISharedLibrary::Init() {
406 if (!initialized_) 411 if (!initialized_)
407 InitImpl(); 412 InitImpl();
408 return initialized_; 413 return initialized_;
409 } 414 }
410 415
411 bool GSSAPISharedLibrary::InitImpl() { 416 bool GSSAPISharedLibrary::InitImpl() {
412 DCHECK(!initialized_); 417 DCHECK(!initialized_);
413 #if defined(DLOPEN_KERBEROS) 418 #if defined(DLOPEN_KERBEROS)
419 #if defined(OS_CHROMEOS)
420 policy::BrowserPolicyConnectorChromeOS* connector =
421 g_browser_process->platform_part()->browser_policy_connector_chromeos();
422
423 if (!connector->IsActiveDirectoryManaged()) {
424 return false;
425 }
426 #endif
427
414 gssapi_library_ = LoadSharedLibrary(); 428 gssapi_library_ = LoadSharedLibrary();
415 if (gssapi_library_ == NULL) 429 if (gssapi_library_ == NULL)
416 return false; 430 return false;
417 #endif // defined(DLOPEN_KERBEROS) 431 #endif // defined(DLOPEN_KERBEROS)
418 initialized_ = true; 432 initialized_ = true;
419 return true; 433 return true;
420 } 434 }
421 435
422 base::NativeLibrary GSSAPISharedLibrary::LoadSharedLibrary() { 436 base::NativeLibrary GSSAPISharedLibrary::LoadSharedLibrary() {
423 const char* const* library_names; 437 const char* const* library_names;
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 if (rv != OK) { 876 if (rv != OK) {
863 LOG(ERROR) << "Problem initializing context. \n" 877 LOG(ERROR) << "Problem initializing context. \n"
864 << DisplayExtendedStatus(library_, major_status, minor_status) 878 << DisplayExtendedStatus(library_, major_status, minor_status)
865 << '\n' 879 << '\n'
866 << DescribeContext(library_, scoped_sec_context_.get()); 880 << DescribeContext(library_, scoped_sec_context_.get());
867 } 881 }
868 return rv; 882 return rv;
869 } 883 }
870 884
871 } // namespace net 885 } // namespace net
OLDNEW
« net/features.gni ('K') | « net/features.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698