extensions/auth/nsAuthSambaNTLM.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial