File: ssl-errmsg.patch

package info (click to toggle)
shelldap 0.2-1%2Bsqueeze1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 104 kB
  • ctags: 41
  • sloc: perl: 946; makefile: 4
file content (30 lines) | stat: -rw-r--r-- 1,128 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Description: Exit with a nicer error message if IO::Socket::SSL isn't
 installed, but the user is requesting SSL/TLS. (this is normally
 required by Net::LDAP.)
Origin: vendor, http://projects.martini.nu/shelldap/attachment/ticket/8/ssl-errmsg.patch
Bug: http://projects.martini.nu/shelldap/ticket/8
Bug-Debian: http://bugs.debian.org/614350
Forwarded: no
Author: Mahlon E. Smith <mahlon@martini.nu>
Reviewed-by: Salvatore Bonaccorso <carnil@debian.org>
Last-Update: 2011-09-17

--- a/shelldap
+++ b/shelldap
@@ -425,6 +425,16 @@
 	
 	# fill in potentially missing info
 	die "No server specified.\n" unless $conf->{'server'};
+
+	# Emit a nicer error message if IO::Socket::SSL is
+	# not installed and Net::LDAP decides it is required.
+	#
+	if ( $conf->{'tls'} || $conf->{'server'} =~ m|ldaps://| ) {
+		eval { require IO::Socket::SSL; };
+		die qq{IO::Socket::SSL not installed, but is required for SSL or TLS connections.
+You may try connecting insecurely, or install the module and try again.\n} if $@;
+	}
+
 	if ( $conf->{'binddn'} && ! $conf->{'bindpass'} ) {
 		print "Bind password: ";
 		Term::ReadKey::ReadMode 2;