Skip to content

Commit fff81fd

Browse files
committed
Revert QOP level tracking
1 parent 260a964 commit fff81fd

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

crates/hdfs-native/src/security/digest.rs

+6-13
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ static CHALLENGE_PATTERN: Lazy<Regex> =
2323
Lazy::new(|| Regex::new(r#",?([a-zA-Z0-9]+)=("([^"]+)"|([^,]+)),?"#).unwrap());
2424
static RESPONSE_PATTERN: Lazy<Regex> = Lazy::new(|| Regex::new("rspauth=([a-f0-9]{32})").unwrap());
2525

26-
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
26+
#[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
27+
#[repr(u8)]
2728
enum Qop {
28-
Auth,
29-
AuthInt,
30-
AuthConf,
29+
Auth = 0,
30+
AuthInt = 1,
31+
AuthConf = 2,
3132
}
3233

3334
impl TryFrom<&str> for Qop {
@@ -67,14 +68,6 @@ impl Display for Qop {
6768
}
6869

6970
impl Qop {
70-
fn security_level(&self) -> u8 {
71-
match self {
72-
Self::Auth => 0,
73-
Self::AuthInt => 1,
74-
Self::AuthConf => 2,
75-
}
76-
}
77-
7871
fn has_security_layer(&self) -> bool {
7972
!matches!(self, Qop::Auth)
8073
}
@@ -86,7 +79,7 @@ fn choose_qop(options: Vec<Qop>) -> Result<Qop> {
8679
options
8780
.into_iter()
8881
.filter(|qop| SUPPORTED_QOPS.contains(qop))
89-
.max_by(|x, y| x.security_level().cmp(&y.security_level()))
82+
.max_by(|x, y| x.cmp(y))
9083
.ok_or(HdfsError::SASLError(
9184
"No valid QOP found for negotiation".to_string(),
9285
))

0 commit comments

Comments
 (0)