Search code examples
caclrpcnfsxdr

NFSACL GETACL / SETACL structes


I have a proxy server between the client and server.

I use XDR to read and modify NFS messages between them

for example if i want to edit the file size for and get attributes reply i use the struct and function

GETATTR3res

bool_t xdr_GETATTR3res ( XDR *xdrs, GETATTR3res *objp );

now i want to use the same method to modify replys for

RPC:

Program: NFSACL (100227)

Program version: 3

Procedure: GETACL (1) and SETACL (2)

i want to edit the (fattr3) attributes field with xdr

either a XDR function for NFSACL or even deconstructed XDR function for the fields NFSACL procedures have


Solution

  • I have found this list of structures that with smaller XDR function can be used to modify the attributes

    struct GETACL3args {
        nfs_fh3 fh;
        uint32 mask;
    };
    typedef struct GETACL3args GETACL3args;
    
    struct GETACL3resok {
        post_op_attr attr;
        vsecattr_t acl;
    };
    typedef struct GETACL3resok GETACL3resok;
    
    struct GETACL3resfail {
        post_op_attr attr;
    };
    typedef struct GETACL3resfail GETACL3resfail;
    
    struct GETACL3res {
        nfsstat3 status;
        union {
            GETACL3resok ok;
            GETACL3resfail fail;
        } res_u;
    };
    typedef struct GETACL3res GETACL3res;
    
    struct SETACL3args {
        nfs_fh3 fh;
        vsecattr_t acl;
    };
    typedef struct SETACL3args SETACL3args;
    
    struct SETACL3resok {
        post_op_attr attr;
    };
    typedef struct SETACL3resok SETACL3resok;
    
    struct SETACL3resfail {
        post_op_attr attr;
    };
    typedef struct SETACL3resfail SETACL3resfail;
    
    struct SETACL3res {
        nfsstat3 status;
        union {
            SETACL3resok ok;
            SETACL3resfail fail;
        } res_u;
    };
    typedef struct SETACL3res SETACL3res;
    

    and using xdr_post_op_attr to decode and enconde back