Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* vim:set ts=4 sw=4 et cindent: */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef nsAuthSambaNTLM_h__ |
michael@0 | 7 | #define nsAuthSambaNTLM_h__ |
michael@0 | 8 | |
michael@0 | 9 | #include "nsIAuthModule.h" |
michael@0 | 10 | #include "nsString.h" |
michael@0 | 11 | #include "nsCOMPtr.h" |
michael@0 | 12 | #include "prio.h" |
michael@0 | 13 | #include "prproces.h" |
michael@0 | 14 | #include "mozilla/Attributes.h" |
michael@0 | 15 | |
michael@0 | 16 | /** |
michael@0 | 17 | * This is an implementation of NTLM authentication that does single-signon |
michael@0 | 18 | * by obtaining the user's Unix username, parsing it into DOMAIN\name format, |
michael@0 | 19 | * and then asking Samba's ntlm_auth tool to do the authentication for us |
michael@0 | 20 | * using the user's password cached in winbindd, if available. If the |
michael@0 | 21 | * password is not available then this component fails to instantiate so |
michael@0 | 22 | * nsHttpNTLMAuth will fall back to a different NTLM implementation. |
michael@0 | 23 | * NOTE: at time of writing, this requires patches to be added to the stock |
michael@0 | 24 | * Samba winbindd and ntlm_auth! |
michael@0 | 25 | */ |
michael@0 | 26 | class nsAuthSambaNTLM MOZ_FINAL : public nsIAuthModule |
michael@0 | 27 | { |
michael@0 | 28 | public: |
michael@0 | 29 | NS_DECL_ISUPPORTS |
michael@0 | 30 | NS_DECL_NSIAUTHMODULE |
michael@0 | 31 | |
michael@0 | 32 | nsAuthSambaNTLM(); |
michael@0 | 33 | |
michael@0 | 34 | // We spawn the ntlm_auth helper from the module constructor, because |
michael@0 | 35 | // that lets us fail to instantiate the module if ntlm_auth isn't |
michael@0 | 36 | // available, triggering fallback to the built-in NTLM support (which |
michael@0 | 37 | // doesn't support single signon, of course) |
michael@0 | 38 | nsresult SpawnNTLMAuthHelper(); |
michael@0 | 39 | |
michael@0 | 40 | private: |
michael@0 | 41 | ~nsAuthSambaNTLM(); |
michael@0 | 42 | |
michael@0 | 43 | void Shutdown(); |
michael@0 | 44 | |
michael@0 | 45 | uint8_t* mInitialMessage; /* free with free() */ |
michael@0 | 46 | uint32_t mInitialMessageLen; |
michael@0 | 47 | PRProcess* mChildPID; |
michael@0 | 48 | PRFileDesc* mFromChildFD; |
michael@0 | 49 | PRFileDesc* mToChildFD; |
michael@0 | 50 | }; |
michael@0 | 51 | |
michael@0 | 52 | #endif /* nsAuthSambaNTLM_h__ */ |