summaryrefslogtreecommitdiff
path: root/contrib/amd/fixmount
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>2007-12-05 15:48:03 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>2007-12-05 15:48:03 +0000
commitad8bcc147f76709838923b5f73e352c06231e91f (patch)
treefa83b3bb0660890a21b550fa1f334b151bf098f9 /contrib/amd/fixmount
parenta64b8e069370d29a84c68bdc0738a27326e33382 (diff)
Notes
Diffstat (limited to 'contrib/amd/fixmount')
-rw-r--r--contrib/amd/fixmount/fixmount.826
-rw-r--r--contrib/amd/fixmount/fixmount.c28
2 files changed, 34 insertions, 20 deletions
diff --git a/contrib/amd/fixmount/fixmount.8 b/contrib/amd/fixmount/fixmount.8
index 4fa41d56a32a..e4b700b9eebf 100644
--- a/contrib/amd/fixmount/fixmount.8
+++ b/contrib/amd/fixmount/fixmount.8
@@ -1,5 +1,5 @@
.\"
-.\" Copyright (c) 1997-2004 Erez Zadok
+.\" Copyright (c) 1997-2006 Erez Zadok
.\" Copyright (c) 1990 Jan-Simon Pendry
.\" Copyright (c) 1990 Imperial College of Science, Technology & Medicine
.\" Copyright (c) 1990 The Regents of the University of California.
@@ -38,7 +38,7 @@
.\"
.\" %W% (Berkeley) %G%
.\"
-.\" $Id: fixmount.8,v 1.3.2.6 2004/01/06 03:15:23 ezk Exp $
+.\" $Id: fixmount.8,v 1.12.2.1 2006/01/02 18:48:25 ezk Exp $
.\"
.TH FIXMOUNT 8 "26 Feb 1993"
.SH NAME
@@ -111,19 +111,28 @@ only.
This option also saves time as comparisons of remotely recorded and local
hostnames by address are avoided.
.SH FILES
-.PD 0
.TP 20
.B /etc/mtab
List of current mounts.
.TP
.B /etc/rmtab
Backup file for remote mount entries on NFS server.
-.PD
.SH "SEE ALSO"
.BR showmount (8),
.BR mtab (5),
.BR rmtab (5),
.BR mountd (8C).
+.LP
+``am-utils''
+.BR info (1)
+entry.
+.LP
+.I "Linux NFS and Automounter Administration"
+by Erez Zadok, ISBN 0-7821-2739-8, (Sybex, 2001).
+.LP
+.I http://www.am-utils.org
+.LP
+.I "Amd \- The 4.4 BSD Automounter"
.SH BUGS
No attempt is made to verify the information in
.B /etc/mtab
@@ -157,3 +166,12 @@ the remote /etc/rmtab file has to be edited and mountd restarted.
The RPC timeouts for mountd calls can only be changed by recompiling.
The defaults are 2 seconds for client handle creation and 5 seconds for
RPC calls.
+.SH AUTHORS
+Andreas Stolcke <stolcke@icsi.berkeley.edu>.
+.P
+Erez Zadok <ezk@cs.sunysb.edu>, Computer Science Department, Stony Brook
+University, Stony Brook, New York, USA.
+.P
+Other authors and contributors to am-utils are listed in the
+.B AUTHORS
+file distributed with am-utils.
diff --git a/contrib/amd/fixmount/fixmount.c b/contrib/amd/fixmount/fixmount.c
index 058c30f5003c..c7c69102a55b 100644
--- a/contrib/amd/fixmount/fixmount.c
+++ b/contrib/amd/fixmount/fixmount.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997-2004 Erez Zadok
+ * Copyright (c) 1997-2006 Erez Zadok
* Copyright (c) 1990 Jan-Simon Pendry
* Copyright (c) 1990 Imperial College of Science, Technology & Medicine
* Copyright (c) 1990 The Regents of the University of California.
@@ -36,9 +36,8 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * %W% (Berkeley) %G%
*
- * $Id: fixmount.c,v 1.5.2.4 2004/01/06 03:15:23 ezk Exp $
+ * File: am-utils/fixmount/fixmount.c
*
*/
@@ -50,10 +49,6 @@
#define CREATE_TIMEOUT 2 /* seconds */
#define CALL_TIMEOUT 5 /* seconds */
-#ifndef INADDR_NONE
-# define INADDR_NONE 0xffffffff
-#endif /* not INADDR_NONE */
-
/* Constant defs */
#define ALL 1
#define DIRS 2
@@ -120,7 +115,7 @@ is_same_host(char *name1, char *name2, struct in_addr addr2)
} else if (!(he = gethostbyname(name1))) {
return 0;
} else {
- strncpy(lasthost, name1, sizeof(lasthost) - 1);
+ xstrlcpy(lasthost, name1, MAXHOSTNAMELEN);
memcpy(&addr1, he->h_addr, sizeof(addr1));
return (addr1.s_addr == addr2.s_addr);
}
@@ -164,7 +159,7 @@ remove_mount(CLIENT *client, char *host, mountlist ml, int fixit)
struct timeval tv;
char *pathp = dir_path;
- strncpy(dir_path, ml->ml_directory, sizeof(dir_path));
+ xstrlcpy(dir_path, ml->ml_directory, sizeof(dir_path));
if (!fixit) {
printf("%s: bogus mount %s:%s\n", host, ml->ml_hostname, ml->ml_directory);
@@ -326,8 +321,7 @@ main(int argc, char *argv[])
break;
case 'h':
- strncpy(thishost, optarg, sizeof(thishost));
- thishost[sizeof(thishost) - 1] = '\0';
+ xstrlcpy(thishost, optarg, sizeof(thishost));
break;
case '?':
@@ -367,8 +361,7 @@ main(int argc, char *argv[])
inet_ntoa(thisaddr));
exit(1);
}
- strncpy(thishost, he->h_name, sizeof(thishost));
- thishost[sizeof(thishost) - 1] = '\0';
+ xstrlcpy(thishost, he->h_name, sizeof(thishost));
} else {
thisaddr.s_addr = INADDR_NONE;
}
@@ -497,8 +490,10 @@ inetresport(int ty)
struct sockaddr_in addr;
int fd;
- /* Use internet address family */
- addr.sin_family = AF_INET;
+ memset(&addr, 0, sizeof(addr));
+ /* as per POSIX, sin_len need not be set (used internally by kernel) */
+
+ addr.sin_family = AF_INET; /* use internet address family */
addr.sin_addr.s_addr = INADDR_ANY;
if ((fd = socket(AF_INET, ty, 0)) < 0)
return -1;
@@ -568,7 +563,8 @@ clnt_create_timeout(char *host, struct timeval *tvp)
fprintf(stderr, "can't get address of %s\n", host);
return NULL;
}
- memset(&host_addr, 0, sizeof host_addr);
+ memset(&host_addr, 0, sizeof(host_addr));
+ /* as per POSIX, sin_len need not be set (used internally by kernel) */
host_addr.sin_family = AF_INET;
if (hp) {
memmove((voidp) &host_addr.sin_addr, (voidp) hp->h_addr,