extensions/auth/nsAuthGSSAPI.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

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 nsAuthGSSAPI_h__
michael@0 7 #define nsAuthGSSAPI_h__
michael@0 8
michael@0 9 #include "nsAuth.h"
michael@0 10 #include "nsIAuthModule.h"
michael@0 11 #include "nsString.h"
michael@0 12 #include "mozilla/Attributes.h"
michael@0 13
michael@0 14 #define GSS_USE_FUNCTION_POINTERS 1
michael@0 15
michael@0 16 #include "gssapi.h"
michael@0 17
michael@0 18 // The nsAuthGSSAPI class provides responses for the GSS-API Negotiate method
michael@0 19 // as specified by Microsoft in draft-brezak-spnego-http-04.txt
michael@0 20
michael@0 21 /* Some remarks on thread safety ...
michael@0 22 *
michael@0 23 * The thread safety of this class depends largely upon the thread safety of
michael@0 24 * the underlying GSSAPI and Kerberos libraries. This code just loads the
michael@0 25 * system GSSAPI library, and whilst it avoids loading known bad libraries,
michael@0 26 * it cannot determine the thread safety of the the code it loads.
michael@0 27 *
michael@0 28 * When used with a non-threadsafe library, it is not safe to simultaneously
michael@0 29 * use multiple instantiations of this class.
michael@0 30 *
michael@0 31 * When used with a threadsafe Kerberos library, multiple instantiations of
michael@0 32 * this class may happily co-exist. Methods may be sequentially called from
michael@0 33 * multiple threads. The nature of the GSSAPI protocol is such that a correct
michael@0 34 * implementation will never call methods in parallel, as the results of the
michael@0 35 * last call are required as input to the next.
michael@0 36 */
michael@0 37
michael@0 38 class nsAuthGSSAPI MOZ_FINAL : public nsIAuthModule
michael@0 39 {
michael@0 40 public:
michael@0 41 NS_DECL_THREADSAFE_ISUPPORTS
michael@0 42 NS_DECL_NSIAUTHMODULE
michael@0 43
michael@0 44 nsAuthGSSAPI(pType package);
michael@0 45
michael@0 46 static void Shutdown();
michael@0 47
michael@0 48 private:
michael@0 49 ~nsAuthGSSAPI() { Reset(); }
michael@0 50
michael@0 51 void Reset();
michael@0 52 gss_OID GetOID() { return mMechOID; }
michael@0 53
michael@0 54 private:
michael@0 55 gss_ctx_id_t mCtx;
michael@0 56 gss_OID mMechOID;
michael@0 57 nsCString mServiceName;
michael@0 58 uint32_t mServiceFlags;
michael@0 59 nsString mUsername;
michael@0 60 bool mComplete;
michael@0 61 };
michael@0 62
michael@0 63 #endif /* nsAuthGSSAPI_h__ */

mercurial