inejge / ldap3

A pure-Rust LDAP library using the Tokio stack
Apache License 2.0
226 stars 39 forks source link

[Feat Req] Testing the connection state #67

Closed Geobert closed 3 years ago

Geobert commented 3 years ago

Hi,

When using ldap3 with a pool manager (like deadpool), we need a way to check that the connection is still valid. At the moment, I'm doing a simple_bind to test the connection but it feels overkill as if the connection is still valid, then an operation is done on the LDAP server.

Is there a way to test the connection without sending any operation through? If not, would it be something to consider adding?

inejge commented 3 years ago

Doing a Bind wouldn't be my choice, since it forces operation serialization in the server and is a security state barrier; if you need to check round-trip usability, you can issue a WhoAmI exop (see how it's done in r2d2-ldap).

Generally, the state of a connection can mean different things: is the socket open?, is the connection usable, for some definition of usable? etc.