From 53193e5abdaaa7e4433ef00fbd4730e5bca36486 Mon Sep 17 00:00:00 2001 From: Erez Zadok Date: Mon, 11 Jul 2005 01:55:28 +0000 Subject: [PATCH] * amd/srvr_nfs.c (find_nfs_srvr): flush NFS handle cache if the IP address of a down server had changed. * amd/info_union.c (union_reload): use safer xsnprintf() routine. --- ChangeLog | 5 +++++ NEWS | 1 + amd/info_union.c | 7 ++++--- amd/srvr_nfs.c | 5 +++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index db1535a1..67c3892d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2005-07-10 Erez Zadok + * amd/srvr_nfs.c (find_nfs_srvr): flush NFS handle cache if the IP + address of a down server had changed. + + * amd/info_union.c (union_reload): use safer xsnprintf() routine. + * amd/srvr_nfs.c (find_nfs_srvr): check to see if the IP address of a named but down fserver changed (i.e., the previous IP address is no longer responding). If so, then reset the fserver to the diff --git a/NEWS b/NEWS index a5e17fbd..65318072 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,7 @@ * buffer overflow in pawd. * aix4 clean build. * use strlcat/snprintf in a few places for safety. + * recover from IP address change of a down NFS server *** Notes specific to am-utils version 6.1 diff --git a/amd/info_union.c b/amd/info_union.c index e4a8f0bf..3c69d3ac 100644 --- a/amd/info_union.c +++ b/amd/info_union.c @@ -37,7 +37,7 @@ * SUCH DAMAGE. * * - * $Id: info_union.c,v 1.11 2005/02/17 03:37:42 ezk Exp $ + * $Id: info_union.c,v 1.12 2005/07/11 01:55:28 ezk Exp $ * */ @@ -133,9 +133,10 @@ union_reload(mnt_map *m, char *map, void (*fn) (mnt_map *, char *, char *)) * Add wildcard entry */ { - char *val = xmalloc(strlen(*(dir-1)) + 5); + size_t len = strlen(*(dir-1)) + 5; + char *val = xmalloc(len); - sprintf(val, "fs:=%s", *(dir-1)); + xsnprintf(val, len, "fs:=%s", *(dir-1)); (*fn) (m, strdup("*"), val); } XFREE(mapd); diff --git a/amd/srvr_nfs.c b/amd/srvr_nfs.c index 49b3f763..2e8dadfd 100644 --- a/amd/srvr_nfs.c +++ b/amd/srvr_nfs.c @@ -37,7 +37,7 @@ * SUCH DAMAGE. * * - * $Id: srvr_nfs.c,v 1.40 2005/07/10 21:41:48 ezk Exp $ + * $Id: srvr_nfs.c,v 1.41 2005/07/11 01:55:28 ezk Exp $ * */ @@ -635,7 +635,7 @@ find_nfs_srvr(mntfs *mf) int pingval; mntent_t mnt; nfs_private *np; - struct hostent *hp = 0; + struct hostent *hp = NULL; struct sockaddr_in *ip = NULL; u_long nfs_version = 0; /* default is no version specified */ u_long best_nfs_version = 0; @@ -769,6 +769,7 @@ find_nfs_srvr(mntfs *mf) sizeof(ip->sin_addr)); fs->fs_flags |= FSF_VALID; fs->fs_flags &= ~(FSF_DOWN|FSF_ERROR); + flush_nfs_fhandle_cache(fs); /* XXX: safer, but really needed? */ /* fall through to checking available NFS protocols, pinging, etc. */ } else { /* server was down and is still down. Not much we can do. */ -- 2.43.0