class DBus::Client

Authentication client class.

Class tha performs the actional authentication.

Public Class Methods

new(socket) click to toggle source

Create a new authentication client.

# File lib/dbus/auth.rb, line 119
def initialize(socket)
  @socket = socket
  @state = nil
  @auth_list = [External, DBusCookieSHA1, Anonymous]
end

Public Instance Methods

authenticate() click to toggle source

Start the authentication process.

# File lib/dbus/auth.rb, line 126
def authenticate
  if RbConfig::CONFIG["target_os"] =~ /freebsd/
    @socket.sendmsg(0.chr, 0, nil, [:SOCKET, :SCM_CREDS, ""])
  else
    @socket.write(0.chr)
  end
  next_authenticator
  @state = :Starting
  while @state != :Authenticated
    r = next_state
    return r if !r
  end
  true
end