diff options
author | timur <timur@FreeBSD.org> | 2010-02-05 09:10:54 +0800 |
---|---|---|
committer | timur <timur@FreeBSD.org> | 2010-02-05 09:10:54 +0800 |
commit | 8f670703e68e3d0f2edc58edf974f6b4087ee2b1 (patch) | |
tree | 71379f967019e264b536dd27b1ebf89e0f3c2e77 /net | |
parent | 3a1c64c0f73ec9ab91d14af04a92e71e2607f465 (diff) | |
download | freebsd-ports-gnome-8f670703e68e3d0f2edc58edf974f6b4087ee2b1.tar.gz freebsd-ports-gnome-8f670703e68e3d0f2edc58edf974f6b4087ee2b1.tar.zst freebsd-ports-gnome-8f670703e68e3d0f2edc58edf974f6b4087ee2b1.zip |
Dirty fix against coredumps when gethostbyname(_r) is used with WINS.
Diffstat (limited to 'net')
-rw-r--r-- | net/samba34/files/patch-nsswitch__wins_freebsd.c | 37 |
1 files changed, 4 insertions, 33 deletions
diff --git a/net/samba34/files/patch-nsswitch__wins_freebsd.c b/net/samba34/files/patch-nsswitch__wins_freebsd.c index 956fc788cd39..80b0f56d3677 100644 --- a/net/samba34/files/patch-nsswitch__wins_freebsd.c +++ b/net/samba34/files/patch-nsswitch__wins_freebsd.c @@ -1,6 +1,6 @@ ---- ./nsswitch/wins_freebsd.c.orig 2010-01-22 02:42:50.000000000 +0100 -+++ ./nsswitch/wins_freebsd.c 2010-01-22 02:42:50.000000000 +0100 -@@ -0,0 +1,108 @@ +--- ./nsswitch/wins_freebsd.c.orig 2010-02-05 00:27:01.000000000 +0000 ++++ ./nsswitch/wins_freebsd.c 2010-02-05 00:28:40.000000000 +0000 +@@ -0,0 +1,79 @@ +/* + Unix SMB/CIFS implementation. + @@ -24,12 +24,9 @@ + +#include "winbind_client.h" + -+NSS_STATUS _nss_wins_gethostbyname_r(const char *hostname, struct hostent *he, -+ char *buffer, size_t buflen, int *h_errnop); +NSS_STATUS _nss_wins_gethostbyname2_r(const char *name, int af, struct hostent *he, + char *buffer, size_t buflen, int *h_errnop); + -+NSS_METHOD_PROTOTYPE(__nss_wins_freebsd_gethostbyname_r); +NSS_METHOD_PROTOTYPE(__nss_wins_freebsd_gethostbyname2_r); + +static ns_mtab methods[] = @@ -37,7 +34,7 @@ + { NSDB_HOSTS, "getaddrinfo", NULL, NULL }, + { NSDB_HOSTS, "ghbyname", NULL, NULL }, + { NSDB_HOSTS, "ghbyaddr", NULL, NULL }, -+ { NSDB_HOSTS, "gethostbyaddr_r", __nss_wins_freebsd_gethostbyname_r, _nss_wins_gethostbyname_r }, ++ { NSDB_HOSTS, "gethostbyaddr_r", NULL, NULL }, + { NSDB_HOSTS, "gethostbyname2_r", __nss_wins_freebsd_gethostbyname2_r, _nss_wins_gethostbyname2_r }, + { NSDB_HOSTS, "getnetbyname_r", NULL, NULL }, + { NSDB_HOSTS, "getnetbyaddr_r", NULL, NULL }, @@ -48,32 +45,6 @@ +}; + +int -+__nss_wins_freebsd_gethostbyname_r(void *retval, void *mdata, va_list ap) -+{ -+ int (*fn)(const char *, struct hostent *, char *, size_t, int *); -+ const char *hostname; -+ struct hostent *he; -+ char *buffer; -+ size_t buflen; -+ int *h_errnop; -+ enum nss_status status; -+ -+ fn = mdata; -+ hostname = va_arg(ap, const char *); -+ he = va_arg(ap, struct hostent *); -+ buffer = va_arg(ap, char *); -+ buflen = va_arg(ap, size_t); -+ h_errnop = va_arg(ap, int *); -+ -+ status = fn(hostname, he, buffer, buflen, h_errnop); -+ status = __nss_compat_result(status, *h_errnop); -+ if (status == NS_SUCCESS) -+ *(struct hostent **)retval = he; -+ -+ return (status); -+} -+ -+int +__nss_wins_freebsd_gethostbyname2_r(void *retval, void *mdata, va_list ap) +{ + int (*fn)(const char *, int, struct hostent *, char *, size_t, int *); |