svn commit: r340638 - head/lib/libcasper/services/cap_dns

Mariusz Zaborski oshogbo at FreeBSD.org
Mon Nov 19 17:22:54 UTC 2018


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))


More information about the svn-src-all mailing list