mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
365b9b17b6
- Bug 1136379. Clean up the nsPluginHost API a bit. (c39f45953)
- Bug 1137897 - Do not throw exception from nsPluginTag::GetMimeTypes if a plug-in has no MIME-Types. (9d77c7205)
- Bug 1103036 - Allow ContentChild to perform tasks during shutdown (342555d90)
- Bug 1140714 - Pass through remote NS_OpenAnonymousTemporaryFile failure to caller. (04f01ef2c)
- Bug 1124907 - Call SetCompositor() only when it is valid (2255eeda2)
- Bug 1145149 - Include IntegerPrintfMacros in PerfSpewer.cpp (0e755cae8)
- Bug 1146223 - IonMonkey: MIPS: Fix a typo in storeFloat32x3 (36dd95699)
- Bug 1143686 - Gtk3 - Render scrollbar thumb with margin. (384347c60)
- Bug 1143686 - Gtk3 - Render scrollbar thumb with margin. (8711babf3)
- Bug 1142074 - remove NS_{IMPORT,EXPORT}_STATIC_MEMBER_ These have been unused for quite some time, and we have other ways of flagging static variables for export/import now. Whatever GCC bugs necessitated these macros are long gone as well. (a829ba500)
- Bug 1139361 - Remove gTLSThreadID*, NS_TLS and mozilla::threads::ID. (4c21669cb)
- Bug 1138123 - remove xpcom/sample/ as a bygone relic (2a4e33835)
- cleanup MOZ_THROW_EXPORT inspired from current FireFox removing the MOZALLOC_EXPORT hack (534f81737)
- Bug 868814 - Fold mozalloc library into mozglue. (324250a8c)
- Bug 1119482, part 1 - Use CycleCollectedJSRuntime::Get() in the various CC wrapper methods. (3c8638c57)
- Bug 1119482, part 2 - Move HoldDropJSObjects.h from xpcom/glue to xpcom/base. (c8ef6be30)
- Bug 1119482, part 3 - Move the Hold and DropJSObjects implementations to a new HoldDropJSObjects.cpp file. (8a128cabd)
- Bug 1119482, part 4 - Move IsJSHolder into HoldDropJSObjects. (154720b0d)
- Bug 1141660 - Fix bustage from bug 868814 with --disable-replace-malloc (7f74490b2)
- Followup for bug 868814 - replace non-obvious #if with simpler alternative. (2a1520452)
- Bug 1132771 - Add a test for reading all moz.build files in filesystem traversal mode; (49dcae4ea)
- Bug 1132771 - Support and test for reading without a config object; (b5fa44ed3)
- Bug 1132771 - API to return moz.build files relevant for a set of paths; (5a53e692a)
- Bug 1134072 - Remove support for post-eval sandbox callback; (fb63d7eda)
- Bug 1132771 - Implement strongly typed named tuples; (7acf71487)
- Bug 1135984 - Avoid setting an empty GYP_DIRS in contexts when reading it. (fceaf9f93)
- Bug 1134072 - Support for sub-contexts; r=glandium (41a0c2197)
- Bug 1136456 - Remove leftovers from TIERS support in mozbuild.frontend.reader. (4d5180e25)
- Bug 1132771 - Pass special types down to sandboxes via metadata; (5126bd8a6)
- Bug 1132771 - Support reading relevant moz.build files; r=glandium (6f9d6107c)
- Bug 1132771 - Add Files to moz.build with ability to define Bugzilla component; r=glandium (d5416a6cc)
- Bug 1132771 - Implement file-info mach command; r=glandium (64b7f8fad)
- Bug 1132771 - Define some bug components; r=glandium (e4d2b4645)
- Bug 1139050 - Add moz.build BUG_COMPONENT metadata for xpcom/. (ea30ac906)
- Bug 1139050, part 2 - Move nsAlgorithm.h to xpcom/base. (21abdde35)
- Bug 1134920 - Use moz_xmalloc/moz_xrealloc/free instead of nsMemory:Alloc/Realloc/Free. (5a00f0487)
- Bug 1134920 - Remove nsMemory::Alloc/Realloc/Free. (514d8e8eb)
- Bug 1120308 - tcp control channel for presentation api. (f3ee09a89)
- Bug 1125698 - Add ExpandErrorArguments() varargs helper function and remove uninitialized `dummy` va_list variable. (f9fdcd1db)
- Bug 1101627 - Add touch action regions. (6e86516f3)
- Bug 1092102 - Implement a WorkerDebuggerGlobalScope (4b3195921)
- Bug 1036967 - Introduce ScaleFactors2D. (2a80be7d6)
- Bug 1071018 - Work around an assertion (will be fixed properly in bug 1036967). (3f62cfa03)
- Bug 1023190 - Fix extra horizontal line when draw background image with repeat-x mode (5ab11f642)
- Bug 1135992 - Fix non-unified build failed in nsLayoutUtils.cpp. (8f8fcace8)
- Bug 1133492 - Extract some of nsPresShell into a separate TouchManager class. (9ac347878)
- Bug 1133492 - Extract some of nsPresShell into a separate TouchManager class. (37181a8a3)
- Bug 1122094 - Remove some unnecessary code. (6c3b1abe2)
- Don't async scroll overflowed single-line text boxes in APZ. (bug 1126090 part 6) (435d9d186)
152 lines
4.8 KiB
C++
152 lines
4.8 KiB
C++
/* vim:set ts=4 sw=4 et cindent: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "nsComponentManagerUtils.h"
|
|
#include "nsNativeCharsetUtils.h"
|
|
#include "nsIServiceManager.h"
|
|
#include "nsIPrefService.h"
|
|
|
|
#include "nsAuthSASL.h"
|
|
|
|
static const char kNegotiateAuthSSPI[] = "network.auth.use-sspi";
|
|
|
|
nsAuthSASL::nsAuthSASL()
|
|
{
|
|
mSASLReady = false;
|
|
}
|
|
|
|
void nsAuthSASL::Reset()
|
|
{
|
|
mSASLReady = false;
|
|
}
|
|
|
|
/* Limitations apply to this class's thread safety. See the header file */
|
|
NS_IMPL_ISUPPORTS(nsAuthSASL, nsIAuthModule)
|
|
|
|
NS_IMETHODIMP
|
|
nsAuthSASL::Init(const char *serviceName,
|
|
uint32_t serviceFlags,
|
|
const char16_t *domain,
|
|
const char16_t *username,
|
|
const char16_t *password)
|
|
{
|
|
nsresult rv;
|
|
|
|
NS_ASSERTION(username, "SASL requires a username");
|
|
NS_ASSERTION(!domain && !password, "unexpected credentials");
|
|
|
|
mUsername = username;
|
|
|
|
// If we're doing SASL, we should do mutual auth
|
|
serviceFlags |= REQ_MUTUAL_AUTH;
|
|
|
|
// Find out whether we should be trying SSPI or not
|
|
const char *contractID = NS_AUTH_MODULE_CONTRACTID_PREFIX "kerb-gss";
|
|
|
|
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
|
if (prefs) {
|
|
bool val;
|
|
rv = prefs->GetBoolPref(kNegotiateAuthSSPI, &val);
|
|
if (NS_SUCCEEDED(rv) && val)
|
|
contractID = NS_AUTH_MODULE_CONTRACTID_PREFIX "kerb-sspi";
|
|
}
|
|
|
|
mInnerModule = do_CreateInstance(contractID, &rv);
|
|
// if we can't create the GSSAPI module, then bail
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
mInnerModule->Init(serviceName, serviceFlags, nullptr, nullptr, nullptr);
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsAuthSASL::GetNextToken(const void *inToken,
|
|
uint32_t inTokenLen,
|
|
void **outToken,
|
|
uint32_t *outTokenLen)
|
|
{
|
|
nsresult rv;
|
|
void *unwrappedToken;
|
|
char *message;
|
|
uint32_t unwrappedTokenLen, messageLen;
|
|
nsAutoCString userbuf;
|
|
|
|
if (!mInnerModule)
|
|
return NS_ERROR_NOT_INITIALIZED;
|
|
|
|
if (mSASLReady) {
|
|
// If the server COMPLETEs with an empty token, Cyrus sends us that token.
|
|
// I don't think this is correct, but we need to handle that behaviour.
|
|
// Cyrus ignores the contents of our reply token.
|
|
if (inTokenLen == 0) {
|
|
*outToken = nullptr;
|
|
*outTokenLen = 0;
|
|
return NS_OK;
|
|
}
|
|
// We've completed the GSSAPI portion of the handshake, and are
|
|
// now ready to do the SASL security layer and authzid negotiation
|
|
|
|
// Input packet from the server needs to be unwrapped.
|
|
rv = mInnerModule->Unwrap(inToken, inTokenLen, &unwrappedToken,
|
|
&unwrappedTokenLen);
|
|
if (NS_FAILED(rv)) {
|
|
Reset();
|
|
return rv;
|
|
}
|
|
|
|
// If we were doing security layers then we'd care what the
|
|
// server had sent us. We're not, so all we had to do was make
|
|
// sure that the signature was correct with the above unwrap()
|
|
free(unwrappedToken);
|
|
|
|
NS_CopyUnicodeToNative(mUsername, userbuf);
|
|
messageLen = userbuf.Length() + 4 + 1;
|
|
message = (char *)moz_xmalloc(messageLen);
|
|
if (!message) {
|
|
Reset();
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
}
|
|
message[0] = 0x01; // No security layer
|
|
message[1] = 0x00;
|
|
message[2] = 0x00;
|
|
message[3] = 0x00; // Maxbuf must be zero if we've got no sec layer
|
|
strcpy(message+4, userbuf.get());
|
|
// Userbuf should not be nullptr terminated, so trim the trailing nullptr
|
|
// when wrapping the message
|
|
rv = mInnerModule->Wrap((void *) message, messageLen-1, false,
|
|
outToken, outTokenLen);
|
|
free(message);
|
|
Reset(); // All done
|
|
return NS_SUCCEEDED(rv) ? NS_SUCCESS_AUTH_FINISHED : rv;
|
|
}
|
|
rv = mInnerModule->GetNextToken(inToken, inTokenLen, outToken,
|
|
outTokenLen);
|
|
if (rv == NS_SUCCESS_AUTH_FINISHED) {
|
|
mSASLReady = true;
|
|
rv = NS_OK;
|
|
}
|
|
return rv;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsAuthSASL::Unwrap(const void *inToken,
|
|
uint32_t inTokenLen,
|
|
void **outToken,
|
|
uint32_t *outTokenLen)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsAuthSASL::Wrap(const void *inToken,
|
|
uint32_t inTokenLen,
|
|
bool confidential,
|
|
void **outToken,
|
|
uint32_t *outTokenLen)
|
|
{
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|