WHY IS IT NOT WORKING

This commit is contained in:
selfhoster selfhoster 2026-09-03 20:31:28 +02:00
commit 1626fb0624
5 changed files with 27 additions and 10 deletions

View file

@ -2,9 +2,30 @@ use ldap3_proto::LdapMsg;
use ldap3_proto::proto::LdapOp;
use crate::db::{Database, DatabaseInterface};
use crate::error::GlobalError;
use crate::ldap::{
LdapClientState, LdapStream, LdapStreamError, op_bind, op_ext, search_by_mail_filter,
};
use crate::listener::Listener;
pub async fn ldap_listen<D: DatabaseInterface>(listener: Listener, db: Database<D>) {
// If the connection is None, it's because the client aborted early
// so there's nothing to do about it.
loop {
match listener.accept_ldap().await {
Ok(Some(stream)) => {
let db = db.clone();
tokio::spawn(ldap_handler(stream, db));
}
Ok(None) => {
panic!("LDAP listener closed");
}
Err(e) => {
panic!("Failed to listen on LDAP listener");
}
}
}
}
#[tracing::instrument(name = "ldap", skip(stream, db), fields(session = %stream.session))]
pub async fn ldap_handler<D: DatabaseInterface>(mut stream: LdapStream, mut db: Database<D>) {