Source: nbd
Version: 1:3.12.1-2
Severity: normal
User: [email protected]
Usertags: hurd

Hello,

nbd FTBFS on hurd-i386 because the unix test fails while calling
getpeername on the unix socket. getpeername is indeed not supported on
GNU/Hurd because it does not really make sense: the peer does not have
an address.  The attached patch fixes this by calling getsockname (which
does make sense) first to determine whether this is a unix or tcp/ip
socket, and then call getpeername in the tcp/ip case.

Samuel

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'oldoldstable'), (500, 
'buildd-unstable'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (500, 
'oldstable'), (1, 'experimental-debug'), (1, 'buildd-experimental'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.3.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

-- 
Samuel
<Y> C'ETAIT PAS UN BUG !
<y> :ppp
<y> c ce qu'on dit ;)
<Y> (j'ai appuye sur ON, ca peut arriver, non ?)
 -+- #hp debuggue IRCprime -+-
--- nbd-server.c.original       2016-01-03 17:53:00.000000000 +0000
+++ nbd-server.c        2016-01-03 17:51:55.000000000 +0000
@@ -1977,14 +1977,19 @@
        int i;
        int e;
 
-       if (getpeername(net, (struct sockaddr *) &(client->clientaddr), 
&addrinlen) < 0) {
-               msg(LOG_INFO, "getpeername failed: %m");
+       if (getsockname(net, addr, &addrinlen) < 0) {
+               msg(LOG_INFO, "getsockname failed: %m");
                return -1;
        }
 
-       if(client->clientaddr.ss_family == AF_UNIX) {
+       if(netaddr.ss_family == AF_UNIX) {
+               client->clientaddr.ss_family = AF_UNIX;
                strcpy(peername, "unix");
        } else {
+               if (getpeername(net, (struct sockaddr *) &(client->clientaddr), 
&addrinlen) < 0) {
+                       msg(LOG_INFO, "getpeername failed: %m");
+                       return -1;
+               }
                if((e = getnameinfo((struct sockaddr *)&(client->clientaddr), 
addrinlen,
                                peername, sizeof (peername), NULL, 0, 
NI_NUMERICHOST))) {
                        msg(LOG_INFO, "getnameinfo failed: %s", 
gai_strerror(e));

Reply via email to