Exemplo n.º 1
0
/*
 * XDR decode the long reply write chunk.
 */
bool_t
xdr_decode_reply_wchunk(XDR *xdrs, struct clist **clist)
{
	bool_t		have_rchunk = FALSE;
	struct clist	*first = NULL, *ncl = NULL;
	uint32_t	num_wclist;
	uint32_t	i;

	if (!xdr_bool(xdrs, &have_rchunk))
		return (FALSE);

	if (have_rchunk == FALSE)
		return (TRUE);

	if (!xdr_uint32(xdrs, &num_wclist)) {
		DTRACE_PROBE(krpc__e__xdrrdma__replywchunk__listlength);
		return (FALSE);
	}

	if (num_wclist == 0) {
		return (FALSE);
	}

	first = ncl = clist_alloc();

	for (i = 0; i < num_wclist; i++) {

		if (i > 0) {
			ncl->c_next = clist_alloc();
			ncl = ncl->c_next;
		}

		if (!xdr_uint32(xdrs, &ncl->c_dmemhandle.mrc_rmr))
			goto err_out;
		if (!xdr_uint32(xdrs, &ncl->c_len))
			goto err_out;
		if (!xdr_uint64(xdrs, &ncl->u.c_daddr))
			goto err_out;

		if (ncl->c_len > MAX_SVC_XFER_SIZE) {
			DTRACE_PROBE(
			    krpc__e__xdrrdma__replywchunk__chunklist_toobig);
			ncl->c_len = MAX_SVC_XFER_SIZE;
		}
		if (!(ncl->c_dmemhandle.mrc_rmr &&
		    (ncl->c_len > 0) && ncl->u.c_daddr))
			DTRACE_PROBE(
			    krpc__e__xdrrdma__replywchunk__invalid_segaddr);

		DTRACE_PROBE1(krpc__i__xdr_decode_reply_wchunk_c_len,
		    uint32_t, ncl->c_len);

	}
	*clist = first;
	return (TRUE);

err_out:
	clist_free(first);
	return (FALSE);
}
bool_t xdr_CSSM_KEYHEADER(XDR *xdrs, CSSM_KEYHEADER *objp)
{

    if (!xdr_CSSM_HEADERVERSION(xdrs, &objp->HeaderVersion))
        return (FALSE);
    if (!xdr_CSSM_GUID(xdrs, &objp->CspId))
        return (FALSE);
    if (!xdr_CSSM_KEYBLOB_TYPE(xdrs, &objp->BlobType))
        return (FALSE);
    if (!xdr_CSSM_KEYBLOB_FORMAT(xdrs, &objp->Format))
        return (FALSE);
    if (!xdr_CSSM_ALGORITHMS(xdrs, &objp->AlgorithmId))
        return (FALSE);
    if (!xdr_CSSM_KEYCLASS(xdrs, &objp->KeyClass))
        return (FALSE);
    if (!xdr_uint32(xdrs, &objp->LogicalKeySizeInBits))
        return (FALSE);
    if (!xdr_CSSM_KEYATTR_FLAGS(xdrs, &objp->KeyAttr))
        return (FALSE);
    if (!xdr_CSSM_KEYUSE(xdrs, &objp->KeyUsage))
        return (FALSE);
    if (!xdr_CSSM_DATE(xdrs, &objp->StartDate))
        return (FALSE);
    if (!xdr_CSSM_DATE(xdrs, &objp->EndDate))
        return (FALSE);
    if (!xdr_CSSM_ALGORITHMS(xdrs, &objp->WrapAlgorithmId))
        return (FALSE);
    if (!xdr_CSSM_ENCRYPT_MODE(xdrs, &objp->WrapMode))
        return (FALSE);
    if (!xdr_uint32(xdrs, &objp->Reserved))
        return (FALSE);
    return (TRUE);
}
bool_t xdr_CSSM_VERSION(XDR *xdrs, CSSM_VERSION *objp)
{
    if (!xdr_uint32(xdrs, &objp->Major))
        return (FALSE);
    if (!xdr_uint32(xdrs, &objp->Minor))
        return (FALSE);
    return (TRUE);
}
bool_t xdr_CSSM_QUERY_LIMITS(XDR *xdrs, CSSM_QUERY_LIMITS *objp)
{

    if (!xdr_uint32(xdrs, &objp->TimeLimit))
        return (FALSE);
    if (!xdr_uint32(xdrs, &objp->SizeLimit))
        return (FALSE);
    return (TRUE);
}
bool_t xdr_CSSM_RANGE(XDR *xdrs, CSSM_RANGE *objp)
{

    if (!xdr_uint32(xdrs, &objp->Min))
        return (FALSE);
    if (!xdr_uint32(xdrs, &objp->Max))
        return (FALSE);
    return (TRUE);
}
Exemplo n.º 6
0
bool_t
xdr_specdata3(register XDR *xdrs, specdata3 *objp)
{
	if (!xdr_uint32(xdrs, &objp->specdata1))
		return (FALSE);
	if (!xdr_uint32(xdrs, &objp->specdata2))
		return (FALSE);
	return (TRUE);
}
Exemplo n.º 7
0
bool_t
xdr_nfstime3(register XDR *xdrs, nfstime3 *objp)
{
	if (!xdr_uint32(xdrs, &objp->seconds))
		return (FALSE);
	if (!xdr_uint32(xdrs, &objp->nseconds))
		return (FALSE);
	return (TRUE);
}
Exemplo n.º 8
0
bool_t
xdr_specdata3 (XDR *xdrs, specdata3 *objp)
{
	 if (!xdr_uint32 (xdrs, &objp->specdata1))
		 return FALSE;
	 if (!xdr_uint32 (xdrs, &objp->specdata2))
		 return FALSE;
	return TRUE;
}
Exemplo n.º 9
0
bool_t
xdr_nfstime3 (XDR *xdrs, nfstime3 *objp)
{
	 if (!xdr_uint32 (xdrs, &objp->seconds))
		 return FALSE;
	 if (!xdr_uint32 (xdrs, &objp->nseconds))
		 return FALSE;
	return TRUE;
}
Exemplo n.º 10
0
bool_t
xdr_FSINFO3resok(register XDR *xdrs, FSINFO3resok *objp)
{
	if (!xdr_post_op_attr(xdrs, &objp->obj_attributes))
		return (FALSE);
	if (!xdr_uint32(xdrs, &objp->rtmax))
		return (FALSE);
	if (!xdr_uint32(xdrs, &objp->rtpref))
		return (FALSE);
	if (!xdr_uint32(xdrs, &objp->rtmult))
		return (FALSE);
	if (!xdr_uint32(xdrs, &objp->wtmax))
		return (FALSE);
	if (!xdr_uint32(xdrs, &objp->wtpref))
		return (FALSE);
	if (!xdr_uint32(xdrs, &objp->wtmult))
		return (FALSE);
	if (!xdr_uint32(xdrs, &objp->dtpref))
		return (FALSE);
	if (!xdr_size3(xdrs, &objp->maxfilesize))
		return (FALSE);
	if (!xdr_nfstime3(xdrs, &objp->time_delta))
		return (FALSE);
	if (!xdr_uint32(xdrs, &objp->properties))
		return (FALSE);
	return (TRUE);
}
Exemplo n.º 11
0
bool_t
xdr_ex_fattr3(XDR *xdrs, ex_fattr3 *objp)
{

	 register int32_t *buf;

	 if (!xdr_ftype3(xdrs, &objp->type)) {
		 return (FALSE);
	 }
	 if (!xdr_uint32(xdrs, &objp->mode)) {
		 return (FALSE);
	 }
	 if (!xdr_uint32(xdrs, &objp->nlink)) {
		 return (FALSE);
	 }
	 if (!xdr_uint32(xdrs, &objp->uid)) {
		 return (FALSE);
	 }
	 if (!xdr_uint32(xdrs, &objp->gid)) {
		 return (FALSE);
	 }
	 if (!xdr_uint64(xdrs, &objp->size)) {
		 return (FALSE);
	 }
	 if (!xdr_uint64(xdrs, &objp->used)) {
		 return (FALSE);
	 }
	 if (!xdr_specdata3(xdrs, &objp->rdev)) {
		 return (FALSE);
	 }
	 if (!xdr_uint64(xdrs, &objp->fsid)) {
		 return (FALSE);
	 }
	 if (!xdr_uint64(xdrs, &objp->fileid)) {
		 return (FALSE);
	 }
	 if (!xdr_nfstime3(xdrs, &objp->atime)) {
		 return (FALSE);
	 }
	 if (!xdr_nfstime3(xdrs, &objp->mtime)) {
		 return (FALSE);
	 }
	 if (!xdr_nfstime3(xdrs, &objp->ctime)) {
		 return (FALSE);
	 }
	 if (!xdr_uint32(xdrs, &objp->expire)) {
		 return (FALSE);
	 }
	return (TRUE);
}
Exemplo n.º 12
0
bool_t
xdr_fsinfo3resok (XDR *xdrs, fsinfo3resok *objp)
{
	 if (!xdr_post_op_attr (xdrs, &objp->obj_attributes))
		 return FALSE;
	 if (!xdr_uint32 (xdrs, &objp->rtmax))
		 return FALSE;
	 if (!xdr_uint32 (xdrs, &objp->rtpref))
		 return FALSE;
	 if (!xdr_uint32 (xdrs, &objp->rtmult))
		 return FALSE;
	 if (!xdr_uint32 (xdrs, &objp->wtmax))
		 return FALSE;
	 if (!xdr_uint32 (xdrs, &objp->wtpref))
		 return FALSE;
	 if (!xdr_uint32 (xdrs, &objp->wtmult))
		 return FALSE;
	 if (!xdr_uint32 (xdrs, &objp->dtpref))
		 return FALSE;
	 if (!xdr_size3 (xdrs, &objp->maxfilesize))
		 return FALSE;
	 if (!xdr_nfstime3 (xdrs, &objp->time_delta))
		 return FALSE;
	 if (!xdr_uint32 (xdrs, &objp->properties))
		 return FALSE;
	return TRUE;
}
Exemplo n.º 13
0
bool_t
xdr_nfstime3(XDR *xdrs, nfstime3 *objp)
{

	 register int32_t *buf;

	 if (!xdr_uint32(xdrs, &objp->seconds)) {
		 return (FALSE);
	 }
	 if (!xdr_uint32(xdrs, &objp->nseconds)) {
		 return (FALSE);
	 }
	return (TRUE);
}
Exemplo n.º 14
0
bool_t
xdr_specdata3(XDR *xdrs, specdata3 *objp)
{

	 register int32_t *buf;

	 if (!xdr_uint32(xdrs, &objp->major)) {
		 return (FALSE);
	 }
	 if (!xdr_uint32(xdrs, &objp->minor)) {
		 return (FALSE);
	 }
	return (TRUE);
}
Exemplo n.º 15
0
/*
 * Not all fields in struct clist are interesting to the RPC over RDMA
 * protocol. Only XDR the interesting fields.
 */
bool_t
xdr_clist(XDR *xdrs, clist *objp)
{
	if (!xdr_uint32(xdrs, &objp->c_xdroff))
		return (FALSE);
	if (!xdr_uint32(xdrs, &objp->c_smemhandle.mrc_rmr))
		return (FALSE);
	if (!xdr_uint32(xdrs, &objp->c_len))
		return (FALSE);
	if (!xdr_uint64(xdrs, &objp->w.c_saddr))
		return (FALSE);
	if (!xdr_do_clist(xdrs, &objp->c_next))
		return (FALSE);
	return (TRUE);
}
Exemplo n.º 16
0
/*
 * Conditionally decode a RDMA WRITE chunk list from XDR stream.
 *
 * If the next boolean in the XDR stream is false there is no
 * RDMA WRITE chunk list present. Otherwise iterate over the
 * array and for each entry: allocate a struct clist and decode.
 * Pass back an indication via wlist_exists if we have seen a
 * RDMA WRITE chunk list.
 */
bool_t
xdr_decode_wlist(XDR *xdrs, struct clist **w, bool_t *wlist_exists)
{
	struct clist	*tmp;
	bool_t		more = FALSE;
	uint32_t	seg_array_len;
	uint32_t	i;

	if (!xdr_bool(xdrs, &more))
		return (FALSE);

	/* is there a wlist? */
	if (more == FALSE) {
		*wlist_exists = FALSE;
		return (TRUE);
	}
	*wlist_exists = TRUE;

	if (!xdr_uint32(xdrs, &seg_array_len))
		return (FALSE);

	tmp = *w = clist_alloc();
	for (i = 0; i < seg_array_len; i++) {

		if (!xdr_uint32(xdrs, &tmp->c_dmemhandle.mrc_rmr))
			return (FALSE);
		if (!xdr_uint32(xdrs, &tmp->c_len))
			return (FALSE);

		DTRACE_PROBE1(krpc__i__xdr_decode_wlist_len,
		    uint_t, tmp->c_len);

		if (!xdr_uint64(xdrs, &tmp->u.c_daddr))
			return (FALSE);
		if (i < seg_array_len - 1) {
			tmp->c_next = clist_alloc();
			tmp = tmp->c_next;
		} else {
			tmp->c_next = NULL;
		}
	}

	more = FALSE;
	if (!xdr_bool(xdrs, &more))
		return (FALSE);

	return (TRUE);
}
Exemplo n.º 17
0
bool_t
xdr_fattr3 (XDR *xdrs, fattr3 *objp)
{
	 if (!xdr_ftype3 (xdrs, &objp->type))
		 return FALSE;
	 if (!xdr_mode3 (xdrs, &objp->mode))
		 return FALSE;
	 if (!xdr_uint32 (xdrs, &objp->nlink))
		 return FALSE;
	 if (!xdr_uid3 (xdrs, &objp->uid))
		 return FALSE;
	 if (!xdr_gid3 (xdrs, &objp->gid))
		 return FALSE;
	 if (!xdr_size3 (xdrs, &objp->size))
		 return FALSE;
	 if (!xdr_size3 (xdrs, &objp->used))
		 return FALSE;
	 if (!xdr_specdata3 (xdrs, &objp->rdev))
		 return FALSE;
	 if (!xdr_uint64 (xdrs, &objp->fsid))
		 return FALSE;
	 if (!xdr_fileid3 (xdrs, &objp->fileid))
		 return FALSE;
	 if (!xdr_nfstime3 (xdrs, &objp->atime))
		 return FALSE;
	 if (!xdr_nfstime3 (xdrs, &objp->mtime))
		 return FALSE;
	 if (!xdr_nfstime3 (xdrs, &objp->ctime))
		 return FALSE;
	return TRUE;
}
Exemplo n.º 18
0
bool_t
xdr_gid3 (XDR *xdrs, gid3 *objp)
{
	 if (!xdr_uint32 (xdrs, objp))
		 return FALSE;
	return TRUE;
}
Exemplo n.º 19
0
/*
 * XDR loopback unix auth parameters.
 * NOTE: this is an XDR_ENCODE only routine.
 */
bool_t
xdr_authloopback(XDR *xdrs)
{
	uid_t uid;
	gid_t gid;
	int len;
	caddr_t groups;
	char *name = uts_nodename();
	struct cred *cr;
	time_t now;

	if (xdrs->x_op != XDR_ENCODE)
		return (FALSE);

	cr = CRED();
	uid = crgetuid(cr);
	gid = crgetgid(cr);
	len = crgetngroups(cr);
	groups = (caddr_t)crgetgroups(cr);
	now = gethrestime_sec();
	if (xdr_uint32(xdrs, (uint32_t *)&now) &&
	    xdr_string(xdrs, &name, MAX_MACHINE_NAME) &&
	    xdr_uid_t(xdrs, &uid) &&
	    xdr_gid_t(xdrs, &gid) &&
	    xdr_array(xdrs, &groups, (uint_t *)&len, NGRPS_LOOPBACK,
	    sizeof (int), (xdrproc_t)xdr_int))
		return (TRUE);
	return (FALSE);
}
Exemplo n.º 20
0
bool_t
xdr_count3 (XDR *xdrs, count3 *objp)
{
	 if (!xdr_uint32 (xdrs, objp))
		 return FALSE;
	return TRUE;
}
Exemplo n.º 21
0
bool_t
xdr_mode3 (XDR *xdrs, mode3 *objp)
{
	 if (!xdr_uint32 (xdrs, objp))
		 return FALSE;
	return TRUE;
}
Exemplo n.º 22
0
bool_t
xdr_uid3(register XDR *xdrs, uid3 *objp)
{
	if (!xdr_uint32(xdrs, objp))
		return (FALSE);
	return (TRUE);
}
Exemplo n.º 23
0
bool_t
xdr_ex_fsstat3resok(XDR *xdrs, ex_fsstat3resok *objp)
{

	 register int32_t *buf;

	 if (!xdr_ex_post_op_attr(xdrs, &objp->obj_attributes)) {
		 return (FALSE);
	 }
	 if (!xdr_uint64(xdrs, &objp->tbytes)) {
		 return (FALSE);
	 }
	 if (!xdr_uint64(xdrs, &objp->fbytes)) {
		 return (FALSE);
	 }
	 if (!xdr_uint64(xdrs, &objp->abytes)) {
		 return (FALSE);
	 }
	 if (!xdr_uint64(xdrs, &objp->tfiles)) {
		 return (FALSE);
	 }
	 if (!xdr_uint64(xdrs, &objp->ffiles)) {
		 return (FALSE);
	 }
	 if (!xdr_uint64(xdrs, &objp->afiles)) {
		 return (FALSE);
	 }
	 if (!xdr_uint32(xdrs, &objp->invarsec)) {
		 return (FALSE);
	 }
	return (TRUE);
}
Exemplo n.º 24
0
bool_t xdr_CSSM_DB_ATTRIBUTE_INFO(XDR *xdrs, CSSM_DB_ATTRIBUTE_INFO *objp)
{
    if (!xdr_CSSM_DB_ATTRIBUTE_NAME_FORMAT(xdrs, &objp->AttributeNameFormat))
        return (FALSE);
    switch (objp->AttributeNameFormat)
    {
    case CSSM_DB_ATTRIBUTE_NAME_AS_STRING:
        if (!sec_xdr_charp(xdrs, &objp->Label.AttributeName, ~0))
            return (FALSE);
        break;
    case CSSM_DB_ATTRIBUTE_NAME_AS_OID:
        if (!xdr_CSSM_OID(xdrs, &objp->Label.AttributeOID))
            return (FALSE);
        break;
    case CSSM_DB_ATTRIBUTE_NAME_AS_INTEGER: // @@@ apparently unused
        if (!xdr_uint32(xdrs, &objp->Label.AttributeID))
            return (FALSE);
        break;
    default:
        return (FALSE);
    }
    if (!xdr_CSSM_DB_ATTRIBUTE_FORMAT(xdrs, &objp->AttributeFormat))
        return (FALSE);
    return (TRUE);
}
Exemplo n.º 25
0
bool_t
xdr_gid3(XDR *xdrs, gid3 *objp)
{

	if (!xdr_uint32(xdrs, objp))
		return (FALSE);
	return (TRUE);
}
Exemplo n.º 26
0
bool_t
xdr_mode3(XDR *xdrs, mode3 *objp)
{

	if (!xdr_uint32(xdrs, objp))
		return (FALSE);
	return (TRUE);
}
Exemplo n.º 27
0
bool_t
xdr_count3(XDR *xdrs, count3 *objp)
{

	if (!xdr_uint32(xdrs, objp))
		return (FALSE);
	return (TRUE);
}
Exemplo n.º 28
0
bool_t
xdr_access3resok (XDR *xdrs, access3resok *objp)
{
	 if (!xdr_post_op_attr (xdrs, &objp->obj_attributes))
		 return FALSE;
	 if (!xdr_uint32 (xdrs, &objp->access))
		 return FALSE;
	return TRUE;
}
Exemplo n.º 29
0
bool_t
xdr_access3args (XDR *xdrs, access3args *objp)
{
	 if (!xdr_nfs_fh3 (xdrs, &objp->object))
		 return FALSE;
	 if (!xdr_uint32 (xdrs, &objp->access))
		 return FALSE;
	return TRUE;
}
Exemplo n.º 30
0
bool_t
xdr_ACCESS3resok(register XDR *xdrs, ACCESS3resok *objp)
{
	if (!xdr_post_op_attr(xdrs, &objp->obj_attributes))
		return (FALSE);
	if (!xdr_uint32(xdrs, &objp->access))
		return (FALSE);
	return (TRUE);
}