Purpose
Indicates that the service dispatch routine cannot complete a remote procedure call due to an authentication error.
Library
RPC Library (libcrpc.a)
Syntax
Description
The svcerr_auth subroutine is called by a service dispatch subroutine that refuses to perform a remote procedure call (RPC) because of an authentication error. This subroutine sets the status of the RPC reply message to AUTH_ERROR.
Parameters
Item | Description |
---|---|
xprt | Points to the RPC service transport handle. |
why | Specifies the authentication error. |
Purpose
Indicates that the service dispatch routine cannot complete a remote procedure call due to an authentication error.
Library
Network Services Library (libnsl.a)
Syntax
Description
The svcerr_auth subroutine is called by a service dispatch subroutine when an authentication error occurs. This subroutine sets the status of the remote procedure call (RPC) reply message to RPC_AUTHERROR.
Parameters
Item | Description |
---|---|
xprt | Points to the RPC service transport handle. |
why | Specifies the authentication error. |
Examples
In the following example, a dispatch subroutine sends reply back to the client with the reason indicating why an authentication error occurred.
#include <rpc/rpc.h>
#include <stdlib.h>
#define PROG 0x3fffffffL
#define VERS 0x1L
static void sample_dispatch();
main()
{
char *nettype;
int no_of_handles;
nettype = "tcp";
/* Create RPC service handle and register with RPCBIND service */
if((no_of_handles = svc_create(sample_dispatch, PROG, VERS,nettype)) == 0)
{
fprintf(stdout, " Error in svc_create ");
exit(EXIT_FAILURE);
}
svc_run();
return 0;
}
/* following is the sample dispatch routine*/
static void sample_dispatch(struct svc_req *request, SVCXPRT *xprt)
{
int result;
enum auth_stat why;
/* Check for appropriate authentication */
/* set reason for authentication error */
why = AUTH_BADCRED;
/* Send reply to client */
svcerr_auth(xprt,why);
}