Gets an error number on failure.
Network Services Library (libnsl.a)
You can use the rpc_gss_get_error subroutine to retrieve the error code when RPCSEC_GSS subroutines fail.
Item | Description |
---|---|
err | Points to an rpc_gss_error_t structure. This is an output parameter. |
Item | Description |
---|---|
TRUE | successful |
FALSE | unsuccessful |
If an RPCSEC_GSS subroutine fails, only the rpc_gss_get_error subroutine sets the error to a meaningful value.
Item | Value | Description |
---|---|---|
RPC_GSS_ER_SUCCESS | 0 | No error occurred. |
RPC_GSS_ER_SYSTEMERROR | 1 | A system error occurred. |
#include <stdlib.h>
#include <rpc/rpc.h>
#include <rpc/rpcsec_gss.h>
#define PROGNUM 0x3fffffffL
#define VERSNUM 0x1L
static void sample_dispatch(struct svc_req *, SVCXPRT *);
main()
{
char *principal, *mechanism;
u_int reqtime
rpc_gss_error_t gss_error;
/* Create RPC service handle and register with RPCBIND service */
/* Initialize the required parameters */
/* Set the principal name */
if(rpc_gss_set_svc_name(principal, mechanism, req_time, PROGNUM,
VERSNUM) == FALSE)
{
fprintf(stderr,"\nError in rpc_gss_set_svc_name:\n");
/* Retrieve error */
rpc_gss_get_error(&gss_error);
fprintf(stderr,"rpc_gss_error: %d \nSystem_error: %d \n",
gss_error.rpc_gss_error,gss_error.system_error);
exit(EXIT_FAILURE);
}
svc_run();
return 1;
}
/* following is the sample dispatch routine*/
static void sample_dispatch(struct svc_req *request, SVCXPRT *xprt)
{
/* dispatch routine code */
}