annotate .svn/pristine/25/25e20e75adcb2337c7b7589449cc334604a57456.svn-base @ 1524:82fac3dcf466 redmine-2.5-integration

Fix failure to interpret Javascript when autocompleting members for project
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 11 Sep 2014 10:24:38 +0100
parents cbb26bc654de
children
rev   line source
Chris@909 1 # $Id: psw.rb 73 2006-04-24 21:59:35Z blackhedd $
Chris@909 2 #
Chris@909 3 #
Chris@909 4 #----------------------------------------------------------------------------
Chris@909 5 #
Chris@909 6 # Copyright (C) 2006 by Francis Cianfrocca. All Rights Reserved.
Chris@909 7 #
Chris@909 8 # Gmail: garbagecat10
Chris@909 9 #
Chris@909 10 # This program is free software; you can redistribute it and/or modify
Chris@909 11 # it under the terms of the GNU General Public License as published by
Chris@909 12 # the Free Software Foundation; either version 2 of the License, or
Chris@909 13 # (at your option) any later version.
Chris@909 14 #
Chris@909 15 # This program is distributed in the hope that it will be useful,
Chris@909 16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
Chris@909 17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@909 18 # GNU General Public License for more details.
Chris@909 19 #
Chris@909 20 # You should have received a copy of the GNU General Public License
Chris@909 21 # along with this program; if not, write to the Free Software
Chris@909 22 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Chris@909 23 #
Chris@909 24 #---------------------------------------------------------------------------
Chris@909 25 #
Chris@909 26 #
Chris@909 27
Chris@909 28
Chris@909 29 module Net
Chris@909 30 class LDAP
Chris@909 31
Chris@909 32
Chris@909 33 class Password
Chris@909 34 class << self
Chris@909 35
Chris@909 36 # Generate a password-hash suitable for inclusion in an LDAP attribute.
Chris@909 37 # Pass a hash type (currently supported: :md5 and :sha) and a plaintext
Chris@909 38 # password. This function will return a hashed representation.
Chris@909 39 # STUB: This is here to fulfill the requirements of an RFC, which one?
Chris@909 40 # TODO, gotta do salted-sha and (maybe) salted-md5.
Chris@909 41 # Should we provide sha1 as a synonym for sha1? I vote no because then
Chris@909 42 # should you also provide ssha1 for symmetry?
Chris@909 43 def generate( type, str )
Chris@909 44 case type
Chris@909 45 when :md5
Chris@909 46 require 'md5'
Chris@909 47 "{MD5}#{ [MD5.new( str.to_s ).digest].pack("m").chomp }"
Chris@909 48 when :sha
Chris@909 49 require 'sha1'
Chris@909 50 "{SHA}#{ [SHA1.new( str.to_s ).digest].pack("m").chomp }"
Chris@909 51 # when ssha
Chris@909 52 else
Chris@909 53 raise Net::LDAP::LdapError.new( "unsupported password-hash type (#{type})" )
Chris@909 54 end
Chris@909 55 end
Chris@909 56
Chris@909 57 end
Chris@909 58 end
Chris@909 59
Chris@909 60
Chris@909 61 end # class LDAP
Chris@909 62 end # module Net
Chris@909 63
Chris@909 64