Rationalizing startup.
This commit is contained in:
parent
87a7cf1b6a
commit
31946c35c7
7 changed files with 66 additions and 139 deletions
|
@ -490,5 +490,3 @@ end # class Net::LDAP::FilterParser
|
|||
|
||||
end # class Net::LDAP
|
||||
end # module Net
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# $Id$
|
||||
#
|
||||
# LDAP PDU support classes
|
||||
#
|
||||
|
@ -24,12 +23,12 @@
|
|||
#
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
module Net
|
||||
require 'ostruct'
|
||||
|
||||
module Net
|
||||
class LdapPduError < StandardError; end
|
||||
|
||||
class LdapPdu
|
||||
|
||||
BindRequest = 0
|
||||
BindResult = 1
|
||||
UnbindRequest = 2
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
# $Id$
|
||||
#
|
||||
#
|
||||
#----------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (C) 2006 by Francis Cianfrocca. All Rights Reserved.
|
||||
|
@ -22,41 +19,39 @@
|
|||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
#---------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
|
||||
require 'digest/sha1'
|
||||
require 'digest/md5'
|
||||
|
||||
module Net
|
||||
class LDAP
|
||||
class Password
|
||||
class << self
|
||||
|
||||
# Generate a password-hash suitable for inclusion in an LDAP attribute.
|
||||
# Pass a hash type (currently supported: :md5 and :sha) and a plaintext
|
||||
# password. This function will return a hashed representation.
|
||||
# STUB: This is here to fulfill the requirements of an RFC, which one?
|
||||
# TODO, gotta do salted-sha and (maybe) salted-md5.
|
||||
# Should we provide sha1 as a synonym for sha1? I vote no because then
|
||||
# should you also provide ssha1 for symmetry?
|
||||
def generate( type, str )
|
||||
# Generate a password-hash suitable for inclusion in an LDAP
|
||||
# attribute. Pass a hash type (currently supported: :md5 and :sha)
|
||||
# and a plaintext password. This function will return a hashed
|
||||
# representation.
|
||||
#
|
||||
# STUB: This is here to fulfill the requirements of an RFC, which
|
||||
# one?
|
||||
#
|
||||
# TODO, gotta do salted-sha and (maybe) salted-md5.
|
||||
# Should we provide sha1 as a synonym for sha1? I vote no because
|
||||
# then should you also provide ssha1 for symmetry?
|
||||
def generate(type, str)
|
||||
digest, digest_name = case type
|
||||
when :md5
|
||||
[Digest::MD5.new, 'MD5']
|
||||
when :sha
|
||||
[Digest::SHA1.new, 'SHA']
|
||||
# when ssha
|
||||
else
|
||||
raise Net::LDAP::LdapError.new( "unsupported password-hash type (#{type})" )
|
||||
end
|
||||
|
||||
when :md5
|
||||
[Digest::MD5.new, 'MD5']
|
||||
when :sha
|
||||
[Digest::SHA1.new, 'SHA']
|
||||
else
|
||||
raise Net::LDAP::LdapError.new("unsupported password-hash type (#{type})")
|
||||
end
|
||||
|
||||
digest << str.to_s
|
||||
return "{#{digest_name}}#{[digest.digest].pack('m').chomp }"
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue