Import of pkgsrc-2013Q2

This commit is contained in:
2013-09-26 17:14:40 +02:00
commit 785076ae39
74991 changed files with 4380255 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
# $NetBSD: DEINSTALL,v 1.1 2006/09/21 18:06:18 drochner Exp $
case ${STAGE} in
POST-DEINSTALL)
rm -f /usr/lib/nss_mdns.so.0
;;
esac

View File

@@ -0,0 +1,2 @@
This is a nsswitch plugin from Apple's mDNSResponder code, adapted for
NetBSD's nsswitch.

View File

@@ -0,0 +1,7 @@
# $NetBSD: INSTALL,v 1.1 2006/09/21 18:06:18 drochner Exp $
case ${STAGE} in
POST-INSTALL)
ln -sf ${PREFIX}/lib/nss_mdns.so.0 /usr/lib/nss_mdns.so.0
;;
esac

View File

@@ -0,0 +1,40 @@
# $NetBSD: Makefile,v 1.12 2012/10/23 17:18:36 asau Exp $
DISTNAME= mDNSResponder-258.14
PKGNAME= mDNSResponder-nss-258.14
PKGREVISION= 1
CATEGORIES= net
MASTER_SITES= http://www.opensource.apple.com/tarballs/mDNSResponder/
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= http://developer.apple.com/bonjour/
COMMENT= Apple's mDNS responder - NetBSD nsswitch module
LICENSE= modified-bsd
# needs nsswitch
ONLY_FOR_PLATFORM= NetBSD-[3-9]*-*
INSTALLATION_DIRS= lib share/examples/nss_mdns ${PKGMANDIR}/man5
BUILD_DEFS+= PKG_SYSCONFBASE
CONF_FILES= ${PREFIX}/share/examples/nss_mdns/nss_mdns.conf \
${PKG_SYSCONFDIR}/nss_mdns.conf
post-extract:
${CP} ${FILESDIR}/netbsd.c ${FILESDIR}/netbsd.h ${WRKSRC}/mDNSPosix
do-build:
(cd ${WRKSRC}/mDNSPosix && ${CC} -c -fPIC -I. -I${LOCALBASE}/include \
-DPKG_SYSCONFBASE=\"${PKG_SYSCONFBASE}\" nss_mdns.c netbsd.c)
(cd ${WRKSRC}/mDNSPosix && ${LD} -shared *.o -o nss_mdns.so.0 \
-L${LOCALBASE}/lib -Wl,-R${LOCALBASE}/lib -ldns_sd)
do-install:
${INSTALL_LIB} ${WRKSRC}/mDNSPosix/nss_mdns.so.0 ${DESTDIR}${PREFIX}/lib
${INSTALL_DATA} ${WRKSRC}/mDNSPosix/nss_mdns.conf \
${DESTDIR}${PREFIX}/share/examples/nss_mdns
${INSTALL_MAN} ${WRKSRC}/mDNSPosix/nss_mdns.conf.5 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man5
.include "../../net/mDNSResponder/buildlink3.mk"
.include "../../mk/pthread.buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

View File

@@ -0,0 +1,4 @@
@comment $NetBSD: PLIST,v 1.2 2009/06/14 18:09:34 joerg Exp $
lib/nss_mdns.so.0
man/man5/nss_mdns.conf.5
share/examples/nss_mdns/nss_mdns.conf

View File

@@ -0,0 +1,6 @@
$NetBSD: distinfo,v 1.4 2012/02/09 13:41:00 hauke Exp $
SHA1 (mDNSResponder-258.14.tar.gz) = 2a34794ff9a5184ce1e57ccea4001b5af6635f7b
RMD160 (mDNSResponder-258.14.tar.gz) = fbd9dcfa84dbeb9de379066958a0b509af074dbc
Size (mDNSResponder-258.14.tar.gz) = 1833244 bytes
SHA1 (patch-aa) = 4bc20847ce6fd2398f1beca5adb0eab357cda0a8

View File

@@ -0,0 +1,143 @@
/* $NetBSD: netbsd.c,v 1.1.1.1 2006/07/10 17:35:30 drochner Exp $ */
#include <sys/param.h>
#include <nsswitch.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#include "netbsd.h"
typedef enum nss_status NSS_STATUS;
extern NSS_STATUS _nss_mdns_gethostbyname2_r(const char *,
int, struct hostent *, char *, size_t, int *, int *);
static int netbsd_gethostbyname(void *, void *, va_list);
static int netbsd_getaddrinfo(void *, void *, va_list);
extern NSS_STATUS _nss_mdns_gethostbyaddr_r(const void *, socklen_t,
int, struct hostent *, char *, size_t, int *, int *);
static int netbsd_gethostbyaddr(void *, void *, va_list);
static int nss2netbsderr[] = {
NS_SUCCESS, NS_NOTFOUND, NS_UNAVAIL, NS_TRYAGAIN, NS_RETURN
};
static struct hostent host;
static char hostbuf[8*1024];
static ns_mtab methods[] = {
{ NSDB_HOSTS, "gethostbyname", netbsd_gethostbyname, 0 },
{ NSDB_HOSTS, "getaddrinfo", netbsd_getaddrinfo, 0 },
{ NSDB_HOSTS, "gethostbyaddr", netbsd_gethostbyaddr, 0 },
};
static int
netbsd_gethostbyname(void *rv, void *cb_data, va_list ap)
{
NSS_STATUS s;
int err, herr;
const char *name = va_arg(ap, char *);
size_t namlen = va_arg(ap, size_t);
int af = va_arg(ap, int);
s = _nss_mdns_gethostbyname2_r(name, af, &host,
hostbuf, sizeof(hostbuf), &err, &herr);
if (s == NSS_STATUS_SUCCESS)
*(struct hostent **)rv = &host;
else {
h_errno = HOST_NOT_FOUND;
*(struct hostent **)rv = 0;
}
return nss2netbsderr[s];
}
static void
aiforaf(const char *name, int af, struct addrinfo *pai, struct addrinfo **aip)
{
NSS_STATUS s;
int err, herr;
char **addrp;
char addrstr[INET6_ADDRSTRLEN];
struct addrinfo hints, *res0, *res;
s = _nss_mdns_gethostbyname2_r(name, af, &host,
hostbuf, sizeof(hostbuf), &err, &herr);
if (s != NSS_STATUS_SUCCESS)
return;
for (addrp = host.h_addr_list; *addrp; addrp++) {
/* XXX this sucks, but get_ai is not public */
if (!inet_ntop(host.h_addrtype, *addrp,
addrstr, sizeof(addrstr)))
continue;
hints = *pai;
hints.ai_flags = AI_NUMERICHOST;
hints.ai_family = af;
if (getaddrinfo(addrstr, NULL, &hints, &res0))
continue;
for (res = res0; res; res = res->ai_next)
res->ai_flags = pai->ai_flags;
(*aip)->ai_next = res0;
while ((*aip)->ai_next)
*aip = (*aip)->ai_next;
}
}
static int
netbsd_getaddrinfo(void *rv, void *cb_data, va_list ap)
{
struct addrinfo sentinel, *cur;
const char *name = va_arg(ap, char *);
struct addrinfo *ai = va_arg(ap, struct addrinfo *);
memset(&sentinel, 0, sizeof(sentinel));
cur = &sentinel;
if ((ai->ai_family == AF_UNSPEC) || (ai->ai_family == AF_INET6))
aiforaf(name, AF_INET6, ai, &cur);
if ((ai->ai_family == AF_UNSPEC) || (ai->ai_family == AF_INET))
aiforaf(name, AF_INET, ai, &cur);
if (!sentinel.ai_next) {
h_errno = HOST_NOT_FOUND;
return NS_NOTFOUND;
}
*((struct addrinfo **)rv) = sentinel.ai_next;
return NS_SUCCESS;
}
static int
netbsd_gethostbyaddr(void *rv, void *cb_data, va_list ap)
{
int err, herr;
NSS_STATUS s;
const unsigned char *addr = va_arg(ap, unsigned char *);
socklen_t addrlen = va_arg(ap, socklen_t);
int af = va_arg(ap, int);
s = _nss_mdns_gethostbyaddr_r(addr, addrlen, af, &host,
hostbuf, sizeof(hostbuf), &err, &herr);
if (s == NSS_STATUS_SUCCESS)
*(struct hostent **)rv = &host;
else {
h_errno = HOST_NOT_FOUND;
*(struct hostent **)rv = 0;
}
return nss2netbsderr[s];
}
ns_mtab *
nss_module_register(const char *source, unsigned int *mtabsize,
nss_module_unregister_fn *unreg)
{
*mtabsize = sizeof(methods)/sizeof(methods[0]);
*unreg = NULL;
return (methods);
}

View File

@@ -0,0 +1,11 @@
/* $NetBSD: netbsd.h,v 1.1.1.1 2006/07/10 17:35:30 drochner Exp $ */
#include <nsswitch.h>
enum nss_status {
NSS_STATUS_SUCCESS,
NSS_STATUS_NOTFOUND,
NSS_STATUS_UNAVAIL,
NSS_STATUS_TRYAGAIN,
NSS_STATUS_RETURN
};

View File

@@ -0,0 +1,402 @@
$NetBSD: patch-aa,v 1.3 2012/02/09 13:41:01 hauke Exp $
--- mDNSPosix/nss_mdns.c.orig 2008-11-04 20:06:20.000000000 +0000
+++ mDNSPosix/nss_mdns.c
@@ -96,7 +96,7 @@ b. in the case of services:
/*
Count the number of dots in a name string.
*/
-int
+static int
count_dots (const char * name);
@@ -107,7 +107,7 @@ count_dots (const char * name);
1 if name ends with ".local" or ".local."
0 otherwise
*/
-int
+static int
islocal (const char * name);
@@ -126,7 +126,7 @@ islocal (const char * name);
Pointer to (first character of) output buffer,
or NULL on error.
*/
-char *
+static char *
format_reverse_addr (int af, const void * addr, int prefixlen, char * buf);
@@ -145,7 +145,7 @@ format_reverse_addr (int af, const void
Pointer to (first character of) output buffer,
or NULL on error.
*/
-char *
+static char *
format_reverse_addr_in (
const struct in_addr * addr,
int prefixlen,
@@ -168,7 +168,7 @@ format_reverse_addr_in (
Pointer to (first character of) output buffer,
or NULL on error.
*/
-char *
+static char *
format_reverse_addr_in6 (
const struct in6_addr * addr,
int prefixlen,
@@ -189,7 +189,7 @@ format_reverse_addr_in6 (
0 on failure (no match)
< 0 on error
*/
-int
+static int
cmp_dns_suffix (const char * name, const char * domain);
enum
{
@@ -213,7 +213,7 @@ typedef int ns_class_t;
Appropriate AF code (from socket.h), or AF_UNSPEC if an appropriate
mapping couldn't be determined
*/
-int
+static int
rr_to_af (ns_type_t rrtype);
@@ -227,7 +227,7 @@ rr_to_af (ns_type_t rrtype);
Appropriate RR code (from nameser.h), or ns_t_invalid if an appropriate
mapping couldn't be determined
*/
-ns_type_t
+static ns_type_t
af_to_rr (int af);
@@ -237,7 +237,7 @@ af_to_rr (int af);
Returns
Matching AF code, or AF_UNSPEC if no match found.
*/
-int
+static int
str_to_af (const char * str);
@@ -247,7 +247,7 @@ str_to_af (const char * str);
Returns
Matching ns_class_t, or ns_c_invalid if no match found.
*/
-ns_class_t
+static ns_class_t
str_to_ns_class (const char * str);
@@ -257,7 +257,7 @@ str_to_ns_class (const char * str);
Returns
Matching ns_type_t, or ns_t_invalid if no match found.
*/
-ns_type_t
+static ns_type_t
str_to_ns_type (const char * str);
@@ -268,7 +268,7 @@ str_to_ns_type (const char * str);
String representation of AF,
or NULL if address family unrecognised or invalid.
*/
-const char *
+static const char *
af_to_str (int in);
@@ -279,7 +279,7 @@ af_to_str (int in);
String representation of ns_class_t,
or NULL if ns_class_t unrecognised or invalid.
*/
-const char *
+static const char *
ns_class_to_str (ns_class_t in);
@@ -290,7 +290,7 @@ ns_class_to_str (ns_class_t in);
String representation of ns_type_t,
or NULL if ns_type_t unrecognised or invalid.
*/
-const char *
+static const char *
ns_type_to_str (ns_type_t in);
@@ -320,7 +320,7 @@ ns_type_to_str (ns_type_t in);
< 0 on error.
A return of 0 implies the empty domain.
*/
-int
+static int
dns_rdata_to_name (const char * rdata, int rdlen, char * name, int name_len);
enum
{
@@ -359,7 +359,7 @@ typedef int errcode_t;
0 failure
-1 error, check errno
*/
-int
+static int
config_is_mdns_suffix (const char * name);
@@ -373,13 +373,17 @@ config_is_mdns_suffix (const char * name
0 configuration ready
non-zero configuration error code
*/
-errcode_t
-init_config ();
+static errcode_t
+init_config (void);
#define ENTNAME hostent
#define DATABASE "hosts"
+#ifdef __NetBSD__
+#include "netbsd.h"
+#else
#include <nss.h>
+#endif
// For nss_status
#include <netdb.h>
// For hostent
@@ -584,7 +588,7 @@ mdns_lookup_callback_t
void *context
);
-mdns_lookup_callback_t mdns_lookup_callback;
+static mdns_lookup_callback_t mdns_lookup_callback;
static int
@@ -1054,7 +1058,7 @@ handle_events (DNSServiceRef sdref, resu
Examine incoming data and add to relevant fields in result structure.
This routine is called from DNSServiceProcessResult where appropriate.
*/
-void
+static void
mdns_lookup_callback
(
DNSServiceRef sdref,
@@ -1684,14 +1688,14 @@ is_applicable_addr (
//----------
// Types and Constants
-const char * k_conf_file = "/etc/nss_mdns.conf";
+static const char * k_conf_file = PKG_SYSCONFBASE "/nss_mdns.conf";
#define CONF_LINE_SIZE 1024
-const char k_comment_char = '#';
+static const char k_comment_char = '#';
-const char * k_keyword_domain = "domain";
+static const char * k_keyword_domain = "domain";
-const char * k_default_domains [] =
+static const char * k_default_domains [] =
{
"local",
"254.169.in-addr.arpa",
@@ -1721,7 +1725,7 @@ typedef struct
domain_entry_t * domains;
} config_t;
-const config_t k_empty_config =
+static const config_t k_empty_config =
{
NULL
};
@@ -1770,7 +1774,7 @@ contains_domain_suffix (const config_t *
static config_t * g_config = NULL;
// Configuration info
-pthread_mutex_t g_config_mutex =
+static pthread_mutex_t g_config_mutex =
#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
#else
@@ -1789,7 +1793,7 @@ pthread_mutex_t g_config_mutex =
0 success
non-zero error code on failure
*/
-errcode_t
+static errcode_t
init_config ()
{
if (g_config)
@@ -1862,7 +1866,7 @@ init_config ()
}
-int
+static int
config_is_mdns_suffix (const char * name)
{
int errcode = init_config ();
@@ -2018,7 +2022,7 @@ get_next_word (char * input, char **next
char * curr = input;
char * result;
- while (isspace (*curr))
+ while (isspace ((unsigned)*curr))
{
curr ++;
}
@@ -2029,7 +2033,7 @@ get_next_word (char * input, char **next
}
result = curr;
- while (*curr && ! isspace (*curr))
+ while (*curr && ! isspace ((unsigned)*curr))
{
curr++;
}
@@ -2247,7 +2251,7 @@ table_index_value (const table_entry_t t
//----------
// Util functions
-int
+static int
count_dots (const char * name)
{
int count = 0;
@@ -2262,14 +2266,14 @@ count_dots (const char * name)
}
-int
+static int
islocal (const char * name)
{
return cmp_dns_suffix (name, k_local_suffix) > 0;
}
-int
+static int
rr_to_af (ns_type_t rrtype)
{
switch (rrtype)
@@ -2286,7 +2290,7 @@ rr_to_af (ns_type_t rrtype)
}
-ns_type_t
+static ns_type_t
af_to_rr (int af)
{
switch (af)
@@ -2304,7 +2308,7 @@ af_to_rr (int af)
}
-int
+static int
str_to_af (const char * str)
{
int result =
@@ -2316,7 +2320,7 @@ str_to_af (const char * str)
}
-ns_class_t
+static ns_class_t
str_to_ns_class (const char * str)
{
return (ns_class_t)
@@ -2324,7 +2328,7 @@ str_to_ns_class (const char * str)
}
-ns_type_t
+static ns_type_t
str_to_ns_type (const char * str)
{
return (ns_type_t)
@@ -2332,7 +2336,7 @@ str_to_ns_type (const char * str)
}
-const char *
+static const char *
af_to_str (int in)
{
int result =
@@ -2344,7 +2348,7 @@ af_to_str (int in)
}
-const char *
+static const char *
ns_class_to_str (ns_class_t in)
{
if (in < k_table_ns_class_size)
@@ -2354,7 +2358,7 @@ ns_class_to_str (ns_class_t in)
}
-const char *
+static const char *
ns_type_to_str (ns_type_t in)
{
if (in < k_table_ns_type_size)
@@ -2364,7 +2368,7 @@ ns_type_to_str (ns_type_t in)
}
-char *
+static char *
format_reverse_addr_in (
const struct in_addr * addr,
int prefixlen,
@@ -2395,7 +2399,7 @@ format_reverse_addr_in (
}
-char *
+static char *
format_reverse_addr_in6 (
const struct in6_addr * addr,
int prefixlen,
@@ -2437,7 +2441,7 @@ format_reverse_addr_in6 (
}
-char *
+static char *
format_reverse_addr (
int af,
const void * addr,
@@ -2467,7 +2471,7 @@ format_reverse_addr (
}
-int
+static int
cmp_dns_suffix (const char * name, const char * domain)
{
const char * nametail;
@@ -2527,7 +2531,7 @@ cmp_dns_suffix (const char * name, const
while (
nametail >= name
&& domaintail >= domain
- && tolower(*nametail) == tolower(*domaintail))
+ && tolower((unsigned)*nametail) == tolower((unsigned)*domaintail))
{
nametail--;
domaintail--;
@@ -2558,7 +2562,7 @@ cmp_dns_suffix (const char * name, const
}
-int
+static int
dns_rdata_to_name (const char * rdata, int rdlen, char * name, int name_len)
{
int i = 0;