all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Lars Magne Ingebrigtsen <larsi@gnus.org>
Cc: mvoteiza@udel.edu, 23068@debbugs.gnu.org
Subject: bug#23068: 25.1.50; unix socket address in abstract namespace
Date: Sun, 20 Mar 2016 19:25:13 +0200	[thread overview]
Message-ID: <83egb56ozq.fsf@gnu.org> (raw)
In-Reply-To: <m3d1qpulaq.fsf@gnus.org> (message from Lars Magne Ingebrigtsen on Sun, 20 Mar 2016 18:11:09 +0100)

> From: Lars Magne Ingebrigtsen <larsi@gnus.org>
> Cc: Eli Zaretskii <eliz@gnu.org>,  23068@debbugs.gnu.org
> Date: Sun, 20 Mar 2016 18:11:09 +0100
> 
> Mark Oteiza <mvoteiza@udel.edu> writes:
> 
> > and I'm able to connect to it otherwise. The above elisp does:
> >
> >   socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC, 0) = 8
> >   connect(8, {sa_family=AF_LOCAL, sun_path=@""}, 110) = -1
> > ECONNREFUSED (Connection refused)
> >   close(8) 
> 
> Yeah, this code in conv_lisp_to_sockaddr doesn't look very correct:
> 
>   else if (STRINGP (address))
>     {
> #ifdef HAVE_LOCAL_SOCKETS
>       if (family == AF_LOCAL)
> 	{
> 	  struct sockaddr_un *sockun = (struct sockaddr_un *) sa;
> 	  cp = SDATA (address);
> 	  for (i = 0; i < sizeof (sockun->sun_path) && *cp; i++)
> 	    sockun->sun_path[i] = *cp++;
> 	  sa->sa_family = family;
> 	}
> #endif
>       return;
>     }

That should be trivial to fix.  Elsewhere, we specifically attempt to
support this feature:

  #ifdef HAVE_LOCAL_SOCKETS
      case AF_LOCAL:
	{
	  struct sockaddr_un *sockun = (struct sockaddr_un *) sa;
	  ptrdiff_t name_length = len - offsetof (struct sockaddr_un, sun_path);
	  /* If the first byte is NUL, the name is a Linux abstract
	     socket name, and the name can contain embedded NULs.  If
	     it's not, we have a NUL-terminated string.  Be careful not
	     to walk past the end of the object looking for the name
	     terminator, however.  */
	  if (name_length > 0 && sockun->sun_path[0] != '\0')
	    {
	      const char *terminator
		= memchr (sockun->sun_path, '\0', name_length);

	      if (terminator)
		name_length = terminator - (const char *) sockun->sun_path;
	    }

	  return make_unibyte_string (sockun->sun_path, name_length);
	}

IOW, this is not a wishlist feature request, but a routine bug report ;-)





  reply	other threads:[~2016-03-20 17:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-20  3:18 bug#23068: 25.1.50; unix socket address in abstract namespace Mark Oteiza
2016-03-20 16:32 ` Eli Zaretskii
2016-03-20 17:02   ` Mark Oteiza
2016-03-20 17:11     ` Lars Magne Ingebrigtsen
2016-03-20 17:25       ` Eli Zaretskii [this message]
2016-03-20 17:39       ` Andreas Schwab
2016-03-20 18:02         ` Eli Zaretskii
2016-03-20 19:49           ` Andreas Schwab
2016-03-20 19:51             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83egb56ozq.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=23068@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=mvoteiza@udel.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.