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.coll...@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 <d...@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

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to