src/usr.sbin/mountd/mountd.c
/*
 * Xdr routine to generate file handle reply
 */
Xdr routine to generate file handle reply
Xdr routine to generate file handle reply
static int
xdr_fhs(XDR *xdrsp, caddr_t cp)
{
	struct fhreturn *fhrp = (struct fhreturn *)cp;
	u_long ok = 0, len, auth;
	int i;
	if (!xdr_long(xdrsp, &ok))
		return (0);
	switch (fhrp->fhr_vers) {
	case 1:
		return (xdr_opaque(xdrsp, (caddr_t)&fhrp->fhr_fh, NFSX_V2FH));
	case 3:
		len = NFSX_V3FH;
		if (!xdr_long(xdrsp, &len))
			return (0);
		if (!xdr_opaque(xdrsp, (caddr_t)&fhrp->fhr_fh, len))
			return (0);
		if (fhrp->fhr_numsecflavors) {
			if (!xdr_int(xdrsp, &fhrp->fhr_numsecflavors))
				return (0);
			for (i = 0; i < fhrp->fhr_numsecflavors; i++)
				if (!xdr_int(xdrsp, &fhrp->fhr_secflavors[i]))
					return (0);
			return (1);
		} else {
			auth = AUTH_SYS;
			len = 1;
			if (!xdr_long(xdrsp, &len))
				return (0);
			return (xdr_long(xdrsp, &auth));
		}
	}
	return (0);
}
static int xdr_fhs ( XDR * xdrsp , caddr_t cp ) { struct fhreturn * fhrp = ( struct fhreturn * ) cp ; u_long ok = 0 , len , auth ; int i ; if ( ! xdr_long ( xdrsp , & ok ) ) return ( 0 ) ; switch ( fhrp -> fhr_vers ) { case 1 : return ( xdr_opaque ( xdrsp , ( caddr_t ) & fhrp -> fhr_fh , NFSX_V2FH ) ) ; case 3 : len = NFSX_V3FH ; if ( ! xdr_long ( xdrsp , & len ) ) return ( 0 ) ; if ( ! xdr_opaque ( xdrsp , ( caddr_t ) & fhrp -> fhr_fh , len ) ) return ( 0 ) ; if ( fhrp -> fhr_numsecflavors ) { if ( ! xdr_int ( xdrsp , & fhrp -> fhr_numsecflavors ) ) return ( 0 ) ; for ( i = 0 ; i < fhrp -> fhr_numsecflavors ; i ++ ) if ( ! xdr_int ( xdrsp , & fhrp -> fhr_secflavors [ i ] ) ) return ( 0 ) ; return ( 1 ) ; } else { auth = AUTH_SYS ; len = 1 ; if ( ! xdr_long ( xdrsp , & len ) ) return ( 0 ) ; return ( xdr_long ( xdrsp , & auth ) ) ; } } return ( 0 ) ; }
Xdr routine to generate file handle reply
Xdr routine to generate file handle reply