tls.setOption( TlsOptions::REQUIRE_CERT, TlsOptions::DEMAND );
std::cout << " CaCertfile: " << tls.getStringOption( TlsOptions::CACERTFILE ) << std::endl;
std::cout << " Require Cert: " << tls.getIntOption( TlsOptions::REQUIRE_CERT ) << std::endl;
-
+
try {
// 1. connect using global options
LDAPAsynConnection l(uri);
}
// 2. connect using connection specific option
- l = LDAPAsynConnection(uri);
- tls=l.getTlsOptions();
+ LDAPAsynConnection l1(uri);
+ tls=l1.getTlsOptions();
std::cout << "Current connection specific settings:" << std::endl;
std::cout << " CaCertfile: " << tls.getStringOption( TlsOptions::CACERTFILE) << std::endl;
std::cout << " CaCertDir: " << tls.getStringOption( TlsOptions::CACERTDIR ) << std::endl;
std::cout << " CaCertDir: " << tls.getStringOption( TlsOptions::CACERTDIR ) << std::endl;
std::cout << " Require Cert: " << tls.getIntOption( TlsOptions::REQUIRE_CERT ) << std::endl;
try {
- l.start_tls();
+ l1.start_tls();
std::cout << "StartTLS successful." << std::endl;
- l.unbind();
+ l1.unbind();
} catch ( LDAPException e ) {
std::cerr << e << std::endl;
}
-
+
// 3. and once again using the globals
try {
LDAPAsynConnection l2(uri);
} catch ( LDAPException e ) {
std::cerr << e << std::endl;
}
-}
+}