Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Nov 2018 17:22:53 +0000 (UTC)
From:      Mariusz Zaborski <oshogbo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r340638 - head/lib/libcasper/services/cap_dns
Message-ID:  <201811191722.wAJHMrb2061230@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: oshogbo
Date: Mon Nov 19 17:22:52 2018
New Revision: 340638
URL: https://svnweb.freebsd.org/changeset/base/340638

Log:
  libcasper: provide compatibility with the old version of service
  
  Some external tools like tcpdump(1) have upstream the changes with old limits
  name. Because of that provide compatibility with the old names.
  
  Reported by:	emaste

Modified:
  head/lib/libcasper/services/cap_dns/cap_dns.c

Modified: head/lib/libcasper/services/cap_dns/cap_dns.c
==============================================================================
--- head/lib/libcasper/services/cap_dns/cap_dns.c	Mon Nov 19 17:17:23 2018	(r340637)
+++ head/lib/libcasper/services/cap_dns/cap_dns.c	Mon Nov 19 17:22:52 2018	(r340638)
@@ -474,7 +474,8 @@ dns_gethostbyname(const nvlist_t *limits, const nvlist
 	struct hostent *hp;
 	int family;
 
-	if (!dns_allowed_type(limits, "NAME2ADDR"))
+	if (!dns_allowed_type(limits, "NAME2ADDR") &&
+	    !dns_allowed_type(limits, "NAME"))
 		return (NO_RECOVERY);
 
 	family = (int)nvlist_get_number(nvlin, "family");
@@ -498,7 +499,8 @@ dns_gethostbyaddr(const nvlist_t *limits, const nvlist
 	size_t addrsize;
 	int family;
 
-	if (!dns_allowed_type(limits, "ADDR2NAME"))
+	if (!dns_allowed_type(limits, "ADDR2NAME") &&
+	    !dns_allowed_type(limits, "ADDR"))
 		return (NO_RECOVERY);
 
 	family = (int)nvlist_get_number(nvlin, "family");
@@ -524,7 +526,8 @@ dns_getnameinfo(const nvlist_t *limits, const nvlist_t
 	socklen_t salen;
 	int error, flags;
 
-	if (!dns_allowed_type(limits, "ADDR2NAME"))
+	if (!dns_allowed_type(limits, "ADDR2NAME") &&
+	    !dns_allowed_type(limits, "ADDR"))
 		return (NO_RECOVERY);
 
 	error = 0;
@@ -617,7 +620,8 @@ dns_getaddrinfo(const nvlist_t *limits, const nvlist_t
 	unsigned int ii;
 	int error, family, n;
 
-	if (!dns_allowed_type(limits, "NAME2ADDR"))
+	if (!dns_allowed_type(limits, "NAME2ADDR") &&
+	    !dns_allowed_type(limits, "NAME"))
 		return (NO_RECOVERY);
 
 	hostname = dnvlist_get_string(nvlin, "hostname", NULL);
@@ -703,7 +707,9 @@ dns_limit(const nvlist_t *oldlimits, const nvlist_t *n
 				return (EINVAL);
 			type = nvlist_get_string(newlimits, name);
 			if (strcmp(type, "ADDR2NAME") != 0 &&
-			    strcmp(type, "NAME2ADDR") != 0) {
+			    strcmp(type, "NAME2ADDR") != 0 &&
+			    strcmp(type, "ADDR") != 0 &&
+			    strcmp(type, "NAME") != 0) {
 				return (EINVAL);
 			}
 			if (!dns_allowed_type(oldlimits, type))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811191722.wAJHMrb2061230>