Skip to content

Commit

Permalink
nfs: improve probing parser
Browse files Browse the repository at this point in the history
Checks credentials flavor is known
  • Loading branch information
catenacyber committed Jun 7, 2021
1 parent 344a6c3 commit f355941
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rust/src/nfs/nfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1739,7 +1739,7 @@ pub fn nfs_probe(i: &[u8], direction: u8) -> i8 {
rpc.program == 100003 &&
rpc.procedure <= NFSPROC3_COMMIT
{
return 1;
return rpc_auth_type_known(rpc.creds_flavor);
} else {
return -1;
}
Expand Down
8 changes: 8 additions & 0 deletions rust/src/nfs/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ pub fn rpc_auth_type_string(auth_type: u32) -> String {
}.to_string()
}

pub fn rpc_auth_type_known(auth_type: u32) -> i8 {
// RPCAUTH_GSS is the maximum
if auth_type <= RPCAUTH_GSS {
return 1;
}
return -1;
}

/* http://www.iana.org/assignments/rpc-authentication-numbers/rpc-authentication-numbers.xhtml */
pub const RPCAUTH_OK: u32 = 0; // success/failed at remote end [RFC5531]
pub const RPCAUTH_BADCRED: u32 = 1; // bad credential (seal broken) [RFC5531]
Expand Down

0 comments on commit f355941

Please sign in to comment.