summaryrefslogtreecommitdiff
path: root/vendor/github.com/godbus/dbus/v5/export.go
diff options
context:
space:
mode:
authorAshley Cui <acui@redhat.com>2022-02-28 16:23:19 -0500
committerAshley Cui <acui@redhat.com>2022-02-28 16:23:26 -0500
commit569319d3970c2e94e4c6586d4bb17e5cfc108fdf (patch)
tree843f87290ef42f8eee7e9d5963fa916a3172e4ea /vendor/github.com/godbus/dbus/v5/export.go
parent2225c65f74b3358d810183558185a6344ef686ac (diff)
downloadpodman-569319d3970c2e94e4c6586d4bb17e5cfc108fdf.tar.gz
podman-569319d3970c2e94e4c6586d4bb17e5cfc108fdf.tar.bz2
podman-569319d3970c2e94e4c6586d4bb17e5cfc108fdf.zip
Vendor in containers/common@main
Signed-off-by: Ashley Cui <acui@redhat.com>
Diffstat (limited to 'vendor/github.com/godbus/dbus/v5/export.go')
-rw-r--r--vendor/github.com/godbus/dbus/v5/export.go19
1 files changed, 9 insertions, 10 deletions
diff --git a/vendor/github.com/godbus/dbus/v5/export.go b/vendor/github.com/godbus/dbus/v5/export.go
index 522334715..d3dd9f7cd 100644
--- a/vendor/github.com/godbus/dbus/v5/export.go
+++ b/vendor/github.com/godbus/dbus/v5/export.go
@@ -3,6 +3,7 @@ package dbus
import (
"errors"
"fmt"
+ "os"
"reflect"
"strings"
)
@@ -209,28 +210,23 @@ func (conn *Conn) handleCall(msg *Message) {
}
reply.Headers[FieldSignature] = MakeVariant(SignatureOf(reply.Body...))
- conn.sendMessageAndIfClosed(reply, nil)
+ if err := reply.IsValid(); err != nil {
+ fmt.Fprintf(os.Stderr, "dbus: dropping invalid reply to %s.%s on obj %s: %s\n", ifaceName, name, path, err)
+ } else {
+ conn.sendMessageAndIfClosed(reply, nil)
+ }
}
}
// Emit emits the given signal on the message bus. The name parameter must be
// formatted as "interface.member", e.g., "org.freedesktop.DBus.NameLost".
func (conn *Conn) Emit(path ObjectPath, name string, values ...interface{}) error {
- if !path.IsValid() {
- return errors.New("dbus: invalid object path")
- }
i := strings.LastIndex(name, ".")
if i == -1 {
return errors.New("dbus: invalid method name")
}
iface := name[:i]
member := name[i+1:]
- if !isValidMember(member) {
- return errors.New("dbus: invalid method name")
- }
- if !isValidInterface(iface) {
- return errors.New("dbus: invalid interface name")
- }
msg := new(Message)
msg.Type = TypeSignal
msg.Headers = make(map[HeaderField]Variant)
@@ -241,6 +237,9 @@ func (conn *Conn) Emit(path ObjectPath, name string, values ...interface{}) erro
if len(values) > 0 {
msg.Headers[FieldSignature] = MakeVariant(SignatureOf(values...))
}
+ if err := msg.IsValid(); err != nil {
+ return err
+ }
var closed bool
conn.sendMessageAndIfClosed(msg, func() {