From 37dda6dba59b63c888791ca1821ce8729463f91d Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sun, 22 Oct 2006 20:24:47 +0000 Subject: print something that probably works as an ldif, some of the time git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@228 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- site-ruby/myldap.rb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'site-ruby') diff --git a/site-ruby/myldap.rb b/site-ruby/myldap.rb index 115d772..7705029 100644 --- a/site-ruby/myldap.rb +++ b/site-ruby/myldap.rb @@ -11,17 +11,27 @@ class MyLDAP if use @binddn = config['credentials'][use]['binddn'] @bindpw = config['credentials'][use]['bindpw'] - else + elsif File.exists? File.expand_path('~/.noreply.ldap') myconfig = YAML::load( File.open( File.expand_path('~/.noreply.ldap') ) ) @binddn = myconfig['binddn'] @bindpw = myconfig['bindpw'] end - unless @conn.bind(@binddn, @bindpw) - @conn.perror("bind") + if @binddn and @bindpw + unless @conn.bind(@binddn, @bindpw) + @conn.perror("bind") + end end end def add(dn, data) + puts "dn: #{dn}" + data.each_pair{ + |key, value| + value.each { |v| + puts "#{key}: #{v}" + } + } + puts begin entry = data.map{ |key, value| -- cgit v1.2.3