Back to index

lightning-sunbird  0.9+nobinonly
Defines | Typedefs | Functions | Variables
nsNegotiateAuthGSSAPI.cpp File Reference
#include "prlink.h"
#include "nsCOMPtr.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIServiceManager.h"
#include "nsNegotiateAuth.h"
#include "nsNegotiateAuthGSSAPI.h"

Go to the source code of this file.

Defines

#define gssFuncItems   NS_ARRAY_LENGTH(gssFuncStr)
#define gss_display_status_ptr   ((gss_display_status_type)*gssFunPtr[0])
#define gss_init_sec_context_ptr   ((gss_init_sec_context_type)*gssFunPtr[1])
#define gss_indicate_mechs_ptr   ((gss_indicate_mechs_type)*gssFunPtr[2])
#define gss_release_oid_set_ptr   ((gss_release_oid_set_type)*gssFunPtr[3])
#define gss_delete_sec_context_ptr   ((gss_delete_sec_context_type)*gssFunPtr[4])
#define gss_import_name_ptr   ((gss_import_name_type)*gssFunPtr[5])
#define gss_release_buffer_ptr   ((gss_release_buffer_type)*gssFunPtr[6])
#define gss_release_name_ptr   ((gss_release_name_type)*gssFunPtr[7])
#define LogGssError(x, y, z)

Typedefs

typedef OM_uint32(* gss_display_status_type )(OM_uint32 *, OM_uint32, int, gss_OID, OM_uint32 *, gss_buffer_t)
typedef OM_uint32(* gss_init_sec_context_type )(OM_uint32 *, gss_cred_id_t, gss_ctx_id_t *, gss_name_t, gss_OID, OM_uint32, OM_uint32, gss_channel_bindings_t, gss_buffer_t, gss_OID *, gss_buffer_t, OM_uint32 *, OM_uint32 *)
typedef OM_uint32(* gss_indicate_mechs_type )(OM_uint32 *, gss_OID_set *)
typedef OM_uint32(* gss_release_oid_set_type )(OM_uint32 *, gss_OID_set *)
typedef OM_uint32(* gss_delete_sec_context_type )(OM_uint32 *, gss_ctx_id_t *, gss_buffer_t)
typedef OM_uint32(* gss_import_name_type )(OM_uint32 *, gss_buffer_t, gss_OID, gss_name_t *)
typedef OM_uint32(* gss_release_buffer_type )(OM_uint32 *, gss_buffer_t)
typedef OM_uint32(* gss_release_name_type )(OM_uint32 *, gss_name_t *)

Functions

static nsresult gssInit ()

Variables

static gss_OID_desc gss_c_nt_hostbased_service
static const char kNegotiateAuthGssLib [] = "network.negotiate-auth.gsslib"
static const char kNegotiateAuthNativeImp [] = "network.negotiate-auth.using-native-gsslib"
static const char * gssFuncStr []
static PRFuncPtr gssFunPtr [gssFuncItems]
static PRBool gssNativeImp = PR_TRUE
static PRBool gssFunInit = PR_FALSE

Define Documentation

Definition at line 162 of file nsNegotiateAuthGSSAPI.cpp.

Definition at line 158 of file nsNegotiateAuthGSSAPI.cpp.

Definition at line 163 of file nsNegotiateAuthGSSAPI.cpp.

Definition at line 160 of file nsNegotiateAuthGSSAPI.cpp.

Definition at line 159 of file nsNegotiateAuthGSSAPI.cpp.

Definition at line 164 of file nsNegotiateAuthGSSAPI.cpp.

Definition at line 165 of file nsNegotiateAuthGSSAPI.cpp.

Definition at line 161 of file nsNegotiateAuthGSSAPI.cpp.

Definition at line 152 of file nsNegotiateAuthGSSAPI.cpp.

#define LogGssError (   x,
  y,
 
)

Definition at line 277 of file nsNegotiateAuthGSSAPI.cpp.


Typedef Documentation

Definition at line 99 of file nsNegotiateAuthGSSAPI.cpp.

Definition at line 68 of file nsNegotiateAuthGSSAPI.cpp.

Definition at line 104 of file nsNegotiateAuthGSSAPI.cpp.

Definition at line 91 of file nsNegotiateAuthGSSAPI.cpp.

Definition at line 76 of file nsNegotiateAuthGSSAPI.cpp.

Definition at line 110 of file nsNegotiateAuthGSSAPI.cpp.

Definition at line 114 of file nsNegotiateAuthGSSAPI.cpp.

Definition at line 95 of file nsNegotiateAuthGSSAPI.cpp.


Function Documentation

static nsresult gssInit ( ) [static]

Definition at line 174 of file nsNegotiateAuthGSSAPI.cpp.

{
    nsXPIDLCString libPath;
    nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
    if (prefs) {
        prefs->GetCharPref(kNegotiateAuthGssLib, getter_Copies(libPath)); 
        prefs->GetBoolPref(kNegotiateAuthNativeImp, &gssNativeImp); 
    }

    PRLibrary *lib = NULL;

    if (!libPath.IsEmpty()) {
        LOG(("Attempting to load user specified library [%s]\n", libPath.get()));
        gssNativeImp = PR_FALSE;
        lib = PR_LoadLibrary(libPath.get());
    }
    else {
        const char *const libNames[] = {
            "gss",
            "gssapi_krb5",
            "gssapi"
        };

        for (size_t i = 0; i < NS_ARRAY_LENGTH(libNames) && !lib; ++i) {
            char *libName = PR_GetLibraryName(NULL, libNames[i]);
            if (libName) {
                lib = PR_LoadLibrary(libName);
                PR_FreeLibraryName(libName);
            }
        }
    }

    if (!lib) {
        LOG(("Fail to load gssapi library\n"));
        return NS_ERROR_FAILURE;
    }

    LOG(("Attempting to load gss functions\n"));

    for (size_t i = 0; i < gssFuncItems; ++i) {
        gssFunPtr[i] = PR_FindFunctionSymbol(lib, gssFuncStr[i]);
        if (!gssFunPtr[i]) {
            LOG(("Fail to load %s function from gssapi library\n", gssFuncStr[i]));
            PR_UnloadLibrary(lib);
            return NS_ERROR_FAILURE;
        }
    }
#ifdef XP_MACOSX
    if (gssNativeImp &&
            !(KLCacheHasValidTicketsPtr =
               PR_FindFunctionSymbol(lib, "KLCacheHasValidTickets"))) {
        LOG(("Fail to load KLCacheHasValidTickets function from gssapi library\n"));
        PR_UnloadLibrary(lib);
        return NS_ERROR_FAILURE;
    }
#endif

    gssFunInit = PR_TRUE;
    return NS_OK;
}

Here is the call graph for this function:


Variable Documentation

Initial value:
 
    { 10, (void *) "\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x04" }

Definition at line 133 of file nsNegotiateAuthGSSAPI.cpp.

const char* gssFuncStr[] [static]
Initial value:
 {
    "gss_display_status", 
    "gss_init_sec_context", 
    "gss_indicate_mechs",
    "gss_release_oid_set",
    "gss_delete_sec_context",
    "gss_import_name",
    "gss_release_buffer",
    "gss_release_name"
}

Definition at line 141 of file nsNegotiateAuthGSSAPI.cpp.

Definition at line 156 of file nsNegotiateAuthGSSAPI.cpp.

Definition at line 154 of file nsNegotiateAuthGSSAPI.cpp.

Definition at line 155 of file nsNegotiateAuthGSSAPI.cpp.

const char kNegotiateAuthGssLib[] = "network.negotiate-auth.gsslib" [static]

Definition at line 136 of file nsNegotiateAuthGSSAPI.cpp.

const char kNegotiateAuthNativeImp[] = "network.negotiate-auth.using-native-gsslib" [static]

Definition at line 138 of file nsNegotiateAuthGSSAPI.cpp.