Package: perl
Version: 5.8.7-4
Severity: normal
Tags: upstream

Even if it's supposed to support abstract AF_UNIX sockets,
Socket::pack_sockaddr_un pads the structure with NULs, which makes the
address different. As you can see with strace:

# right
bind(3, {sa_family=AF_FILE, path=@/org/kernel/udev/udevd}, 25) = 0

# wrong
bind(3, {sa_family=AF_FILE, path=@/org/kernel/udev/udevd}, 110) = 0

Test code:

#!/usr/bin/perl

use IO::Socket::UNIX;

use strict;
use warnings;

use constant UDEVD_SOCK_PATH => "\000/org/kernel/udev/udevd";

{ # workaround
no warnings 'redefine';
*Socket::pack_sockaddr_un = sub { pack('s', 1) . $_[0]; };
}

my $sock = new IO::Socket::UNIX(
        Type    => SOCK_DGRAM,
        Local   => UDEVD_SOCK_PATH,
        Listen  => 1,
) or die $!;

my $data;
my $seq = 0;
while (defined $sock->recv($data, 8192, 0)) {
        my ($magic, $type, $env) = unpack('a32 I a*', $data);
        die "Bad magic: $magic\n" if $magic !~ /^udevd_\d+\000+$/;

        my %env;
        map {
                my ($a, $b) = split(/=/, $_, 2); $env{$a} = $b;
        } split(/\000/, $env);

        next if $env{SUBSYSTEM} =~ /^(tty|mem|vc)$/;
        dumpenv(sprintf(">e/%05d.%s", $seq++, $env{SUBSYSTEM} || 'x'),
                [split(/\000/, $env)]);
}

die $! if not $data;

sub dumpenv {
        my ($name, $data) = @_;

        open(FILE, $name) or die $!;
        print FILE join("\n", @$data) . "\n";
        close FILE;
}


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.6.13
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)

Versions of packages perl depends on:
ii  libc6                         2.3.5-3    GNU C Library: Shared libraries an
ii  libdb4.2                      4.2.52-18  Berkeley v4.2 Database Libraries [
ii  libgdbm3                      1.8.3-2    GNU dbm database routines (runtime
ii  perl-base                     5.8.7-4    The Pathologically Eclectic Rubbis
ii  perl-modules                  5.8.7-4    Core Perl modules

Versions of packages perl recommends:
ii  perl-doc                      5.8.7-4    Perl documentation

-- no debconf information

-- 
ciao,
Marco

Attachment: signature.asc
Description: Digital signature

Reply via email to