62: def start
63: begin
64: case ssl
65: when :tls
66: @connection = LDAP::SSLConn.new(host, port, true)
67: when true
68: @connection = LDAP::SSLConn.new(host, port)
69: else
70: @connection = LDAP::Conn.new(host, port)
71: end
72: @connection.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)
73: @connection.set_option(LDAP::LDAP_OPT_REFERRALS, LDAP::LDAP_OPT_ON)
74: @connection.simple_bind(user, password)
75: rescue => detail
76: raise Puppet::Error, "Could not connect to LDAP: %s" % detail
77: end
78: end