88 |
88 |
*-freebsd*) freebsd="yes" ;;
|
89 |
89 |
esac
|
90 |
90 |
|
|
91 |
# Solaris has a slightly different NSS interface
|
|
92 |
case ${host} in
|
|
93 |
*-solaris*) solaris="yes" ;;
|
|
94 |
esac
|
|
95 |
|
91 |
96 |
AM_CONDITIONAL([FREEBSD_NSS], [test "x$freebsd" = "xyes"])
|
|
97 |
AM_CONDITIONAL([SOLARIS_NSS], [test "x$solaris" = "xyes"])
|
|
98 |
|
|
99 |
if test "x$solaris" = "xyes" ; then
|
|
100 |
AC_DEFINE(SOLARIS_NSS, [1], [Add support for the Solaris NSS interface])
|
|
101 |
fi
|
92 |
102 |
|
93 |
103 |
# If using GCC specify some additional parameters
|
94 |
104 |
if test "x$GCC" = "xyes" ; then
|
95 |
|
-- nss-mdns-0.10.orig/src/Makefile.am
|
|
105 |
++ nss-mdns-0.10/src/Makefile.am
|
... | ... | |
42 |
42 |
nss_mdns4_minimal.la \
|
43 |
43 |
nss_mdns6_minimal.la
|
44 |
44 |
else
|
|
45 |
if SOLARIS_NSS
|
|
46 |
lib_LTLIBRARIES += \
|
|
47 |
nss_mdns.la \
|
|
48 |
nss_mdns4.la \
|
|
49 |
nss_mdns6.la \
|
|
50 |
nss_mdns_minimal.la \
|
|
51 |
nss_mdns4_minimal.la \
|
|
52 |
nss_mdns6_minimal.la
|
|
53 |
else
|
45 |
54 |
lib_LTLIBRARIES += \
|
46 |
55 |
libnss_mdns.la \
|
47 |
56 |
libnss_mdns4.la \
|
... | ... | |
50 |
59 |
libnss_mdns4_minimal.la \
|
51 |
60 |
libnss_mdns6_minimal.la
|
52 |
61 |
endif
|
|
62 |
endif
|
53 |
63 |
|
54 |
64 |
noinst_PROGRAMS = nss-test
|
55 |
65 |
sources = util.c util.h
|
... | ... | |
90 |
100 |
libnss_mdns6_minimal_la_LDFLAGS=$(libnss_mdns_la_LDFLAGS)
|
91 |
101 |
|
92 |
102 |
# FreeBSD
|
|
103 |
if FREEBSD_NSS
|
93 |
104 |
nss_mdns_la_SOURCES=$(sources) bsdnss.c
|
|
105 |
else
|
|
106 |
nss_mdns_la_SOURCES= $(sources) nss.c
|
|
107 |
endif
|
94 |
108 |
nss_mdns_la_CFLAGS=$(AM_CFLAGS)
|
95 |
109 |
nss_mdns_la_LDFLAGS=$(AM_LDFLAGS) -shrext .so.1
|
96 |
110 |
|
97 |
|
-- nss-mdns-0.10.orig/src/nss.c
|
|
111 |
++ nss-mdns-0.10/src/nss.c
|
... | ... | |
743 |
743 |
return status;
|
744 |
744 |
}
|
745 |
745 |
|
|
746 |
#ifdef SOLARIS_NSS
|
|
747 |
#include <nss_dbdefs.h>
|
|
748 |
|
|
749 |
#if defined(NSS_IPV4_ONLY) && ! defined(MDNS_MINIMAL)
|
|
750 |
#define _nss_mdns_hosts_constr _nss_mdns4_hosts_constr
|
|
751 |
#elif defined(NSS_IPV4_ONLY) && defined(MDNS_MINIMAL)
|
|
752 |
#define _nss_mdns_hosts_constr _nss_mdns4_minimal_hosts_constr
|
|
753 |
#elif defined(NSS_IPV6_ONLY) && ! defined(MDNS_MINIMAL)
|
|
754 |
#define _nss_mdns_hosts_constr _nss_mdns6_hosts_constr
|
|
755 |
#elif defined(NSS_IPV6_ONLY) && defined(MDNS_MINIMAL)
|
|
756 |
#define _nss_mdns_hosts_constr _nss_mdns6_minimal_hosts_constr
|
|
757 |
#elif defined(MDNS_MINIMAL)
|
|
758 |
#define _nss_mdns_hosts_constr _nss_mdns_minimal_hosts_constr
|
|
759 |
#endif
|
|
760 |
|
|
761 |
typedef struct mdns_backend *mdns_backend_ptr_t;
|
|
762 |
|
|
763 |
static nss_status_t getbyname(mdns_backend_ptr_t be, void *a)
|
|
764 |
{
|
|
765 |
nss_XbyY_args_t *args = (nss_XbyY_args_t *)a;
|
|
766 |
const char *name = args->key.name;
|
|
767 |
struct hostent *he = (struct hostent *)args->buf.result;
|
|
768 |
int errnop;
|
|
769 |
|
|
770 |
args->status = _nss_mdns_gethostbyname_r(name, he, args->buf.buffer, args->buf.buflen, &errnop, &args->h_errno);
|
|
771 |
if (args->status == NSS_SUCCESS)
|
|
772 |
{
|
|
773 |
args->returnval = he;
|
|
774 |
args->returnlen = 1;
|
|
775 |
}
|
|
776 |
|
|
777 |
return args->status;
|
|
778 |
}
|
|
779 |
|
|
780 |
static nss_status_t _nss_unavail(mdns_backend_ptr_t be, void *dummy)
|
|
781 |
{
|
|
782 |
return NSS_UNAVAIL;
|
|
783 |
}
|
|
784 |
|
|
785 |
static nss_status_t _nss_mdns_hosts_destr(mdns_backend_ptr_t be, void *dummy)
|
|
786 |
{
|
|
787 |
free(be);
|
|
788 |
return NSS_SUCCESS;
|
|
789 |
}
|
|
790 |
|
|
791 |
typedef nss_status_t (*mdns_backend_op_t)(mdns_backend_ptr_t, void *);
|
|
792 |
|
|
793 |
struct mdns_backend {
|
|
794 |
mdns_backend_op_t *ops;
|
|
795 |
nss_dbop_t n_ops;
|
|
796 |
};
|
|
797 |
|
|
798 |
static mdns_backend_op_t host_ops[] = {
|
|
799 |
_nss_mdns_hosts_destr,
|
|
800 |
_nss_unavail,
|
|
801 |
_nss_unavail,
|
|
802 |
_nss_unavail,
|
|
803 |
getbyname,
|
|
804 |
};
|
|
805 |
|
|
806 |
nss_backend_t *
|
|
807 |
_nss_mdns_hosts_constr(const char *dummy1, const char *dummy2, const char *dummy3)
|
|
808 |
{
|
|
809 |
mdns_backend_ptr_t be;
|
|
810 |
|
|
811 |
if ((be = (mdns_backend_ptr_t)calloc(1, sizeof (*be))) == NULL)
|
|
812 |
return (NULL);
|
|
813 |
be->ops = host_ops;
|
|
814 |
be->n_ops = sizeof(host_ops) / sizeof(mdns_backend_ptr_t);
|
|
815 |
return ((nss_backend_t *)be);
|
|
816 |
}
|
|
817 |
#endif
|