diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 9d11187..a69eae1 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -8,13 +8,13 @@ "Deps": [ { "ImportPath": "github.com/godbus/dbus", - "Comment": "v3-15-g230e4b2", - "Rev": "230e4b23db2fd81c53eaa0073f76659d4849ce51" + "Comment": "v4.0.0-5-g32c6cc2", + "Rev": "32c6cc29c14570de4cf6d7e7737d68fb2d01ad15" }, { "ImportPath": "github.com/godbus/dbus/introspect", - "Comment": "v3-15-g230e4b2", - "Rev": "230e4b23db2fd81c53eaa0073f76659d4849ce51" + "Comment": "v4.0.0-5-g32c6cc2", + "Rev": "32c6cc29c14570de4cf6d7e7737d68fb2d01ad15" }, { "ImportPath": "github.com/gotk3/gotk3/cairo", diff --git a/vendor/github.com/godbus/dbus/conn.go b/vendor/github.com/godbus/dbus/conn.go index 62bcbed..e07753a 100644 --- a/vendor/github.com/godbus/dbus/conn.go +++ b/vendor/github.com/godbus/dbus/conn.go @@ -16,6 +16,7 @@ var ( systemBusLck sync.Mutex sessionBus *Conn sessionBusLck sync.Mutex + sessionEnvLck sync.Mutex ) // ErrClosed is the error returned by calls on a closed connection. @@ -53,8 +54,9 @@ type Conn struct { closed bool outLck sync.RWMutex - signals []chan<- *Signal - signalsLck sync.Mutex + signals []chan<- *Signal + signalsClosed bool + signalsLck sync.Mutex eavesdropped chan<- *Message eavesdroppedLck sync.Mutex @@ -91,6 +93,8 @@ func SessionBus() (conn *Conn, err error) { // SessionBusPrivate returns a new private connection to the session bus. func SessionBusPrivate() (*Conn, error) { + sessionEnvLck.Lock() + defer sessionEnvLck.Unlock() address := os.Getenv("DBUS_SESSION_BUS_ADDRESS") if address != "" && address != "autolaunch:" { return Dial(address) @@ -186,6 +190,7 @@ func (conn *Conn) Close() error { conn.closed = true conn.outLck.Unlock() conn.signalsLck.Lock() + conn.signalsClosed = true for _, ch := range conn.signals { close(ch) } @@ -338,6 +343,10 @@ func (conn *Conn) inWorker() { Body: msg.Body, } conn.signalsLck.Lock() + if conn.signalsClosed { + conn.signalsLck.Unlock() + return + } for _, ch := range conn.signals { ch <- signal } @@ -621,16 +630,11 @@ func dereferenceAll(vs []interface{}) []interface{} { // getKey gets a key from a the list of keys. Returns "" on error / not found... func getKey(s, key string) string { - i := strings.Index(s, key) - if i == -1 { - return "" - } - if i+len(key)+1 >= len(s) || s[i+len(key)] != '=' { - return "" - } - j := strings.Index(s, ",") - if j == -1 { - j = len(s) + for _, keyEqualsValue := range strings.Split(s, ",") { + keyValue := strings.SplitN(keyEqualsValue, "=", 2) + if len(keyValue) == 2 && keyValue[0] == key { + return keyValue[1] + } } - return s[i+len(key)+1 : j] + return "" } diff --git a/vendor/github.com/godbus/dbus/conn_other.go b/vendor/github.com/godbus/dbus/conn_other.go index f74b875..289e8c5 100644 --- a/vendor/github.com/godbus/dbus/conn_other.go +++ b/vendor/github.com/godbus/dbus/conn_other.go @@ -5,6 +5,7 @@ package dbus import ( "bytes" "errors" + "os" "os/exec" ) @@ -23,5 +24,8 @@ func sessionBusPlatform() (*Conn, error) { return nil, errors.New("dbus: couldn't determine address of session bus") } - return Dial(string(b[i+1 : j])) + env, addr := string(b[0:i]), string(b[i+1:j]) + os.Setenv(env, addr) + + return Dial(addr) } diff --git a/vendor/github.com/godbus/dbus/export.go b/vendor/github.com/godbus/dbus/export.go index c0d37b1..6c33522 100644 --- a/vendor/github.com/godbus/dbus/export.go +++ b/vendor/github.com/godbus/dbus/export.go @@ -1,6 +1,7 @@ package dbus import ( + "bytes" "errors" "fmt" "reflect" @@ -126,6 +127,28 @@ func (conn *Conn) handleCall(msg *Message) { conn.sendError(errmsgUnknownMethod, sender, serial) } return + } else if ifaceName == "org.freedesktop.DBus.Introspectable" && name == "Introspect" { + if _, ok := conn.handlers[path]; !ok { + subpath := make(map[string]struct{}) + var xml bytes.Buffer + xml.WriteString("") + for h, _ := range conn.handlers { + p := string(path) + if p != "/" { + p += "/" + } + if strings.HasPrefix(string(h), p) { + node_name := strings.Split(string(h[len(p):]), "/")[0] + subpath[node_name] = struct{}{} + } + } + for s, _ := range subpath { + xml.WriteString("\n\t") + } + xml.WriteString("\n") + conn.sendReply(sender, serial, xml.String()) + return + } } if len(name) == 0 { conn.sendError(errmsgUnknownMethod, sender, serial) diff --git a/vendor/github.com/godbus/dbus/message.go b/vendor/github.com/godbus/dbus/message.go index 075d6e3..6a92536 100644 --- a/vendor/github.com/godbus/dbus/message.go +++ b/vendor/github.com/godbus/dbus/message.go @@ -22,6 +22,13 @@ const ( // FlagNoAutoStart signals that the message bus should not automatically // start an application when handling this message. FlagNoAutoStart + // FlagAllowInteractiveAuthorization may be set on a method call + // message to inform the receiving side that the caller is prepared + // to wait for interactive authorization, which might take a + // considerable time to complete. For instance, if this flag is set, + // it would be appropriate to query the user for passwords or + // confirmation via Polkit or a similar framework. + FlagAllowInteractiveAuthorization ) // Type represents the possible types of a D-Bus message. @@ -248,7 +255,7 @@ func (msg *Message) EncodeTo(out io.Writer, order binary.ByteOrder) error { // IsValid checks whether msg is a valid message and returns an // InvalidMessageError if it is not. func (msg *Message) IsValid() error { - if msg.Flags & ^(FlagNoAutoStart|FlagNoReplyExpected) != 0 { + if msg.Flags & ^(FlagNoAutoStart|FlagNoReplyExpected|FlagAllowInteractiveAuthorization) != 0 { return InvalidMessageError("invalid flags") } if msg.Type == 0 || msg.Type >= typeMax { diff --git a/vendor/github.com/godbus/dbus/transport_tcp.go b/vendor/github.com/godbus/dbus/transport_tcp.go new file mode 100644 index 0000000..dd1c8e5 --- /dev/null +++ b/vendor/github.com/godbus/dbus/transport_tcp.go @@ -0,0 +1,43 @@ +//+build !windows + +package dbus + +import ( + "errors" + "net" +) + +func init() { + transports["tcp"] = newTcpTransport +} + +func tcpFamily(keys string) (string, error) { + switch getKey(keys, "family") { + case "": + return "tcp", nil + case "ipv4": + return "tcp4", nil + case "ipv6": + return "tcp6", nil + default: + return "", errors.New("dbus: invalid tcp family (must be ipv4 or ipv6)") + } +} + +func newTcpTransport(keys string) (transport, error) { + host := getKey(keys, "host") + port := getKey(keys, "port") + if host == "" || port == "" { + return nil, errors.New("dbus: unsupported address (must set host and port)") + } + + protocol, err := tcpFamily(keys) + if err != nil { + return nil, err + } + socket, err := net.Dial(protocol, net.JoinHostPort(host, port)) + if err != nil { + return nil, err + } + return NewConn(socket) +} diff --git a/vendor/github.com/godbus/dbus/transport_unixcred_openbsd.go b/vendor/github.com/godbus/dbus/transport_unixcred_openbsd.go new file mode 100644 index 0000000..af7bafd --- /dev/null +++ b/vendor/github.com/godbus/dbus/transport_unixcred_openbsd.go @@ -0,0 +1,14 @@ +package dbus + +import "io" + +func (t *unixTransport) SendNullByte() error { + n, _, err := t.UnixConn.WriteMsgUnix([]byte{0}, nil, nil) + if err != nil { + return err + } + if n != 1 { + return io.ErrShortWrite + } + return nil +}