Skip to content

Commit

Permalink
gssapi: fix dlsym() return value casting
Browse files Browse the repository at this point in the history
Fix warnings on Windows (and possibly other platforms) but appropriately
casting the return value of dlsym().
  • Loading branch information
lhoward committed Jan 3, 2019
1 parent f17e48f commit 29fe69f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
20 changes: 10 additions & 10 deletions lib/gssapi/gssapi_mech.h
Expand Up @@ -277,36 +277,36 @@ typedef OM_uint32 GSSAPI_CALLCONV _gss_duplicate_name_t (
gss_name_t * /* dest_name */
);

typedef OM_uint32 GSSAPI_CALLCONV _gss_inquire_sec_context_by_oid (
typedef OM_uint32 GSSAPI_CALLCONV _gss_inquire_sec_context_by_oid_t (
OM_uint32 *minor_status,
gss_const_ctx_id_t context_handle,
const gss_OID desired_object,
gss_buffer_set_t *data_set
);

typedef OM_uint32 GSSAPI_CALLCONV _gss_inquire_cred_by_oid (
typedef OM_uint32 GSSAPI_CALLCONV _gss_inquire_cred_by_oid_t (
OM_uint32 *minor_status,
gss_const_cred_id_t cred,
const gss_OID desired_object,
gss_buffer_set_t *data_set
);

typedef OM_uint32 GSSAPI_CALLCONV _gss_set_sec_context_option (
typedef OM_uint32 GSSAPI_CALLCONV _gss_set_sec_context_option_t (
OM_uint32 *minor_status,
gss_ctx_id_t *cred_handle,
const gss_OID desired_object,
const gss_buffer_t value
);

typedef OM_uint32 GSSAPI_CALLCONV _gss_set_cred_option (
typedef OM_uint32 GSSAPI_CALLCONV _gss_set_cred_option_t (
OM_uint32 *minor_status,
gss_cred_id_t *cred_handle,
const gss_OID desired_object,
const gss_buffer_t value
);


typedef OM_uint32 GSSAPI_CALLCONV _gss_pseudo_random(
typedef OM_uint32 GSSAPI_CALLCONV _gss_pseudo_random_t (
OM_uint32 *minor_status,
gss_ctx_id_t context,
int prf_key,
Expand Down Expand Up @@ -524,11 +524,11 @@ typedef struct gssapi_mech_interface_desc {
_gss_inquire_mechs_for_name_t *gm_inquire_mechs_for_name;
_gss_canonicalize_name_t *gm_canonicalize_name;
_gss_duplicate_name_t *gm_duplicate_name;
_gss_inquire_sec_context_by_oid *gm_inquire_sec_context_by_oid;
_gss_inquire_cred_by_oid *gm_inquire_cred_by_oid;
_gss_set_sec_context_option *gm_set_sec_context_option;
_gss_set_cred_option *gm_set_cred_option;
_gss_pseudo_random *gm_pseudo_random;
_gss_inquire_sec_context_by_oid_t *gm_inquire_sec_context_by_oid;
_gss_inquire_cred_by_oid_t *gm_inquire_cred_by_oid;
_gss_set_sec_context_option_t *gm_set_sec_context_option;
_gss_set_cred_option_t *gm_set_cred_option;
_gss_pseudo_random_t *gm_pseudo_random;
_gss_wrap_iov_t *gm_wrap_iov;
_gss_unwrap_iov_t *gm_unwrap_iov;
_gss_wrap_iov_length_t *gm_wrap_iov_length;
Expand Down
12 changes: 6 additions & 6 deletions lib/gssapi/mech/gss_mech_switch.c
Expand Up @@ -164,7 +164,7 @@ _gss_string_to_oid(const char* s, gss_OID *oidp)

#define SYM(name) \
do { \
m->gm_mech.gm_ ## name = dlsym(so, "gss_" #name); \
m->gm_mech.gm_ ## name = (_gss_##name##_t *)dlsym(so, "gss_" #name); \
if (!m->gm_mech.gm_ ## name || \
m->gm_mech.gm_ ##name == gss_ ## name) { \
fprintf(stderr, "can't find symbol gss_" #name "\n"); \
Expand All @@ -174,26 +174,26 @@ do { \

#define OPTSYM(name) \
do { \
m->gm_mech.gm_ ## name = dlsym(so, "gss_" #name); \
m->gm_mech.gm_ ## name = (_gss_##name##_t *)dlsym(so, "gss_" #name); \
if (m->gm_mech.gm_ ## name == gss_ ## name) \
m->gm_mech.gm_ ## name = NULL; \
} while (0)

#define OPTSPISYM(name) \
do { \
m->gm_mech.gm_ ## name = dlsym(so, "gssspi_" #name); \
m->gm_mech.gm_ ## name = (_gss_##name##_t *)dlsym(so, "gssspi_" #name); \
} while (0)

#define COMPATSYM(name) \
do { \
m->gm_mech.gm_compat->gmc_ ## name = dlsym(so, "gss_" #name); \
m->gm_mech.gm_compat->gmc_ ## name = (_gss_##name##_t *)dlsym(so, "gss_" #name); \
if (m->gm_mech.gm_compat->gmc_ ## name == gss_ ## name) \
m->gm_mech.gm_compat->gmc_ ## name = NULL; \
} while (0)

#define COMPATSPISYM(name) \
do { \
m->gm_mech.gm_compat->gmc_ ## name = dlsym(so, "gssspi_" #name);\
m->gm_mech.gm_compat->gmc_ ## name = (_gss_##name##_t *)dlsym(so, "gssspi_" #name); \
if (m->gm_mech.gm_compat->gmc_ ## name == gss_ ## name) \
m->gm_mech.gm_compat->gmc_ ## name = NULL; \
} while (0)
Expand Down Expand Up @@ -405,7 +405,7 @@ _gss_load_mech(void)
OPTSYM(duplicate_cred);
OPTSPISYM(authorize_localname);

mi = dlsym(so, "gss_mo_init");
mi = (_gss_mo_init *)dlsym(so, "gss_mo_init");
if (mi != NULL) {
major_status = mi(&minor_status, mech_oid,
&m->gm_mech.gm_mo, &m->gm_mech.gm_mo_num);
Expand Down

0 comments on commit 29fe69f

Please sign in to comment.