|
|
ca5a1da |
Author: Steve Dickson <steved@redhat.com>
|
|
|
ca5a1da |
Date: Sat Jan 31 05:30:13 2009 -0500
|
|
|
ca5a1da |
|
|
|
ca5a1da |
Only hash on IP address and Program number. Including the Procedure
|
|
|
ca5a1da |
number only creates needles extra hash entries.
|
|
|
ca5a1da |
|
|
|
ca5a1da |
Signed-off-by: Steve Dickson <steved@redhat.com>
|
|
|
ca5a1da |
|
|
|
ca5a1da |
diff -up nfs-utils-1.1.4/support/misc/tcpwrapper.c.orig nfs-utils-1.1.4/support/misc/tcpwrapper.c
|
|
|
ca5a1da |
--- nfs-utils-1.1.4/support/misc/tcpwrapper.c.orig 2009-01-31 06:22:35.000000000 -0500
|
|
|
ca5a1da |
+++ nfs-utils-1.1.4/support/misc/tcpwrapper.c 2009-01-31 06:23:22.000000000 -0500
|
|
|
ca5a1da |
@@ -106,8 +106,8 @@ typedef struct _hash_head {
|
|
|
ca5a1da |
TAILQ_HEAD(host_list, _haccess_t) h_head;
|
|
|
ca5a1da |
} hash_head;
|
|
|
ca5a1da |
hash_head haccess_tbl[HASH_TABLE_SIZE];
|
|
|
ca5a1da |
-static haccess_t *haccess_lookup(struct sockaddr_in *addr, u_long, u_long);
|
|
|
ca5a1da |
-static void haccess_add(struct sockaddr_in *addr, u_long, u_long, int);
|
|
|
ca5a1da |
+static haccess_t *haccess_lookup(struct sockaddr_in *addr, u_long);
|
|
|
ca5a1da |
+static void haccess_add(struct sockaddr_in *addr, u_long, int);
|
|
|
ca5a1da |
|
|
|
ca5a1da |
inline unsigned int strtoint(char *str)
|
|
|
ca5a1da |
{
|
|
|
ca5a1da |
@@ -124,11 +124,10 @@ inline int hashint(unsigned int num)
|
|
|
ca5a1da |
{
|
|
|
ca5a1da |
return num % HASH_TABLE_SIZE;
|
|
|
ca5a1da |
}
|
|
|
ca5a1da |
-#define HASH(_addr, _proc, _prog) \
|
|
|
ca5a1da |
- hashint((strtoint((_addr))+(_proc)+(_prog)))
|
|
|
ca5a1da |
+#define HASH(_addr, _prog) \
|
|
|
ca5a1da |
+ hashint((strtoint((_addr))+(_prog)))
|
|
|
ca5a1da |
|
|
|
ca5a1da |
-void haccess_add(struct sockaddr_in *addr, u_long proc,
|
|
|
ca5a1da |
- u_long prog, int access)
|
|
|
ca5a1da |
+void haccess_add(struct sockaddr_in *addr, u_long prog, int access)
|
|
|
ca5a1da |
{
|
|
|
ca5a1da |
hash_head *head;
|
|
|
ca5a1da |
haccess_t *hptr;
|
|
|
ca5a1da |
@@ -138,7 +137,7 @@ void haccess_add(struct sockaddr_in *add
|
|
|
ca5a1da |
if (hptr == NULL)
|
|
|
ca5a1da |
return;
|
|
|
ca5a1da |
|
|
|
ca5a1da |
- hash = HASH(inet_ntoa(addr->sin_addr), proc, prog);
|
|
|
ca5a1da |
+ hash = HASH(inet_ntoa(addr->sin_addr), prog);
|
|
|
ca5a1da |
head = &(haccess_tbl[hash]);
|
|
|
ca5a1da |
|
|
|
ca5a1da |
hptr->access = access;
|
|
|
ca5a1da |
@@ -149,13 +148,13 @@ void haccess_add(struct sockaddr_in *add
|
|
|
ca5a1da |
else
|
|
|
ca5a1da |
TAILQ_INSERT_TAIL(&head->h_head, hptr, list);
|
|
|
ca5a1da |
}
|
|
|
ca5a1da |
-haccess_t *haccess_lookup(struct sockaddr_in *addr, u_long proc, u_long prog)
|
|
|
ca5a1da |
+haccess_t *haccess_lookup(struct sockaddr_in *addr, u_long prog)
|
|
|
ca5a1da |
{
|
|
|
ca5a1da |
hash_head *head;
|
|
|
ca5a1da |
haccess_t *hptr;
|
|
|
ca5a1da |
int hash;
|
|
|
ca5a1da |
|
|
|
ca5a1da |
- hash = HASH(inet_ntoa(addr->sin_addr), proc, prog);
|
|
|
ca5a1da |
+ hash = HASH(inet_ntoa(addr->sin_addr), prog);
|
|
|
ca5a1da |
head = &(haccess_tbl[hash]);
|
|
|
ca5a1da |
|
|
|
ca5a1da |
TAILQ_FOREACH(hptr, &head->h_head, list) {
|
|
|
ca5a1da |
@@ -300,7 +299,7 @@ u_long prog;
|
|
|
ca5a1da |
haccess_t *acc = NULL;
|
|
|
ca5a1da |
int changed = check_files();
|
|
|
ca5a1da |
|
|
|
ca5a1da |
- acc = haccess_lookup(addr, proc, prog);
|
|
|
ca5a1da |
+ acc = haccess_lookup(addr, prog);
|
|
|
ca5a1da |
if (acc && changed == 0)
|
|
|
ca5a1da |
return (acc->access);
|
|
|
ca5a1da |
|
|
|
ca5a1da |
@@ -309,7 +308,7 @@ u_long prog;
|
|
|
ca5a1da |
if (acc)
|
|
|
ca5a1da |
acc->access = FALSE;
|
|
|
ca5a1da |
else
|
|
|
ca5a1da |
- haccess_add(addr, proc, prog, FALSE);
|
|
|
ca5a1da |
+ haccess_add(addr, prog, FALSE);
|
|
|
ca5a1da |
return (FALSE);
|
|
|
ca5a1da |
}
|
|
|
ca5a1da |
if (verboselog)
|
|
|
ca5a1da |
@@ -318,7 +317,7 @@ u_long prog;
|
|
|
ca5a1da |
if (acc)
|
|
|
ca5a1da |
acc->access = TRUE;
|
|
|
ca5a1da |
else
|
|
|
ca5a1da |
- haccess_add(addr, proc, prog, TRUE);
|
|
|
ca5a1da |
+ haccess_add(addr, prog, TRUE);
|
|
|
ca5a1da |
return (TRUE);
|
|
|
ca5a1da |
}
|
|
|
ca5a1da |
|