Making Net::LDAP Play Nice

Posted by kev Tue, 27 Feb 2007 02:03:00 GMT

I wish I had a tumblog. Until one of the canned solutions gets syntax highlighting, I’ll have to fake it.

# Wraps Net::LDAP#bind_as for our settings
kevin = Powerset::LDAP.authenticate('kevin', '*****')
# => #<Net::LDAP::Entry:0x32077d8 @myhash={:cn=>["Kevin Clark"]}>
kevin[:cn] # => ["Kevin Clark"]
kevin[:cn].first.class # => String

# Looks fine, right?
Marshal::dump kevin[:cn].first # => TypeError: singleton can't be dumped

# This breaks Rails sessions, among other things. Until it's fixed:
Marshal::dump "#{kevin[:cn].first}" # => "\004\b\"\020Kevin Clark"

# Watch: http://rubyurl.com/njz

Posted in  | 1 comment

Comments

  1. Avatar Ben Askins said about 18 hours later:

    You can implement syntax highlighting on tumblr using Dan Webb’s CodeHighlighter. Take a look at subrosa.teamaskins.net – this is hosted at tumblr and uses CodeHighlighter for syntax highlighting.

Comments are disabled