OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 "libgssapi.so.4", // Heimdal | 73 "libgssapi.so.4", // Heimdal |
74 "libgssapi.so.1" // Heimdal | 74 "libgssapi.so.1" // Heimdal |
75 #endif | 75 #endif |
76 }; | 76 }; |
77 static size_t num_lib_names = arraysize(kLibraryNames); | 77 static size_t num_lib_names = arraysize(kLibraryNames); |
78 | 78 |
79 for (size_t i = 0; i < num_lib_names; ++i) { | 79 for (size_t i = 0; i < num_lib_names; ++i) { |
80 const char* library_name = kLibraryNames[i]; | 80 const char* library_name = kLibraryNames[i]; |
81 FilePath file_path(library_name); | 81 FilePath file_path(library_name); |
82 base::NativeLibrary lib = base::LoadNativeLibrary(file_path); | 82 base::NativeLibrary lib = base::LoadNativeLibrary(file_path); |
83 // Only return this library if we can bind the functions we need. | 83 if (lib) { |
84 if (lib && BindMethods(lib)) | 84 // Only return this library if we can bind the functions we need. |
85 return lib; | 85 if (BindMethods(lib)) |
| 86 return lib; |
| 87 base::UnloadNativeLibrary(lib); |
| 88 } |
86 } | 89 } |
87 LOG(WARNING) << "Unable to find a compatible GSSAPI library"; | 90 LOG(WARNING) << "Unable to find a compatible GSSAPI library"; |
88 return NULL; | 91 return NULL; |
89 } | 92 } |
90 | 93 |
91 #define BIND(lib, x) \ | 94 #define BIND(lib, x) \ |
92 gss_##x##_type x = reinterpret_cast<gss_##x##_type>( \ | 95 gss_##x##_type x = reinterpret_cast<gss_##x##_type>( \ |
93 base::GetFunctionPointerFromNativeLibrary(lib, "gss_" #x)); \ | 96 base::GetFunctionPointerFromNativeLibrary(lib, "gss_" #x)); \ |
94 if (x == NULL) { \ | 97 if (x == NULL) { \ |
95 LOG(WARNING) << "Unable to bind function \"" << "gss_" #x << "\""; \ | 98 LOG(WARNING) << "Unable to bind function \"" << "gss_" #x << "\""; \ |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 << DisplayExtendedStatus(library_, | 507 << DisplayExtendedStatus(library_, |
505 major_status, | 508 major_status, |
506 minor_status); | 509 minor_status); |
507 return ERR_UNEXPECTED; | 510 return ERR_UNEXPECTED; |
508 } | 511 } |
509 | 512 |
510 return OK; | 513 return OK; |
511 } | 514 } |
512 | 515 |
513 } // namespace net | 516 } // namespace net |
514 | |
OLD | NEW |