Parent

Class Index [+]

Quicksearch

ActiveSambaLdap::Configuration::ClassMethods::Private

Constants

VARIABLES
(Not documented)
AVAILABLE_HASH_TYPES
(Not documented)

Public Class Methods

compute_required_variables() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 111
          def compute_required_variables
            not_required_variables = %w(base scope ldap_scope)
            (VARIABLES - public_methods - not_required_variables).collect do |x|
              x.to_sym
            end
          end
new(target) click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 119
        def initialize(target)
          @target = target.symbolize_keys
        end
required_variables() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 107
          def required_variables
            @required_variables ||= compute_required_variables
          end

Public Instance Methods

[](name) click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 142
        def [](name)
          @target[name.to_sym] || (respond_to?(name) ? send(name) : nil)
        end
allow_anonymous() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 202
        def allow_anonymous
          false
        end
bind_dn() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 311
        def bind_dn
          nil
        end
computers_suffix() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 230
        def computers_suffix
          suffix = retrieve_value_from_smb_conf(/ldap\s+machine\s+suffix/i)
          return suffix if suffix
          if self[:samba4]
            "cn=Computers"
          else
            "ou=Computers"
          end
        end
default_computer_gid() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 257
        def default_computer_gid
          rid = ActiveSambaLdap::Group::DOMAIN_COMPUTERS_RID
          ActiveSambaLdap::Group.rid2gid(rid)
        end
default_user_gid() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 252
        def default_user_gid
          rid = ActiveSambaLdap::Group::DOMAIN_USERS_RID
          ActiveSambaLdap::Group.rid2gid(rid)
        end
groups_suffix() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 220
        def groups_suffix
          suffix = retrieve_value_from_smb_conf(/ldap\s+group\s+suffix/i)
          return suffix if suffix
          if self[:samba4]
            "cn=Users"
          else
            "ou=Groups"
          end
        end
host() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 194
        def host
          "localhost"
        end
idmap_suffix() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 240
        def idmap_suffix
          retrieve_value_from_smb_conf(/ldap\s+idmap\s+suffix/i) || "ou=Idmap"
        end
merge() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 123
        def merge
          result = @target.dup
          VARIABLES.each do |variable|
            key = variable.to_sym
            result[key] ||= send(variable) if respond_to?(variable)

            normalize_method = "normalize_#{variable}"
            if respond_to?(normalize_method)
              result[key] = __send__(normalize_method, result[key])
            end

            validate_method = "validate_#{variable}"
            if respond_to?(validate_method)
              __send__(validate_method, result[key])
            end
          end
          result
        end
method() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 206
        def method
          :plain
        end
normalize_password_hash_type(type) click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 319
        def normalize_password_hash_type(type)
          type.to_s.downcase.to_sym
        end
normalize_user_home_directory_mode(mode) click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 284
        def normalize_user_home_directory_mode(mode)
          if mode
            Integer(mode)
          else
            nil
          end
        rescue ArgumentError
          raise InvalidConfigurationValueError.new("user_home_directory",
                                                   mode, $!.message)
        end
password_hash_type() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 315
        def password_hash_type
          :ssha
        end
port() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 198
        def port
          389
        end
samba4() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 323
        def samba4
          smb_conf = self[:smb_conf]
          if smb_conf and /^\s*server\s*role\s*=/ =~ File.read(smb_conf)
            true
          else
            false
          end
        end
samba_domain() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 162
        def samba_domain
          _smb_conf = self["smb_conf"]
          if _smb_conf
            File.open(_smb_conf) do |f|
              f.read.grep(/^\s*[^#;]/).each do |line|
                if /^\s*workgroup\s*=\s*(\S+)\s*$/i =~ line
                  return $1.upcase
                end
              end
            end
          else
            nil
          end
        end
samba_netbios_name() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 177
        def samba_netbios_name
          netbios_name = nil
          _smb_conf = self["smb_conf"]
          if _smb_conf
            File.open(_smb_conf) do |f|
              f.read.grep(/^\s*[^#;]/).each do |line|
                if /^\s*netbios\s*name\s*=\s*(.+)\s*$/i =~ line
                  netbios_name = $1
                  break
                end
              end
            end
          end
          netbios_name ||= Socket.gethostname
          netbios_name ? netbios_name.upcase : nil
        end
sid() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 146
        def sid
          result = `net getlocalsid`
          if $?.success?
            result.chomp.gsub(/\G[^:]+:\s*/, '')
          else
            nil
          end
        end
skeleton_directory() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 262
        def skeleton_directory
          "/etc/skel"
        end
smb_conf() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 155
        def smb_conf
          %w(/etc/samba/smb.conf /usr/local/etc/samba/smb.conf).each do |guess|
            return guess if File.exist?(guess)
          end
          nil
        end
start_gid() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 248
        def start_gid
          10000
        end
start_uid() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 244
        def start_uid
          10000
        end
user_gecos() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 307
        def user_gecos
          nil
        end
user_home_directory() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 276
        def user_home_directory
          "/home/%U"
        end
user_home_directory_mode() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 280
        def user_home_directory_mode
          0755
        end
user_home_drive() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 299
        def user_home_drive
          "H:"
        end
user_home_unc() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 266
        def user_home_unc
          netbios_name = self["samba_netbios_name"]
          netbios_name ? "\\\\#{netbios_name}\\%U" : nil
        end
user_login_shell() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 295
        def user_login_shell
          "/bin/false"
        end
user_logon_script() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 303
        def user_logon_script
          "logon.bat"
        end
user_profile() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 271
        def user_profile
          netbios_name = self["samba_netbios_name"]
          netbios_name ? "\\\\#{netbios_name}\\profiles\\%U" : nil
        end
users_suffix() click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 210
        def users_suffix
          suffix = retrieve_value_from_smb_conf(/ldap\s+user\s+suffix/i)
          return suffix if suffix
          if self[:samba4]
            "cn=Users"
          else
            "ou=Users"
          end
        end
validate_password_hash_type(type) click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 333
        def validate_password_hash_type(type)
          unless AVAILABLE_HASH_TYPES.include?(type)
            types = AVAILABLE_HASH_TYPES.collect {|x| x.inspect}.join(", ")
            raise InvalidConfigurationValueError.new("password_hash_type",
                                                     type,
                                                     _("must be in %s") % types)
          end
        end

Private Instance Methods

retrieve_value_from_smb_conf(key) click to toggle source

(Not documented)

# File lib/active_samba_ldap/configuration.rb, line 343
        def retrieve_value_from_smb_conf(key)
          smb_conf = self['smb_conf']
          if smb_conf and File.readable?(smb_conf)
            line = File.read(smb_conf).grep(key).reject do |l|
              /^\s*[#;]/ =~ l
            end.first
            if line
              line.split(/=/, 2)[1].strip
            else
              nil
            end
          else
            nil
          end
        end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.