Bug 1503350 - fix compile error when using --disable-negotiateauth r=necko-reviewers,dragana

Differential Revision: https://phabricator.services.mozilla.com/D107131
This commit is contained in:
Horst 2021-12-15 01:13:11 +00:00
Родитель 02203173dc
Коммит fd10e741c8
7 изменённых файлов: 36 добавлений и 10 удалений

Просмотреть файл

@ -21,7 +21,6 @@ include("/ipc/chromium/chromium-config.mozbuild")
FINAL_LIBRARY = "xul" FINAL_LIBRARY = "xul"
LOCAL_INCLUDES += [ LOCAL_INCLUDES += [
"/extensions/auth",
"/netwerk/base", "/netwerk/base",
"/netwerk/cache", "/netwerk/cache",
"/netwerk/dns", "/netwerk/dns",
@ -38,6 +37,11 @@ LOCAL_INCLUDES += [
"/netwerk/streamconv/converters", "/netwerk/streamconv/converters",
] ]
if CONFIG["MOZ_AUTH_EXTENSION"]:
LOCAL_INCLUDES += [
"/extensions/auth",
]
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
LOCAL_INCLUDES += [ LOCAL_INCLUDES += [
"/netwerk/protocol/gio", "/netwerk/protocol/gio",

Просмотреть файл

@ -23,7 +23,9 @@
#include "mozilla/net/BackgroundChannelRegistrar.h" #include "mozilla/net/BackgroundChannelRegistrar.h"
#include "mozilla/net/NeckoChild.h" #include "mozilla/net/NeckoChild.h"
#include "RedirectChannelRegistrar.h" #include "RedirectChannelRegistrar.h"
#include "nsAuthGSSAPI.h" #ifdef MOZ_AUTH_EXTENSION
# include "nsAuthGSSAPI.h"
#endif
#include "nsNetCID.h" #include "nsNetCID.h"
@ -301,7 +303,9 @@ void nsNetShutdown() {
mozilla::net::BackgroundChannelRegistrar::Shutdown(); mozilla::net::BackgroundChannelRegistrar::Shutdown();
#ifdef MOZ_AUTH_EXTENSION
nsAuthGSSAPI::Shutdown(); nsAuthGSSAPI::Shutdown();
#endif
delete gNetSniffers; delete gNetSniffers;
gNetSniffers = nullptr; gNetSniffers = nullptr;

Просмотреть файл

@ -182,7 +182,6 @@ FINAL_LIBRARY = "xul"
LOCAL_INCLUDES += [ LOCAL_INCLUDES += [
"/dom/base", "/dom/base",
"/extensions/auth",
"/netwerk/base", "/netwerk/base",
"/netwerk/cookie", "/netwerk/cookie",
"/netwerk/dns", "/netwerk/dns",
@ -191,6 +190,11 @@ LOCAL_INCLUDES += [
"/netwerk/url-classifier", "/netwerk/url-classifier",
] ]
if CONFIG["MOZ_AUTH_EXTENSION"]:
LOCAL_INCLUDES += [
"/extensions/auth",
]
EXTRA_JS_MODULES += [ EXTRA_JS_MODULES += [
"WellKnownOpportunisticUtils.jsm", "WellKnownOpportunisticUtils.jsm",
] ]

Просмотреть файл

@ -32,7 +32,9 @@
#include "nsHttp.h" #include "nsHttp.h"
#include "nsHttpBasicAuth.h" #include "nsHttpBasicAuth.h"
#include "nsHttpDigestAuth.h" #include "nsHttpDigestAuth.h"
#include "nsHttpNegotiateAuth.h" #ifdef MOZ_AUTH_EXTENSION
# include "nsHttpNegotiateAuth.h"
#endif
#include "nsHttpNTLMAuth.h" #include "nsHttpNTLMAuth.h"
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
#include "nsIURL.h" #include "nsIURL.h"
@ -1166,9 +1168,12 @@ nsresult nsHttpChannelAuthProvider::GetAuthenticator(
GetAuthType(aChallenge, authType); GetAuthType(aChallenge, authType);
nsCOMPtr<nsIHttpAuthenticator> authenticator; nsCOMPtr<nsIHttpAuthenticator> authenticator;
#ifdef MOZ_AUTH_EXTENSION
if (authType.EqualsLiteral("negotiate")) { if (authType.EqualsLiteral("negotiate")) {
authenticator = nsHttpNegotiateAuth::GetOrCreate(); authenticator = nsHttpNegotiateAuth::GetOrCreate();
} else if (authType.EqualsLiteral("basic")) { } else
#endif
if (authType.EqualsLiteral("basic")) {
authenticator = nsHttpBasicAuth::GetOrCreate(); authenticator = nsHttpBasicAuth::GetOrCreate();
} else if (authType.EqualsLiteral("digest")) { } else if (authType.EqualsLiteral("digest")) {
authenticator = nsHttpDigestAuth::GetOrCreate(); authenticator = nsHttpDigestAuth::GetOrCreate();

Просмотреть файл

@ -176,6 +176,7 @@ nsHttpNTLMAuth::ChallengeReceived(nsIHttpAuthenticableChannel* channel,
if (challenge.Equals("NTLM"_ns, nsCaseInsensitiveCStringComparator)) { if (challenge.Equals("NTLM"_ns, nsCaseInsensitiveCStringComparator)) {
nsCOMPtr<nsIAuthModule> module; nsCOMPtr<nsIAuthModule> module;
#ifdef MOZ_AUTH_EXTENSION
// Check to see if we should default to our generic NTLM auth module // Check to see if we should default to our generic NTLM auth module
// through UseGenericNTLM. (We use native auth by default if the // through UseGenericNTLM. (We use native auth by default if the
// system provides it.) If *sessionState is non-null, we failed to // system provides it.) If *sessionState is non-null, we failed to
@ -192,7 +193,7 @@ nsHttpNTLMAuth::ChallengeReceived(nsIHttpAuthenticableChannel* channel,
// a default credentials attempt once we return. // a default credentials attempt once we return.
module = nsIAuthModule::CreateInstance("sys-ntlm"); module = nsIAuthModule::CreateInstance("sys-ntlm");
} }
#ifdef XP_WIN # ifdef XP_WIN
else { else {
// Try to use native NTLM and prompt the user for their domain, // Try to use native NTLM and prompt the user for their domain,
// username, and password. (only supported by windows nsAuthSSPI // username, and password. (only supported by windows nsAuthSSPI
@ -203,15 +204,15 @@ nsHttpNTLMAuth::ChallengeReceived(nsIHttpAuthenticableChannel* channel,
module = nsIAuthModule::CreateInstance("sys-ntlm"); module = nsIAuthModule::CreateInstance("sys-ntlm");
*identityInvalid = true; *identityInvalid = true;
} }
#endif // XP_WIN # endif // XP_WIN
if (!module) LOG(("Native sys-ntlm auth module not found.\n")); if (!module) LOG(("Native sys-ntlm auth module not found.\n"));
} }
#ifdef XP_WIN # ifdef XP_WIN
// On windows, never fall back unless the user has specifically requested // On windows, never fall back unless the user has specifically requested
// so. // so.
if (!forceGeneric && !module) return NS_ERROR_UNEXPECTED; if (!forceGeneric && !module) return NS_ERROR_UNEXPECTED;
#endif # endif
// If no native support was available. Fall back on our internal NTLM // If no native support was available. Fall back on our internal NTLM
// implementation. // implementation.
@ -233,6 +234,7 @@ nsHttpNTLMAuth::ChallengeReceived(nsIHttpAuthenticableChannel* channel,
// Prompt user for domain, username, and password. // Prompt user for domain, username, and password.
*identityInvalid = true; *identityInvalid = true;
} }
#endif
// If this fails, then it means that we cannot do NTLM auth. // If this fails, then it means that we cannot do NTLM auth.
if (!module) { if (!module) {

Просмотреть файл

@ -26,7 +26,9 @@
#include "nsHttpDigestAuth.h" #include "nsHttpDigestAuth.h"
#include "nsHttpHandler.h" #include "nsHttpHandler.h"
#include "nsHttpNTLMAuth.h" #include "nsHttpNTLMAuth.h"
#include "nsHttpNegotiateAuth.h" #ifdef MOZ_AUTH_EXTENSION
# include "nsHttpNegotiateAuth.h"
#endif
#include "nsHttpRequestHead.h" #include "nsHttpRequestHead.h"
#include "nsHttpResponseHead.h" #include "nsHttpResponseHead.h"
#include "nsICancelable.h" #include "nsICancelable.h"
@ -2649,7 +2651,9 @@ bool nsHttpTransaction::IsStickyAuthSchemeAt(nsACString const& auth) {
// using a new instance because of thread safety of auth modules refcnt // using a new instance because of thread safety of auth modules refcnt
nsCOMPtr<nsIHttpAuthenticator> authenticator; nsCOMPtr<nsIHttpAuthenticator> authenticator;
if (schema.EqualsLiteral("negotiate")) { if (schema.EqualsLiteral("negotiate")) {
#ifdef MOZ_AUTH_EXTENSION
authenticator = new nsHttpNegotiateAuth(); authenticator = new nsHttpNegotiateAuth();
#endif
} else if (schema.EqualsLiteral("basic")) { } else if (schema.EqualsLiteral("basic")) {
authenticator = new nsHttpBasicAuth(); authenticator = new nsHttpBasicAuth();
} else if (schema.EqualsLiteral("digest")) { } else if (schema.EqualsLiteral("digest")) {

Просмотреть файл

@ -1596,6 +1596,9 @@ MOZ_ARG_DISABLE_BOOL(negotiateauth,
[ --disable-negotiateauth Disable GSS-API negotiation ], [ --disable-negotiateauth Disable GSS-API negotiation ],
MOZ_AUTH_EXTENSION=, MOZ_AUTH_EXTENSION=,
MOZ_AUTH_EXTENSION=1 ) MOZ_AUTH_EXTENSION=1 )
if test "$MOZ_AUTH_EXTENSION"; then
AC_DEFINE(MOZ_AUTH_EXTENSION)
fi
dnl ======================================================== dnl ========================================================
dnl Searching of system directories for extensions. dnl Searching of system directories for extensions.