FreeBSD/sys/rpc/svc_auth.c
/*
 * The call rpc message, msg has been obtained from the wire.  The msg contains
 * the raw form of credentials and verifiers.  authenticate returns AUTH_OK
 * if the msg is successfully authenticated.  If AUTH_OK then the routine also
 * does the following things:
 * set rqst->rq_xprt->verf to the appropriate response verifier;
 * sets rqst->rq_client_cred to the "cooked" form of the credentials.
 *
 * NB: rqst->rq_cxprt->verf must be pre-alloctaed;
 * its length is set appropriately.
 *
 * The caller still owns and is responsible for msg->u.cmb.cred and
 * msg->u.cmb.verf.  The authentication system retains ownership of
 * rqst->rq_client_cred, the cooked credentials.
 *
 * There is an assumption that any flavour less than AUTH_NULL is
 * invalid.
 */
The call rpc message, msg has been obtained from the wire.  The msg contains
the raw form of credentials and verifiers.  authenticate returns AUTH_OK
if the msg is successfully authenticated.  If AUTH_OK then the routine also
does the following things:
set rqst->rq_xprt->verf to the appropriate response verifier;
sets rqst->rq_client_cred to the "cooked" form of the credentials.

rqst->rq_cxprt->verf must be pre-alloctaed;
its length is set appropriately.

The caller still owns and is responsible for msg->u.cmb.cred and
msg->u.cmb.verf.  The authentication system retains ownership of
rqst->rq_client_cred, the cooked credentials.

There is an assumption that any flavour less than AUTH_NULL is
invalid.
The call rpc message msg has been obtained from the wire . The msg contains the raw form of credentials and verifiers . authenticate returns AUTH_OK if the msg is successfully authenticated . If AUTH_OK then the routine also does the following things : set rqst - > rq_xprt - > verf to the appropriate response verifier ; sets rqst - > rq_client_cred to the " cooked " form of the credentials . rqst - > rq_cxprt - > verf must be pre - alloctaed ; its length is set appropriately . The caller still owns and is responsible for msg - > u . cmb . cred and msg - > u . cmb . verf . The authentication system retains ownership of rqst - > rq_client_cred the cooked credentials . There is an assumption that any flavour less than AUTH_NULL is invalid .
enum auth_stat
_authenticate(struct svc_req *rqst, struct rpc_msg *msg)
{
	int cred_flavor;
	enum auth_stat dummy;
	rqst->rq_cred = msg->rm_call.cb_cred;
	rqst->rq_auth.svc_ah_ops = &svc_auth_null_ops;
	rqst->rq_auth.svc_ah_private = NULL;
	cred_flavor = rqst->rq_cred.oa_flavor;
	switch (cred_flavor) {
	case AUTH_NULL:
		dummy = _svcauth_null(rqst, msg);
		return (dummy);
	case AUTH_SYS:
		dummy = _svcauth_unix(rqst, msg);
		return (dummy);
	case AUTH_SHORT:
		dummy = _svcauth_short(rqst, msg);
		return (dummy);
	case RPCSEC_GSS:
		if (!_svcauth_rpcsec_gss)
			return (AUTH_REJECTEDCRED);
		dummy = _svcauth_rpcsec_gss(rqst, msg);
		return (dummy);
	default:
		break;
	}
	return (AUTH_REJECTEDCRED);
}
enum auth_stat _authenticate ( struct svc_req * rqst , struct rpc_msg * msg ) { int cred_flavor ; enum auth_stat dummy ; rqst -> rq_cred = msg -> rm_call . cb_cred ; rqst -> rq_auth . svc_ah_ops = & svc_auth_null_ops ; rqst -> rq_auth . svc_ah_private = NULL ; cred_flavor = rqst -> rq_cred . oa_flavor ; switch ( cred_flavor ) { case AUTH_NULL : dummy = _svcauth_null ( rqst , msg ) ; return ( dummy ) ; case AUTH_SYS : dummy = _svcauth_unix ( rqst , msg ) ; return ( dummy ) ; case AUTH_SHORT : dummy = _svcauth_short ( rqst , msg ) ; return ( dummy ) ; case RPCSEC_GSS : if ( ! _svcauth_rpcsec_gss ) return ( AUTH_REJECTEDCRED ) ; dummy = _svcauth_rpcsec_gss ( rqst , msg ) ; return ( dummy ) ; default : break ; } return ( AUTH_REJECTEDCRED ) ; }
The call rpc message, msg has been obtained from the wire.
The call rpc message msg has been obtained from the wire .