pub struct Operation { /* private fields */ }Expand description
One encoded protocol operation, waiting for a message id.
No Debug. A simple_bind operation’s bytes contain the password in
the clear — that is what a simple bind is — and a struct that can be
printed is a struct that eventually gets printed into a log.
Implementations§
Source§impl Operation
impl Operation
Sourcepub fn simple_bind(dn: &str, password: &str) -> Result<Operation>
pub fn simple_bind(dn: &str, password: &str) -> Result<Operation>
A simple bind: a DN and a password, both in the clear.
§An empty password is an anonymous bind
RFC 4511 §4.2 is explicit: a simple bind with a zero-length password is
an unauthenticated bind, and a directory answers it with success. So
a login form whose password field was left empty, passed straight
through, comes back as “authenticated” — for any username that exists.
This has been a real vulnerability in real products more than once.
So it is refused here, at the point the bytes are built, rather than
anywhere it could be skipped. A caller that genuinely wants an anonymous
bind asks for one by name with Operation::anonymous_bind.
Sourcepub fn anonymous_bind() -> Operation
pub fn anonymous_bind() -> Operation
An anonymous bind: no name, no password, no authentication.
A legitimate operation — many directories allow an anonymous search — and spelled out here so that it can never be reached by accident.
pub fn search(request: &SearchRequest) -> Operation
Sourcepub fn unbind() -> Operation
pub fn unbind() -> Operation
UnbindRequest ::= [APPLICATION 2] NULL. There is no unbind response:
it means “I am closing this connection”, not “please reply”.