Skip to content

Commit

Permalink
Change declaration of function map
Browse files Browse the repository at this point in the history
Newer compilers complain if funciton is declared w/o arguments,
so we redeclare the xdrptoc_t as xdrfn and give it proper arguments

Signed-off-by: Simo Sorce <[email protected]>
  • Loading branch information
simo5 committed Feb 10, 2025
1 parent 27bdf92 commit 1dcd6ae
Showing 1 changed file with 44 additions and 36 deletions.
80 changes: 44 additions & 36 deletions src/client/gpm_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,73 +600,77 @@ OM_uint32 gpm_release_buffer(OM_uint32 *minor_status,
return GSS_S_COMPLETE;
}

/* Equivalent to xdrptoc_t but with proper arguments so that modern
* compilers do not complain */
typedef int xdrfn(XDR *, void *);

struct gpm_rpc_fn_set {
xdrproc_t arg_fn;
xdrproc_t res_fn;
xdrfn *arg_fn;
xdrfn *res_fn;
} gpm_xdr_set[] = {
{ /* NULLPROC */
(xdrproc_t)xdr_void,
(xdrproc_t)xdr_void,
(xdrfn *)xdr_void,
(xdrfn *)xdr_void,
},
{ /* GSSX_INDICATE_MECHS */
(xdrproc_t)xdr_gssx_arg_indicate_mechs,
(xdrproc_t)xdr_gssx_res_indicate_mechs,
(xdrfn *)xdr_gssx_arg_indicate_mechs,
(xdrfn *)xdr_gssx_res_indicate_mechs,
},
{ /* GSSX_GET_CALL_CONTEXT */
(xdrproc_t)xdr_gssx_arg_get_call_context,
(xdrproc_t)xdr_gssx_res_get_call_context,
(xdrfn *)xdr_gssx_arg_get_call_context,
(xdrfn *)xdr_gssx_res_get_call_context,
},
{ /* GSSX_IMPORT_AND_CANON_NAME */
(xdrproc_t)xdr_gssx_arg_import_and_canon_name,
(xdrproc_t)xdr_gssx_res_import_and_canon_name,
(xdrfn *)xdr_gssx_arg_import_and_canon_name,
(xdrfn *)xdr_gssx_res_import_and_canon_name,
},
{ /* GSSX_EXPORT_CRED */
(xdrproc_t)xdr_gssx_arg_export_cred,
(xdrproc_t)xdr_gssx_res_export_cred,
(xdrfn *)xdr_gssx_arg_export_cred,
(xdrfn *)xdr_gssx_res_export_cred,
},
{ /* GSSX_IMPORT_CRED */
(xdrproc_t)xdr_gssx_arg_import_cred,
(xdrproc_t)xdr_gssx_res_import_cred,
(xdrfn *)xdr_gssx_arg_import_cred,
(xdrfn *)xdr_gssx_res_import_cred,
},
{ /* GSSX_ACQUIRE_CRED */
(xdrproc_t)xdr_gssx_arg_acquire_cred,
(xdrproc_t)xdr_gssx_res_acquire_cred,
(xdrfn *)xdr_gssx_arg_acquire_cred,
(xdrfn *)xdr_gssx_res_acquire_cred,
},
{ /* GSSX_STORE_CRED */
(xdrproc_t)xdr_gssx_arg_store_cred,
(xdrproc_t)xdr_gssx_res_store_cred,
(xdrfn *)xdr_gssx_arg_store_cred,
(xdrfn *)xdr_gssx_res_store_cred,
},
{ /* GSSX_INIT_SEC_CONTEXT */
(xdrproc_t)xdr_gssx_arg_init_sec_context,
(xdrproc_t)xdr_gssx_res_init_sec_context,
(xdrfn *)xdr_gssx_arg_init_sec_context,
(xdrfn *)xdr_gssx_res_init_sec_context,
},
{ /* GSSX_ACCEPT_SEC_CONTEXT */
(xdrproc_t)xdr_gssx_arg_accept_sec_context,
(xdrproc_t)xdr_gssx_res_accept_sec_context,
(xdrfn *)xdr_gssx_arg_accept_sec_context,
(xdrfn *)xdr_gssx_res_accept_sec_context,
},
{ /* GSSX_RELEASE_HANDLE */
(xdrproc_t)xdr_gssx_arg_release_handle,
(xdrproc_t)xdr_gssx_res_release_handle,
(xdrfn *)xdr_gssx_arg_release_handle,
(xdrfn *)xdr_gssx_res_release_handle,
},
{ /* GSSX_GET_MIC */
(xdrproc_t)xdr_gssx_arg_get_mic,
(xdrproc_t)xdr_gssx_res_get_mic,
(xdrfn *)xdr_gssx_arg_get_mic,
(xdrfn *)xdr_gssx_res_get_mic,
},
{ /* GSSX_VERIFY */
(xdrproc_t)xdr_gssx_arg_verify_mic,
(xdrproc_t)xdr_gssx_res_verify_mic,
(xdrfn *)xdr_gssx_arg_verify_mic,
(xdrfn *)xdr_gssx_res_verify_mic,
},
{ /* GSSX_WRAP */
(xdrproc_t)xdr_gssx_arg_wrap,
(xdrproc_t)xdr_gssx_res_wrap,
(xdrfn *)xdr_gssx_arg_wrap,
(xdrfn *)xdr_gssx_res_wrap,
},
{ /* GSSX_UNWRAP */
(xdrproc_t)xdr_gssx_arg_unwrap,
(xdrproc_t)xdr_gssx_res_unwrap,
(xdrfn *)xdr_gssx_arg_unwrap,
(xdrfn *)xdr_gssx_res_unwrap,
},
{ /* GSSX_WRAP_SIZE_LIMIT */
(xdrproc_t)xdr_gssx_arg_wrap_size_limit,
(xdrproc_t)xdr_gssx_res_wrap_size_limit,
(xdrfn *)xdr_gssx_arg_wrap_size_limit,
(xdrfn *)xdr_gssx_res_wrap_size_limit,
}
};

Expand All @@ -676,6 +680,8 @@ int gpm_make_call(int proc, union gp_rpc_arg *arg, union gp_rpc_res *res)
gp_rpc_msg msg;
XDR xdr_call_ctx = {0};
XDR xdr_reply_ctx = {0};
xdrfn *arg_fn;
xdrfn *res_fn;
char *send_buffer = NULL;
char *recv_buffer = NULL;
uint32_t send_length;
Expand Down Expand Up @@ -726,7 +732,8 @@ int gpm_make_call(int proc, union gp_rpc_arg *arg, union gp_rpc_res *res)
}

/* encode data */
xdrok = gpm_xdr_set[proc].arg_fn(&xdr_call_ctx, (char *)arg);
arg_fn = gpm_xdr_set[proc].arg_fn;
xdrok = arg_fn(&xdr_call_ctx, arg);
if (!xdrok) {
ret = EINVAL;
goto done;
Expand Down Expand Up @@ -765,7 +772,8 @@ int gpm_make_call(int proc, union gp_rpc_arg *arg, union gp_rpc_res *res)
}

/* decode answer */
xdrok = gpm_xdr_set[proc].res_fn(&xdr_reply_ctx, (char *)res);
res_fn = gpm_xdr_set[proc].res_fn;
xdrok = res_fn(&xdr_reply_ctx, res);
if (!xdrok) {
ret = EINVAL;
}
Expand Down

0 comments on commit 1dcd6ae

Please sign in to comment.