Bug 195551 - [patch] cap_getaddrinfo() doesn't work
Summary: [patch] cap_getaddrinfo() doesn't work
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Mariusz Zaborski
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2014-12-01 11:53 UTC by mp39590
Modified: 2016-04-14 19:09 UTC (History)
3 users (show)

See Also:


Attachments
patch (7.80 KB, patch)
2014-12-01 11:53 UTC, mp39590
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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