Bug 496271, automation config for Tb2.0.0.22 build1, p=joduinn, r=me
[mozilla-1.9.git] / extensions / auth / nsAuthSambaNTLM.h
blob5a73a98940315ca3500a0919997428af95cc2739
1 /* vim:set ts=4 sw=4 et cindent: */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is Samba NTLM Authentication.
17 * The Initial Developer of the Original Code is Novell.
18 * Portions created by the Initial Developer are Copyright (C) 2005
19 * the Initial Developer. All Rights Reserved.
21 * Contributor(s):
22 * Robert O'Callahan (rocallahan@novell.com)
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #ifndef nsAuthSambaNTLM_h__
39 #define nsAuthSambaNTLM_h__
41 #include "nsIAuthModule.h"
42 #include "nsString.h"
43 #include "nsCOMPtr.h"
44 #include "prio.h"
45 #include "prproces.h"
47 /**
48 * This is an implementation of NTLM authentication that does single-signon
49 * by obtaining the user's Unix username, parsing it into DOMAIN\name format,
50 * and then asking Samba's ntlm_auth tool to do the authentication for us
51 * using the user's password cached in winbindd, if available. If the
52 * password is not available then this component fails to instantiate so
53 * nsHttpNTLMAuth will fall back to a different NTLM implementation.
54 * NOTE: at time of writing, this requires patches to be added to the stock
55 * Samba winbindd and ntlm_auth!
57 class nsAuthSambaNTLM : public nsIAuthModule
59 public:
60 NS_DECL_ISUPPORTS
61 NS_DECL_NSIAUTHMODULE
63 nsAuthSambaNTLM();
65 // We spawn the ntlm_auth helper from the module constructor, because
66 // that lets us fail to instantiate the module if ntlm_auth isn't
67 // available, triggering fallback to the built-in NTLM support (which
68 // doesn't support single signon, of course)
69 nsresult SpawnNTLMAuthHelper();
71 private:
72 ~nsAuthSambaNTLM();
74 void Shutdown();
76 PRUint8* mInitialMessage; /* free with free() */
77 PRUint32 mInitialMessageLen;
78 PRProcess* mChildPID;
79 PRFileDesc* mFromChildFD;
80 PRFileDesc* mToChildFD;
83 #endif /* nsAuthSambaNTLM_h__ */