Bug 195551

Summary: [patch] cap_getaddrinfo() doesn't work
Product: Base System Reporter: mp39590
Component: kernAssignee: Mariusz Zaborski <oshogbo>
Status: Closed FIXED    
Severity: Affects Some People CC: emaste, junovitch, oshogbo
Priority: --- Keywords: patch
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch none

Description mp39590 2014-12-01 11:53:44 UTC
Created attachment 150064 [details]
patch

cap_getaddrinfo() from casper daemon doesn't work and returns error about badly formatted hints structure.

There are following errors:

 1. When passing hints structure to native getaddrinfo() ai_next member
wasn't set to NULL, and because of it getaddrinfo() failed, since it
requires everything to be set to 0 or NULL. From the man page:

"All other elements of the addrinfo structure passed via hints must be
zero or the null pointer."

2. nvlist_add_string was trying to add ai->ai_canonname field from
getaddrinfo() response, but it could be NULL and nvlist was going into
'error 22' state after this.

I've also added test cases for cap_getaddrinfo() for regression tests.
Comment 1 Jason Unovitch freebsd_committer freebsd_triage 2016-02-07 14:10:44 UTC
Feedback timeout is appropriate when a question to the submitter goes unanswered.  You are the submitter here.  It's likely nobody with the familiarity has had the time to look at this PR and address it.
Comment 2 Mariusz Zaborski freebsd_committer freebsd_triage 2016-02-07 15:38:05 UTC
I didn't notice this PR.
I will take it.
Comment 3 commit-hook freebsd_committer freebsd_triage 2016-04-14 18:27:51 UTC
A commit references this bug:

Author: oshogbo
Date: Thu Apr 14 18:27:10 UTC 2016
New revision: 297982
URL: https://svnweb.freebsd.org/changeset/base/297982

Log:
  Set NULL to the ai_next pointer which fix cap_getaddrinfo().
  Add regression test case.

  PR:		195551
  Submitted by:	Mikhail <mp39590@gmail.com>
  Approved by:	pjd (mentor)

Changes:
  head/lib/libcasper/services/cap_dns/cap_dns.c
  head/tools/regression/capsicum/libcasper/dns.c