Signed-off-by: Luke Kanies <[EMAIL PROTECTED]>
---
CHANGELOG | 2 ++
lib/puppet/util/ldap/connection.rb | 12 +++++++++++-
spec/unit/util/ldap/connection.rb | 13 +++++++++++++
3 files changed, 26 insertions(+), 1 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 441e68e..1c167a4 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,6 @@
0.24.x
+ Fixed #1521 -- ldap user and password are now used with the default
connection.
+
Fixed issues with file descriptors leaking into subprocesses
Fixed #1568 - createpackage.sh
diff --git a/lib/puppet/util/ldap/connection.rb
b/lib/puppet/util/ldap/connection.rb
index f6530f8..70fe303 100644
--- a/lib/puppet/util/ldap/connection.rb
+++ b/lib/puppet/util/ldap/connection.rb
@@ -17,7 +17,17 @@ class Puppet::Util::Ldap::Connection
else
false
end
- new(Puppet[:ldapserver], Puppet[:ldapport], :ssl => ssl)
+
+ options = {}
+ options[:ssl] = ssl
+ if user = Puppet.settings[:ldapuser] and user != ""
+ options[:user] = user
+ if pass = Puppet.settings[:ldappassword] and pass != ""
+ options[:password] = pass
+ end
+ end
+
+ new(Puppet[:ldapserver], Puppet[:ldapport], options)
end
def close
diff --git a/spec/unit/util/ldap/connection.rb
b/spec/unit/util/ldap/connection.rb
index 9392466..8bc85a6 100755
--- a/spec/unit/util/ldap/connection.rb
+++ b/spec/unit/util/ldap/connection.rb
@@ -152,5 +152,18 @@ describe Puppet::Util::Ldap::Connection do
Puppet::Util::Ldap::Connection.expects(:new).with { |host, port,
options| options[:ssl] == false }
Puppet::Util::Ldap::Connection.instance
end
+
+ it "should set the ldapuser if one is set" do
+ Puppet.settings.expects(:value).with(:ldapuser).returns "foo"
+ Puppet::Util::Ldap::Connection.expects(:new).with { |host, port,
options| options[:user] == "foo" }
+ Puppet::Util::Ldap::Connection.instance
+ end
+
+ it "should set the ldapuser and ldappassword if both is set" do
+ Puppet.settings.expects(:value).with(:ldapuser).returns "foo"
+ Puppet.settings.expects(:value).with(:ldappassword).returns "bar"
+ Puppet::Util::Ldap::Connection.expects(:new).with { |host, port,
options| options[:user] == "foo" and options[:password] == "bar" }
+ Puppet::Util::Ldap::Connection.instance
+ end
end
end
--
1.5.3.7
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---