+sub UpgradeConnection($) {
+ my ($ldap) = @_;
+ my $mesg = $ldap->start_tls(
+ verify => 'require',
+ capath => '/etc/ssl/certs/'
+ );
+ $mesg->sync;
+ if ($mesg->code != LDAP_SUCCESS) {
+ print "Content-type: text/html; charset=utf-8\n\n";
+ print "<html><body><h1>STARTTLS failed: "..$mesg->error."</h1></body></html>\n";
+ exit(1);
+ };
+};