summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2001-04-28 04:26:32 +0000
committeralfred <alfred@FreeBSD.org>2001-04-28 04:26:32 +0000
commitface62a8a5cd57d2cf9390b709171c0ba67332e3 (patch)
treea5bbbcec78ebda3e585835ed23d818fa47fd48ac
parent5896ccceecc22b3aa1a4a44da2a5a532d61cc16a (diff)
downloadFreeBSD-src-face62a8a5cd57d2cf9390b709171c0ba67332e3.zip
FreeBSD-src-face62a8a5cd57d2cf9390b709171c0ba67332e3.tar.gz
Distinguish between rpc version numbers in the client cache to avoid
replying on the wrong port.
-rw-r--r--usr.sbin/rpc.lockd/lock_proc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.sbin/rpc.lockd/lock_proc.c b/usr.sbin/rpc.lockd/lock_proc.c
index 4dbb6dc..389baf6 100644
--- a/usr.sbin/rpc.lockd/lock_proc.c
+++ b/usr.sbin/rpc.lockd/lock_proc.c
@@ -119,6 +119,7 @@ log_from_addr(fun_name, req)
static CLIENT *clnt_cache_ptr[CLIENT_CACHE_SIZE];
static long clnt_cache_time[CLIENT_CACHE_SIZE]; /* time entry created */
static struct sockaddr_storage clnt_cache_addr[CLIENT_CACHE_SIZE];
+static rpcvers_t clnt_cache_vers[CLIENT_CACHE_SIZE];
static int clnt_cache_next_to_use = 0;
static int
@@ -181,7 +182,7 @@ get_client(host_addr, vers)
client = NULL;
}
if (client && !addrcmp((struct sockaddr *)&clnt_cache_addr[i],
- host_addr)) {
+ host_addr) && clnt_cache_vers[i] == vers) {
/* Found it! */
if (debug_level > 3)
syslog(LOG_DEBUG, "Found CLIENT* in cache");
@@ -189,6 +190,9 @@ get_client(host_addr, vers)
}
}
+ if (debug_level > 3)
+ syslog(LOG_DEBUG, "CLIENT* not found in cache, creating");
+
/* Not found in cache. Free the next entry if it is in use. */
if (clnt_cache_ptr[clnt_cache_next_to_use]) {
clnt_destroy(clnt_cache_ptr[clnt_cache_next_to_use]);
@@ -236,6 +240,7 @@ get_client(host_addr, vers)
clnt_cache_ptr[clnt_cache_next_to_use] = client;
memcpy(&clnt_cache_addr[clnt_cache_next_to_use], host_addr,
host_addr->sa_len);
+ clnt_cache_vers[clnt_cache_next_to_use] = vers;
clnt_cache_time[clnt_cache_next_to_use] = time_now.tv_sec;
if (++clnt_cache_next_to_use > CLIENT_CACHE_SIZE)
clnt_cache_next_to_use = 0;
OpenPOWER on IntegriCloud