diff options
author | Peter Palfrader <peter@palfrader.org> | 2006-10-22 20:24:47 +0000 |
---|---|---|
committer | weasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede> | 2006-10-22 20:24:47 +0000 |
commit | 37dda6dba59b63c888791ca1821ce8729463f91d (patch) | |
tree | 4bcdc19d29c829b9338079655a4378c679d339f5 /site-ruby/myldap.rb | |
parent | b29173600baf6dfaa1bf914ce6b3302b94ffdc0b (diff) |
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
Diffstat (limited to 'site-ruby/myldap.rb')
-rw-r--r-- | site-ruby/myldap.rb | 16 |
1 files changed, 13 insertions, 3 deletions
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| |