Sha256: cc24d8daf0581c54ab7b51195fed65fe4fc8fba5e911c1cd67a6aa8eb1b8e7a2
Contents?: true
Size: 1.73 KB
Versions: 1
Compression:
Stored size: 1.73 KB
Contents
require 'dl/import' require 'dl/struct' module Net; module SSH; module Kerberos; module Drivers # Some useful DL extensions. module DLDriver PTR_ENC = proc{|v| v && (DL::PtrData===v ? v : v.to_ptr) } PTR_REF_ENC = proc{|v| (v.nil? ? DL::PtrData.new(v) : (DL::PtrData===v ? v : v.to_ptr)).ref } module ClassMethods def PTR_DEC(t) proc{|v| v && t.new(v)} end def PTR_REF_DEC(t) proc{|v| v && v.ptr && t.new(v.ptr)} end def struct2(fields, &block) t = struct fields return t unless block_given? t.instance_variable_set :@methods, Module.new(&block) class << t alias :new_struct :new def new(ptr) mem = new_struct(ptr) mem.extend @methods mem end end t end end if RUBY_VERSION =~ /^1\.8/ def self.included(base) base.extend DL::Importable base.extend ClassMethods end else def self.included(base) base.extend DL::Importer base.extend ClassMethods end end end @@available = [] def self.available; @@available end if %w(win dar mingw).any?{|p| RUBY_PLATFORM.include?(p)}; then begin require 'net/ssh/kerberos/drivers/sspi'; available << 'SSPI' rescue => e raise e unless RuntimeError === e and e.message =~ /^LoadLibrary: ([^\s]+)/ $stderr.puts "error: While loading Kerberos SSPI: failed to load library: #{$1}" end end begin require 'net/ssh/kerberos/drivers/gss'; available << 'GSS' rescue => e; raise e if available.empty? end if available.empty? $stderr.puts "error: Failed to a find a supported GSS implementation on this platform (#{RUBY_PLATFORM})" end end end; end; end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
net-ssh-kerberos-0.2.4 | lib/net/ssh/kerberos/drivers.rb |