forked from dequbed/rust-ldap
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge support for opening a connection from existing streams
- Loading branch information
Showing
4 changed files
with
94 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Demonstrates synchronously connecting, binding to, | ||
// and disconnecting from the exiting tcp stream. | ||
|
||
use std::net::TcpStream; | ||
|
||
use ldap3::result::Result; | ||
use ldap3::{LdapConn, LdapConnSettings, StdStream}; | ||
|
||
fn main() -> Result<()> { | ||
let stream = TcpStream::connect("localhost:2389")?; | ||
let settings = LdapConnSettings::new().set_std_stream(StdStream::Tcp(stream)); | ||
let mut ldap = LdapConn::with_settings(settings, "ldap://localhost:2389")?; | ||
let _res = ldap | ||
.simple_bind("cn=Manager,dc=example,dc=org", "secret")? | ||
.success()?; | ||
Ok(ldap.unbind()?) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters