File good_data-tcp_wrappers.patch of Package quota.openSUSE_11.4_Update
Index: quota-tools/rquota_svc.c
===================================================================
--- quota-tools.orig/rquota_svc.c
+++ quota-tools/rquota_svc.c
@@ -19,7 +19,9 @@
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*/
-
+
+#include "config.h"
+
#include <rpc/rpc.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -172,8 +174,7 @@ static void parse_options(int argc, char
int good_client(struct sockaddr_in *addr, ulong rq_proc)
{
#ifdef HOSTS_ACCESS
- struct hostent *h;
- char *name, **ad;
+ struct request_info req;
#endif
char *remote = inet_ntoa(addr->sin_addr);
@@ -199,31 +200,10 @@ int good_client(struct sockaddr_in *addr
/* NOTE: we could use different servicename for setquota calls to
* allow only some hosts to call setquota. */
- /* Check IP address */
- if (hosts_ctl("rquotad", "", remote, ""))
- return 1;
- /* Get address */
- if (!(h = gethostbyaddr((const char *)&(addr->sin_addr), sizeof(addr->sin_addr), AF_INET)))
- goto denied;
- if (!(name = alloca(strlen(h->h_name)+1)))
- goto denied;
- strcpy(name, h->h_name);
- /* Try to resolve it back */
- if (!(h = gethostbyname(name)))
- goto denied;
- for (ad = h->h_addr_list; *ad; ad++)
- if (!memcmp(*ad, &(addr->sin_addr), h->h_length))
- break;
- if (!*ad) /* Our address not found? */
- goto denied;
- /* Check host name */
- if (hosts_ctl("rquotad", h->h_name, remote, ""))
+ request_init(&req, RQ_DAEMON, "rquotad", RQ_CLIENT_SIN, addr, 0);
+ sock_methods(&req);
+ if (hosts_access(&req))
return 1;
- /* Check aliases */
- for (ad = h->h_aliases; *ad; ad++)
- if (hosts_ctl("rquotad", *ad, remote, ""))
- return 1;
-denied:
errstr(_("Denied access to host %s\n"), remote);
return 0;
#else
Index: quota-tools/Makefile.in
===================================================================
--- quota-tools.orig/Makefile.in
+++ quota-tools/Makefile.in
@@ -37,6 +37,7 @@ mandir = @mandir@
includedir = $(prefix)/include
locale_dir = $(prefix)/share/locale
sysconfdir = @sysconfdir@
+datarootdir = @datarootdir@
RPCCLNTOBJS = rquota_xdr.o rquota_client.o rquota_clnt.o
IOOBJS = quotaio.o quotaio_v1.o quotaio_v2.o quotaio_rpc.o quotaio_xfs.o quotaio_meta.o quotaio_generic.o
Index: quota-tools/configure.in
===================================================================
--- quota-tools.orig/configure.in
+++ quota-tools/configure.in
@@ -1,5 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(quota.c)
+AC_CONFIG_HEADERS([config.h])
dnl Checks for programs.
AC_PROG_CC