|
|
|
@ -256,6 +256,11 @@ pub struct CompareRequest {
|
|
|
|
pub ava: AttributeValueAssertion,
|
|
|
|
pub ava: AttributeValueAssertion,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
|
|
|
|
|
|
pub struct AbandonRequest {
|
|
|
|
|
|
|
|
pub message_id: u32,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
|
|
pub struct ExtendedRequest {
|
|
|
|
pub struct ExtendedRequest {
|
|
|
|
pub request_name: LdapOID,
|
|
|
|
pub request_name: LdapOID,
|
|
|
|
@ -297,7 +302,7 @@ pub enum ProtocolOp {
|
|
|
|
ExtendedRequest(ExtendedRequest),
|
|
|
|
ExtendedRequest(ExtendedRequest),
|
|
|
|
ExtendedResponse(ExtendedResponse),
|
|
|
|
ExtendedResponse(ExtendedResponse),
|
|
|
|
IntermediateResponse(IntermediateResponse),
|
|
|
|
IntermediateResponse(IntermediateResponse),
|
|
|
|
Unknown,
|
|
|
|
AbandonRequest(AbandonRequest),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl Display for ProtocolOp {
|
|
|
|
impl Display for ProtocolOp {
|
|
|
|
@ -320,10 +325,10 @@ impl Display for ProtocolOp {
|
|
|
|
ProtocolOp::ModDnResponse(_) => write!(f, "mod_dn_response"),
|
|
|
|
ProtocolOp::ModDnResponse(_) => write!(f, "mod_dn_response"),
|
|
|
|
ProtocolOp::CompareRequest(_) => write!(f, "compare_request"),
|
|
|
|
ProtocolOp::CompareRequest(_) => write!(f, "compare_request"),
|
|
|
|
ProtocolOp::CompareResponse(_) => write!(f, "compare_response"),
|
|
|
|
ProtocolOp::CompareResponse(_) => write!(f, "compare_response"),
|
|
|
|
|
|
|
|
ProtocolOp::AbandonRequest(_) => write!(f, "abandon_request"),
|
|
|
|
ProtocolOp::ExtendedRequest(_) => write!(f, "extended_request"),
|
|
|
|
ProtocolOp::ExtendedRequest(_) => write!(f, "extended_request"),
|
|
|
|
ProtocolOp::ExtendedResponse(_) => write!(f, "extended_response"),
|
|
|
|
ProtocolOp::ExtendedResponse(_) => write!(f, "extended_response"),
|
|
|
|
ProtocolOp::IntermediateResponse(_) => write!(f, "intermediate_response"),
|
|
|
|
ProtocolOp::IntermediateResponse(_) => write!(f, "intermediate_response"),
|
|
|
|
ProtocolOp::Unknown => write!(f, "unknown"),
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -376,7 +381,7 @@ impl From<ldap_parser::ldap::LdapMessage<'_>> for LdapMessage {
|
|
|
|
ldap_parser::ldap::ProtocolOp::IntermediateResponse(msg) => {
|
|
|
|
ldap_parser::ldap::ProtocolOp::IntermediateResponse(msg) => {
|
|
|
|
Self::from_intermediate_response(msg)
|
|
|
|
Self::from_intermediate_response(msg)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ldap_parser::ldap::ProtocolOp::AbandonRequest(_) => ProtocolOp::Unknown,
|
|
|
|
ldap_parser::ldap::ProtocolOp::AbandonRequest(msg) => Self::from_abandon_request(msg),
|
|
|
|
};
|
|
|
|
};
|
|
|
|
let controls = ldap_msg.controls.map(|ctls| {
|
|
|
|
let controls = ldap_msg.controls.map(|ctls| {
|
|
|
|
ctls.iter()
|
|
|
|
ctls.iter()
|
|
|
|
@ -397,13 +402,6 @@ impl From<ldap_parser::ldap::LdapMessage<'_>> for LdapMessage {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl LdapMessage {
|
|
|
|
impl LdapMessage {
|
|
|
|
pub fn is_unknown(&self) -> bool {
|
|
|
|
|
|
|
|
match self.protocol_op {
|
|
|
|
|
|
|
|
ProtocolOp::Unknown => return true,
|
|
|
|
|
|
|
|
_ => return false,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn is_request(&self) -> bool {
|
|
|
|
pub fn is_request(&self) -> bool {
|
|
|
|
match self.protocol_op {
|
|
|
|
match self.protocol_op {
|
|
|
|
ProtocolOp::BindRequest(_)
|
|
|
|
ProtocolOp::BindRequest(_)
|
|
|
|
@ -414,7 +412,7 @@ impl LdapMessage {
|
|
|
|
| ProtocolOp::DelRequest(_)
|
|
|
|
| ProtocolOp::DelRequest(_)
|
|
|
|
| ProtocolOp::ModDnRequest(_)
|
|
|
|
| ProtocolOp::ModDnRequest(_)
|
|
|
|
| ProtocolOp::CompareRequest(_)
|
|
|
|
| ProtocolOp::CompareRequest(_)
|
|
|
|
| ProtocolOp::Unknown // AbandonRequest
|
|
|
|
| ProtocolOp::AbandonRequest(_)
|
|
|
|
| ProtocolOp::ExtendedRequest(_) => {
|
|
|
|
| ProtocolOp::ExtendedRequest(_) => {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -589,6 +587,10 @@ impl LdapMessage {
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn from_abandon_request(msg: ldap_parser::ldap::MessageID) -> ProtocolOp {
|
|
|
|
|
|
|
|
ProtocolOp::AbandonRequest(AbandonRequest {message_id: msg.0})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn from_extended_request(msg: ldap_parser::ldap::ExtendedRequest) -> ProtocolOp {
|
|
|
|
fn from_extended_request(msg: ldap_parser::ldap::ExtendedRequest) -> ProtocolOp {
|
|
|
|
ProtocolOp::ExtendedRequest(ExtendedRequest {
|
|
|
|
ProtocolOp::ExtendedRequest(ExtendedRequest {
|
|
|
|
request_name: LdapOID(msg.request_name.0.to_string()),
|
|
|
|
request_name: LdapOID(msg.request_name.0.to_string()),
|
|
|
|
|