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

mercurial