feat: Implement LdapStream, begin event loop
This commit is contained in:
parent
d30df04064
commit
1ef02c58dd
8 changed files with 152 additions and 56 deletions
37
src/ldap/handler.rs
Normal file
37
src/ldap/handler.rs
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
use ldap3_proto::LdapMsg;
|
||||
|
||||
use crate::ldap::{LdapStream, LdapStreamError};
|
||||
|
||||
#[tracing::instrument(name = "ldap", skip(s), fields(session = %s.session))]
|
||||
pub async fn ldap_handler(mut s: LdapStream) {
|
||||
tracing::info! {
|
||||
remote_addr = ?s.remote_addr,
|
||||
"New client connection"
|
||||
};
|
||||
|
||||
loop {
|
||||
match s.next().await {
|
||||
Ok(msg) => {
|
||||
if let Err(e) = ldap_handler_inner(msg).await {
|
||||
tracing::debug!(
|
||||
reason = ?e,
|
||||
"Failed to respond"
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
tracing::debug!(
|
||||
reason = ?e,
|
||||
"Closing connection"
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn ldap_handler_inner(msg: LdapMsg) -> Result<(), LdapStreamError> {
|
||||
tracing::debug!(msg = ?msg, "Received LDAP message");
|
||||
Ok(())
|
||||
}
|
||||
Loading…
Reference in a new issue