Class: DBus::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/dbus/auth.rb

Overview

Authentication client class.

Class tha performs the actional authentication.

Instance Method Summary collapse

Constructor Details

#initialize(socket) ⇒ Client

Create a new authentication client.



122
123
124
125
126
# File 'lib/dbus/auth.rb', line 122

def initialize(socket)
  @socket = socket
  @state = nil
  @auth_list = [External, DBusCookieSHA1, Anonymous]
end

Instance Method Details

#authenticateObject

Start the authentication process.



129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/dbus/auth.rb', line 129

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