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"
LOCAL_INCLUDES += [
"/extensions/auth",
"/netwerk/base",
"/netwerk/cache",
"/netwerk/dns",
@ -38,6 +37,11 @@ LOCAL_INCLUDES += [
"/netwerk/streamconv/converters",
]
if CONFIG["MOZ_AUTH_EXTENSION"]:
LOCAL_INCLUDES += [
"/extensions/auth",
]
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
LOCAL_INCLUDES += [
"/netwerk/protocol/gio",

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

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

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

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

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

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

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

@ -176,6 +176,7 @@ nsHttpNTLMAuth::ChallengeReceived(nsIHttpAuthenticableChannel* channel,
if (challenge.Equals("NTLM"_ns, nsCaseInsensitiveCStringComparator)) {
nsCOMPtr<nsIAuthModule> module;
#ifdef MOZ_AUTH_EXTENSION
// Check to see if we should default to our generic NTLM auth module
// through UseGenericNTLM. (We use native auth by default if the
// 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.
module = nsIAuthModule::CreateInstance("sys-ntlm");
}
#ifdef XP_WIN
# ifdef XP_WIN
else {
// Try to use native NTLM and prompt the user for their domain,
// username, and password. (only supported by windows nsAuthSSPI
@ -203,15 +204,15 @@ nsHttpNTLMAuth::ChallengeReceived(nsIHttpAuthenticableChannel* channel,
module = nsIAuthModule::CreateInstance("sys-ntlm");
*identityInvalid = true;
}
#endif // XP_WIN
# endif // XP_WIN
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
// so.
if (!forceGeneric && !module) return NS_ERROR_UNEXPECTED;
#endif
# endif
// If no native support was available. Fall back on our internal NTLM
// implementation.
@ -233,6 +234,7 @@ nsHttpNTLMAuth::ChallengeReceived(nsIHttpAuthenticableChannel* channel,
// Prompt user for domain, username, and password.
*identityInvalid = true;
}
#endif
// If this fails, then it means that we cannot do NTLM auth.
if (!module) {

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

@ -26,7 +26,9 @@
#include "nsHttpDigestAuth.h"
#include "nsHttpHandler.h"
#include "nsHttpNTLMAuth.h"
#include "nsHttpNegotiateAuth.h"
#ifdef MOZ_AUTH_EXTENSION
# include "nsHttpNegotiateAuth.h"
#endif
#include "nsHttpRequestHead.h"
#include "nsHttpResponseHead.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
nsCOMPtr<nsIHttpAuthenticator> authenticator;
if (schema.EqualsLiteral("negotiate")) {
#ifdef MOZ_AUTH_EXTENSION
authenticator = new nsHttpNegotiateAuth();
#endif
} else if (schema.EqualsLiteral("basic")) {
authenticator = new nsHttpBasicAuth();
} else if (schema.EqualsLiteral("digest")) {

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

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