extensions/auth/nsAuthSambaNTLM.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/extensions/auth/nsAuthSambaNTLM.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,52 @@
     1.4 +/* vim:set ts=4 sw=4 et cindent: */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef nsAuthSambaNTLM_h__
    1.10 +#define nsAuthSambaNTLM_h__
    1.11 +
    1.12 +#include "nsIAuthModule.h"
    1.13 +#include "nsString.h"
    1.14 +#include "nsCOMPtr.h"
    1.15 +#include "prio.h"
    1.16 +#include "prproces.h"
    1.17 +#include "mozilla/Attributes.h"
    1.18 +
    1.19 +/**
    1.20 + * This is an implementation of NTLM authentication that does single-signon
    1.21 + * by obtaining the user's Unix username, parsing it into DOMAIN\name format,
    1.22 + * and then asking Samba's ntlm_auth tool to do the authentication for us
    1.23 + * using the user's password cached in winbindd, if available. If the
    1.24 + * password is not available then this component fails to instantiate so
    1.25 + * nsHttpNTLMAuth will fall back to a different NTLM implementation.
    1.26 + * NOTE: at time of writing, this requires patches to be added to the stock
    1.27 + * Samba winbindd and ntlm_auth!  
    1.28 + */
    1.29 +class nsAuthSambaNTLM MOZ_FINAL : public nsIAuthModule
    1.30 +{
    1.31 +public:
    1.32 +    NS_DECL_ISUPPORTS
    1.33 +    NS_DECL_NSIAUTHMODULE
    1.34 +
    1.35 +    nsAuthSambaNTLM();
    1.36 +
    1.37 +    // We spawn the ntlm_auth helper from the module constructor, because
    1.38 +    // that lets us fail to instantiate the module if ntlm_auth isn't
    1.39 +    // available, triggering fallback to the built-in NTLM support (which
    1.40 +    // doesn't support single signon, of course)
    1.41 +    nsresult SpawnNTLMAuthHelper();
    1.42 +
    1.43 +private:
    1.44 +    ~nsAuthSambaNTLM();
    1.45 +
    1.46 +    void Shutdown();
    1.47 +
    1.48 +    uint8_t*    mInitialMessage; /* free with free() */
    1.49 +    uint32_t    mInitialMessageLen;
    1.50 +    PRProcess*  mChildPID;
    1.51 +    PRFileDesc* mFromChildFD;
    1.52 +    PRFileDesc* mToChildFD;
    1.53 +};
    1.54 +
    1.55 +#endif /* nsAuthSambaNTLM_h__ */

mercurial