[libnet-dbus-perl] 314/335: Fixes to encoding of dict and variant types
Intrigeri
intrigeri at moszumanska.debian.org
Sat Mar 21 01:08:14 UTC 2015
This is an automated email from the git hooks/post-receive script.
intrigeri pushed a commit to branch experimental
in repository libnet-dbus-perl.
commit eaff372dfeb87133c86e22985c14224b0c7b7b6f
Author: Daniel Collins <daniel.collins at smoothwall.net>
Date: Sun Apr 7 12:20:12 2013 +0100
Fixes to encoding of dict and variant types
The signature generated for a variant type includes the
type within the variant, which appears to be incorrect
and causes dbus_message_iter_open_container() to assert
when a variant is passed as the value of a dict entry.
Explicitly typing a hashref using dbus_dict() causes
Net::DBus::Binding::Iterator->guess_type() to attempt
to dereference the hash value as an arrayref.
Signed-off-by: Daniel P. Berrange <dan at berrange.com>
---
lib/Net/DBus/Binding/Iterator.pm | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/lib/Net/DBus/Binding/Iterator.pm b/lib/Net/DBus/Binding/Iterator.pm
index 74a7ded..0a44e81 100644
--- a/lib/Net/DBus/Binding/Iterator.pm
+++ b/lib/Net/DBus/Binding/Iterator.pm
@@ -492,8 +492,8 @@ sub guess_type {
if (!defined $subtype) {
if ($maintype == &Net::DBus::Binding::Message::TYPE_DICT_ENTRY) {
- $subtype = [ $self->guess_type(($value->value())[0]->[0]),
- $self->guess_type(($value->value())[0]->[1]) ];
+ $subtype = [ $self->guess_type((keys(%{ $value->value }))[0]),
+ $self->guess_type((values(%{ $value->value }))[0]) ];
} elsif ($maintype == &Net::DBus::Binding::Message::TYPE_ARRAY) {
$subtype = [ $self->guess_type(($value->value())[0]->[0]) ];
} elsif ($maintype == &Net::DBus::Binding::Message::TYPE_STRUCT) {
@@ -556,6 +556,11 @@ sub format_signature {
$sig .= "(" . $self->format_signature($$type[++$i]) . ")";
} else {
$sig .= chr($t);
+
+ if ($t == &Net::DBus::Binding::Message::TYPE_VARIANT)
+ {
+ last;
+ }
}
$i++;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libnet-dbus-perl.git
More information about the Pkg-perl-cvs-commits
mailing list