jdk/src/java.security.jgss/unix/native/libj2gss/NativeFunc.c
author goetz
Tue, 09 Dec 2014 11:57:46 +0100
changeset 28187 fc19df82d6ee
parent 25859 3317bb8137f4
permissions -rw-r--r--
8066964: ppc64: argument and return type profiling, fix problem with popframe Reviewed-by: roland, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
14342
8435a30053c1 7197491: update copyright year to match last edit in jdk8 jdk repository
alanb
parents: 12195
diff changeset
     2
 * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#include <stdio.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#include <stdlib.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#include <dlfcn.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include "NativeFunc.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
/* standard GSS method names (ordering is from mapfile) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
static const char RELEASE_NAME[]                = "gss_release_name";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
static const char IMPORT_NAME[]                 = "gss_import_name";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
static const char COMPARE_NAME[]                = "gss_compare_name";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
static const char CANONICALIZE_NAME[]           = "gss_canonicalize_name";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
static const char EXPORT_NAME[]                 = "gss_export_name";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
static const char DISPLAY_NAME[]                = "gss_display_name";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
static const char ACQUIRE_CRED[]                = "gss_acquire_cred";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
static const char RELEASE_CRED[]                = "gss_release_cred";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
static const char INQUIRE_CRED[]                = "gss_inquire_cred";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
static const char IMPORT_SEC_CONTEXT[]          = "gss_import_sec_context";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
static const char INIT_SEC_CONTEXT[]            = "gss_init_sec_context";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
static const char ACCEPT_SEC_CONTEXT[]          = "gss_accept_sec_context";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
static const char INQUIRE_CONTEXT[]             = "gss_inquire_context";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
static const char DELETE_SEC_CONTEXT[]          = "gss_delete_sec_context";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
static const char CONTEXT_TIME[]                = "gss_context_time";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
static const char WRAP_SIZE_LIMIT[]             = "gss_wrap_size_limit";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
static const char EXPORT_SEC_CONTEXT[]          = "gss_export_sec_context";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
static const char GET_MIC[]                     = "gss_get_mic";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
static const char VERIFY_MIC[]                  = "gss_verify_mic";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
static const char WRAP[]                        = "gss_wrap";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
static const char UNWRAP[]                      = "gss_unwrap";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
static const char INDICATE_MECHS[]              = "gss_indicate_mechs";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
static const char INQUIRE_NAMES_FOR_MECH[]      = "gss_inquire_names_for_mech";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
/* additional GSS methods not public thru mapfile */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
static const char ADD_OID_SET_MEMBER[]          = "gss_add_oid_set_member";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
static const char DISPLAY_STATUS[]              = "gss_display_status";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
static const char CREATE_EMPTY_OID_SET[]        = "gss_create_empty_oid_set";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
static const char RELEASE_OID_SET[]             = "gss_release_oid_set";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
static const char RELEASE_BUFFER[]              = "gss_release_buffer";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * Initialize native GSS function pointers
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
char* loadNative(const char *libName) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    char *error;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    void *gssLib;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    int failed;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    OM_uint32 minor, major;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    ftab = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    failed = FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    error = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    gssLib = dlopen(libName, RTLD_NOW);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    if (gssLib == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    /* global function table instance */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    ftab = (GSS_FUNCTION_TABLE_PTR)malloc(sizeof(GSS_FUNCTION_TABLE));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    if (ftab == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    ftab->releaseName = (RELEASE_NAME_FN_PTR)dlsym(gssLib, RELEASE_NAME);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    if (ftab->releaseName == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    ftab->importName = (IMPORT_NAME_FN_PTR)dlsym(gssLib, IMPORT_NAME);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    if (ftab->importName == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    ftab->compareName = (COMPARE_NAME_FN_PTR)dlsym(gssLib, COMPARE_NAME);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    if (ftab->compareName == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    ftab->canonicalizeName = (CANONICALIZE_NAME_FN_PTR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
                                dlsym(gssLib, CANONICALIZE_NAME);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    if (ftab->canonicalizeName == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    ftab->exportName = (EXPORT_NAME_FN_PTR)dlsym(gssLib, EXPORT_NAME);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    if (ftab->exportName == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    ftab->displayName = (DISPLAY_NAME_FN_PTR)dlsym(gssLib, DISPLAY_NAME);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    if (ftab->displayName == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    ftab->acquireCred = (ACQUIRE_CRED_FN_PTR)dlsym(gssLib, ACQUIRE_CRED);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    if (ftab->acquireCred == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    ftab->releaseCred = (RELEASE_CRED_FN_PTR)dlsym(gssLib, RELEASE_CRED);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    if (ftab->releaseCred == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    ftab->inquireCred = (INQUIRE_CRED_FN_PTR)dlsym(gssLib, INQUIRE_CRED);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    if (ftab->inquireCred == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    ftab->importSecContext = (IMPORT_SEC_CONTEXT_FN_PTR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
                        dlsym(gssLib, IMPORT_SEC_CONTEXT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    if (ftab->importSecContext == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    ftab->initSecContext = (INIT_SEC_CONTEXT_FN_PTR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
                        dlsym(gssLib, INIT_SEC_CONTEXT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    if (ftab->initSecContext == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    ftab->acceptSecContext = (ACCEPT_SEC_CONTEXT_FN_PTR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                        dlsym(gssLib, ACCEPT_SEC_CONTEXT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    if (ftab->acceptSecContext == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    ftab->inquireContext = (INQUIRE_CONTEXT_FN_PTR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
                        dlsym(gssLib, INQUIRE_CONTEXT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    if (ftab->inquireContext == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    ftab->deleteSecContext = (DELETE_SEC_CONTEXT_FN_PTR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
                        dlsym(gssLib, DELETE_SEC_CONTEXT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    if (ftab->deleteSecContext == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    ftab->contextTime = (CONTEXT_TIME_FN_PTR)dlsym(gssLib, CONTEXT_TIME);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    if (ftab->contextTime == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    ftab->wrapSizeLimit = (WRAP_SIZE_LIMIT_FN_PTR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
                        dlsym(gssLib, WRAP_SIZE_LIMIT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    if (ftab->wrapSizeLimit == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    ftab->exportSecContext = (EXPORT_SEC_CONTEXT_FN_PTR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
                        dlsym(gssLib, EXPORT_SEC_CONTEXT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    if (ftab->exportSecContext == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    ftab->getMic = (GET_MIC_FN_PTR)dlsym(gssLib, GET_MIC);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    if (ftab->getMic == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    ftab->verifyMic = (VERIFY_MIC_FN_PTR)dlsym(gssLib, VERIFY_MIC);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    if (ftab->verifyMic == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    ftab->wrap = (WRAP_FN_PTR)dlsym(gssLib, WRAP);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    if (ftab->wrap == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    ftab->unwrap = (UNWRAP_FN_PTR)dlsym(gssLib, UNWRAP);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    if (ftab->unwrap == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    ftab->indicateMechs = (INDICATE_MECHS_FN_PTR)dlsym(gssLib, INDICATE_MECHS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    if (ftab->indicateMechs == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    ftab->inquireNamesForMech = (INQUIRE_NAMES_FOR_MECH_FN_PTR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
                        dlsym(gssLib, INQUIRE_NAMES_FOR_MECH);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    if (ftab->inquireNamesForMech == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    ftab->addOidSetMember = (ADD_OID_SET_MEMBER_FN_PTR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
                        dlsym(gssLib, ADD_OID_SET_MEMBER);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    if (ftab->addOidSetMember == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    ftab->displayStatus = (DISPLAY_STATUS_FN_PTR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
                        dlsym(gssLib, DISPLAY_STATUS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    if (ftab->displayStatus == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    ftab->createEmptyOidSet = (CREATE_EMPTY_OID_SET_FN_PTR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
                        dlsym(gssLib, CREATE_EMPTY_OID_SET);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    if (ftab->createEmptyOidSet == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    ftab->releaseOidSet = (RELEASE_OID_SET_FN_PTR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
                        dlsym(gssLib, RELEASE_OID_SET);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    if (ftab->releaseOidSet == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    ftab->releaseBuffer = (RELEASE_BUFFER_FN_PTR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
                        dlsym(gssLib, RELEASE_BUFFER);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    if (ftab->releaseBuffer == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
    ftab->mechs = GSS_C_NO_OID_SET;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    major = (*ftab->indicateMechs)(&minor, &(ftab->mechs));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    if (ftab->mechs == NULL || ftab->mechs == GSS_C_NO_OID_SET) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
        failed = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
        goto out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
out:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    if (failed == TRUE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
        error = dlerror();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
        if (gssLib != NULL) dlclose(gssLib);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
        if (ftab != NULL) free(ftab);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    return error;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
}