michael@0: /* vim:set ts=4 sw=4 et cindent: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsAuthSambaNTLM_h__ michael@0: #define nsAuthSambaNTLM_h__ michael@0: michael@0: #include "nsIAuthModule.h" michael@0: #include "nsString.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "prio.h" michael@0: #include "prproces.h" michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: /** michael@0: * This is an implementation of NTLM authentication that does single-signon michael@0: * by obtaining the user's Unix username, parsing it into DOMAIN\name format, michael@0: * and then asking Samba's ntlm_auth tool to do the authentication for us michael@0: * using the user's password cached in winbindd, if available. If the michael@0: * password is not available then this component fails to instantiate so michael@0: * nsHttpNTLMAuth will fall back to a different NTLM implementation. michael@0: * NOTE: at time of writing, this requires patches to be added to the stock michael@0: * Samba winbindd and ntlm_auth! michael@0: */ michael@0: class nsAuthSambaNTLM MOZ_FINAL : public nsIAuthModule michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIAUTHMODULE michael@0: michael@0: nsAuthSambaNTLM(); michael@0: michael@0: // We spawn the ntlm_auth helper from the module constructor, because michael@0: // that lets us fail to instantiate the module if ntlm_auth isn't michael@0: // available, triggering fallback to the built-in NTLM support (which michael@0: // doesn't support single signon, of course) michael@0: nsresult SpawnNTLMAuthHelper(); michael@0: michael@0: private: michael@0: ~nsAuthSambaNTLM(); michael@0: michael@0: void Shutdown(); michael@0: michael@0: uint8_t* mInitialMessage; /* free with free() */ michael@0: uint32_t mInitialMessageLen; michael@0: PRProcess* mChildPID; michael@0: PRFileDesc* mFromChildFD; michael@0: PRFileDesc* mToChildFD; michael@0: }; michael@0: michael@0: #endif /* nsAuthSambaNTLM_h__ */