Skip to content

Commit

Permalink
Require that the minorversion field in COMPOUND4args is set properly
Browse files Browse the repository at this point in the history
If clients want to do automatic detection of the version of NFSv4 that
is supported by the server, this check must be in place.
  • Loading branch information
EdSchouten committed Jul 10, 2024
1 parent 6350e7a commit d8809a2
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 61 deletions.
7 changes: 7 additions & 0 deletions pkg/filesystem/virtual/nfsv4/nfs40_program.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ func (*nfs40Program) NfsV4Nfsproc4Null(ctx context.Context) error {
}

func (p *nfs40Program) NfsV4Nfsproc4Compound(ctx context.Context, arguments *nfsv4.Compound4args) (*nfsv4.Compound4res, error) {
if arguments.Minorversion != 0 {
return &nfsv4.Compound4res{
Status: nfsv4.NFS4ERR_MINOR_VERS_MISMATCH,
Tag: arguments.Tag,
}, nil
}

// Create compound state and process all operations sequentially
// against it.
state := compoundState{program: p}
Expand Down
7 changes: 7 additions & 0 deletions pkg/filesystem/virtual/nfsv4/nfs41_program.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ func (*nfs41Program) NfsV4Nfsproc4Null(ctx context.Context) error {
}

func (p *nfs41Program) NfsV4Nfsproc4Compound(ctx context.Context, arguments *nfsv4.Compound4args) (*nfsv4.Compound4res, error) {
if arguments.Minorversion != 1 {
return &nfsv4.Compound4res{
Status: nfsv4.NFS4ERR_MINOR_VERS_MISMATCH,
Tag: arguments.Tag,
}, nil
}

var resArray []nfsv4.NfsResop4
status := nfsv4.NFS4_OK
if len(arguments.Argarray) >= 1 {
Expand Down
Loading

0 comments on commit d8809a2

Please sign in to comment.