| OLD | NEW |
| 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" |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 DescribeOid(gssapi_lib, | 373 DescribeOid(gssapi_lib, |
| 374 mech_type).c_str(), | 374 mech_type).c_str(), |
| 375 ctx_flags, | 375 ctx_flags, |
| 376 locally_initiated, | 376 locally_initiated, |
| 377 open); | 377 open); |
| 378 return description; | 378 return description; |
| 379 } | 379 } |
| 380 | 380 |
| 381 } // namespace | 381 } // namespace |
| 382 | 382 |
| 383 GSSAPISharedLibrary::GSSAPISharedLibrary(const std::string& gssapi_library_name) | 383 GSSAPISharedLibrary::GSSAPISharedLibrary(const std::string& gssapi_library_name, |
| 384 bool allow_gssapi_library_load) |
| 384 : initialized_(false), | 385 : initialized_(false), |
| 385 gssapi_library_name_(gssapi_library_name), | 386 gssapi_library_name_(gssapi_library_name), |
| 387 allow_gssapi_library_load_(allow_gssapi_library_load), |
| 386 gssapi_library_(NULL), | 388 gssapi_library_(NULL), |
| 387 import_name_(NULL), | 389 import_name_(NULL), |
| 388 release_name_(NULL), | 390 release_name_(NULL), |
| 389 release_buffer_(NULL), | 391 release_buffer_(NULL), |
| 390 display_name_(NULL), | 392 display_name_(NULL), |
| 391 display_status_(NULL), | 393 display_status_(NULL), |
| 392 init_sec_context_(NULL), | 394 init_sec_context_(NULL), |
| 393 wrap_size_limit_(NULL), | 395 wrap_size_limit_(NULL), |
| 394 delete_sec_context_(NULL), | 396 delete_sec_context_(NULL), |
| 395 inquire_context_(NULL) { | 397 inquire_context_(NULL) {} |
| 396 } | |
| 397 | 398 |
| 398 GSSAPISharedLibrary::~GSSAPISharedLibrary() { | 399 GSSAPISharedLibrary::~GSSAPISharedLibrary() { |
| 399 if (gssapi_library_) { | 400 if (gssapi_library_) { |
| 400 base::UnloadNativeLibrary(gssapi_library_); | 401 base::UnloadNativeLibrary(gssapi_library_); |
| 401 gssapi_library_ = NULL; | 402 gssapi_library_ = NULL; |
| 402 } | 403 } |
| 403 } | 404 } |
| 404 | 405 |
| 405 bool GSSAPISharedLibrary::Init() { | 406 bool GSSAPISharedLibrary::Init() { |
| 406 if (!initialized_) | 407 if (!initialized_) |
| 407 InitImpl(); | 408 InitImpl(); |
| 408 return initialized_; | 409 return initialized_; |
| 409 } | 410 } |
| 410 | 411 |
| 411 bool GSSAPISharedLibrary::InitImpl() { | 412 bool GSSAPISharedLibrary::InitImpl() { |
| 412 DCHECK(!initialized_); | 413 DCHECK(!initialized_); |
| 413 #if defined(DLOPEN_KERBEROS) | 414 #if defined(DLOPEN_KERBEROS) |
| 415 // On Chrome OS only Active Directory managed devices are configured |
| 416 // to use Kerberos. |
| 417 if (!allow_gssapi_library_load_) |
| 418 return false; |
| 419 |
| 414 gssapi_library_ = LoadSharedLibrary(); | 420 gssapi_library_ = LoadSharedLibrary(); |
| 415 if (gssapi_library_ == NULL) | 421 if (gssapi_library_ == NULL) |
| 416 return false; | 422 return false; |
| 417 #endif // defined(DLOPEN_KERBEROS) | 423 #endif // defined(DLOPEN_KERBEROS) |
| 418 initialized_ = true; | 424 initialized_ = true; |
| 419 return true; | 425 return true; |
| 420 } | 426 } |
| 421 | 427 |
| 422 base::NativeLibrary GSSAPISharedLibrary::LoadSharedLibrary() { | 428 base::NativeLibrary GSSAPISharedLibrary::LoadSharedLibrary() { |
| 423 const char* const* library_names; | 429 const char* const* library_names; |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 if (rv != OK) { | 868 if (rv != OK) { |
| 863 LOG(ERROR) << "Problem initializing context. \n" | 869 LOG(ERROR) << "Problem initializing context. \n" |
| 864 << DisplayExtendedStatus(library_, major_status, minor_status) | 870 << DisplayExtendedStatus(library_, major_status, minor_status) |
| 865 << '\n' | 871 << '\n' |
| 866 << DescribeContext(library_, scoped_sec_context_.get()); | 872 << DescribeContext(library_, scoped_sec_context_.get()); |
| 867 } | 873 } |
| 868 return rv; | 874 return rv; |
| 869 } | 875 } |
| 870 | 876 |
| 871 } // namespace net | 877 } // namespace net |
| OLD | NEW |