From 4670adaf20d9f964f6b23d74c975a0404c54ebeb Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Tue, 28 Nov 2006 13:15:35 +0000 Subject: Allow anon access to ldap git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@246 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- site-ruby/myldap.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/site-ruby/myldap.rb b/site-ruby/myldap.rb index 7705029..b536e01 100644 --- a/site-ruby/myldap.rb +++ b/site-ruby/myldap.rb @@ -9,8 +9,12 @@ class MyLDAP @conn = LDAP::Conn.new(config['ldapserver'], config['ldapport']) @basedn = config['basedn'] if use - @binddn = config['credentials'][use]['binddn'] - @bindpw = config['credentials'][use]['bindpw'] + unless config['credentials'][use]['anon'] + @binddn = config['credentials'][use]['binddn'] + @bindpw = config['credentials'][use]['bindpw'] + else + throw "No credentials for #{use} found." + end elsif File.exists? File.expand_path('~/.noreply.ldap') myconfig = YAML::load( File.open( File.expand_path('~/.noreply.ldap') ) ) @binddn = myconfig['binddn'] -- cgit v1.2.3