mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Isaac Dunham <ibid.ag@gmail.com>
To: musl@lists.openwall.com
Cc: alpine-devel@lists.alpinelinux.org
Subject: Re: cups debugging, continued
Date: Sun, 29 Jun 2014 21:35:13 -0700	[thread overview]
Message-ID: <20140630043512.GB16088@newbook> (raw)
In-Reply-To: <20140630020311.GD179@brightrain.aerifal.cx>

On Sun, Jun 29, 2014 at 10:03:11PM -0400, Rich Felker wrote:
> On Sun, Jun 29, 2014 at 06:28:31PM -0700, Isaac Dunham wrote:
> > On Sun, Jun 29, 2014 at 05:12:01PM -0700, Isaac Dunham wrote:
> > > Now I hit the next issue: the 'lpd' backend reports 
> > > 'Unable to reserve port: Invalid argument'
> > > And I need to figure out what's causing this--or rather, what the solution is.
> > > Right now, I'm stuck (lpd is the main way to access it, and it isn't working).
> > OK, now we're in cups-1.7.3/backend/lpd.c:
> > 
> > ....the problem is a local implementation of rresvport_af(), trying to reserve
> > a port but failing.
> > 
> > And strace -p `pidof lpd` says this:
> > Process 16113 attached
> > restart_syscall(<... resuming interrupted call ...>) = 0
> > geteuid32()                             = 0
> > socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 7
> > bind(7, {sa_family=AF_INET, sin_port=htons(905), sin_addr=inet_addr("0.0.0.0")}, 256) = -1 EINVAL (Invalid argument)
> 
> Where did the value of 256 for socklen_t come from? That's almost
> surely the cause of the EINVAL. sockaddr_in should have a length of
> 16, not 256.
Apparently this:
    if (!bind(fd, (struct sockaddr *)&addr, sizeof(addr)))
          return (fd);

addr is of type http_addr_t, defined in cups/http.h thus:
typedef union _http_addr_u              /**** Socket address union, which
                                         **** makes using IPv6 and other
					 **** address types easier and
					 **** more portable. @since CUPS 1.2/OS X 10.5@                                  ****/
										{
  struct sockaddr       addr;           /* Base structure for family value */
  struct sockaddr_in    ipv4;           /* IPv4 address */
#ifdef AF_INET6
  struct sockaddr_in6   ipv6;           /* IPv6 address */
#endif /* AF_INET6 */
#ifdef AF_LOCAL
  struct sockaddr_un    un;             /* Domain socket file */
#endif /* AF_LOCAL */
  char                  pad[256];       /* Padding to ensure binary compatibility */
} http_addr_t;

I'm not sure how to handle this.

Thanks,
Isaac Dunham


  reply	other threads:[~2014-06-30  4:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20140629194829.GA1994@newbook>
     [not found] ` <20140630001201.GA14838@newbook>
2014-06-30  1:28   ` Isaac Dunham
2014-06-30  2:03     ` Rich Felker
2014-06-30  4:35       ` Isaac Dunham [this message]
2014-06-30  5:34         ` cups debugging, continued...ugly patch Isaac Dunham
2014-06-30  6:21           ` Luca Barbato
2014-06-30  6:58             ` Rich Felker
2014-06-30  7:03           ` Rich Felker
2014-06-30 19:43             ` James Cloos
2014-07-01  1:14               ` Rich Felker
2014-07-01 14:19           ` [alpine-devel] " Natanael Copa

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=20140630043512.GB16088@newbook \
    --to=ibid.ag@gmail.com \
    --cc=alpine-devel@lists.alpinelinux.org \
    --cc=musl@lists.openwall.com \
    /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 public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).