-.\" $NetBSD: mountd.8,v 1.9 1995/03/18 14:58:30 cgd Exp $
+.\" $NetBSD: mountd.8,v 1.10 1995/11/06 07:00:14 thorpej Exp $
.\"
.\" Copyright (c) 1989, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
mount requests
.Sh SYNOPSIS
.Nm /sbin/mountd
-.Op Fl n
+.Op Fl dn
.Op Ar exportsfile
.Sh DESCRIPTION
.Xr Mountd
Options and operands available for
.Nm mountd :
.Bl -tag -width Ds
+.It Fl d
+Enable debugging mode.
+.Xr Mountd
+will not detach from the controlling terminal and will print
+debugging messages to stderr.
.It Fl n
Do not require that clients make mount requests from reserved ports.
(Normally, only mount requsts from reserved ports are accepted.)
-/* $NetBSD: mountd.c,v 1.27.2.1 1995/11/01 00:06:22 jtc Exp $ */
+/* $NetBSD: mountd.c,v 1.30 1995/11/28 05:25:47 jtc Exp $ */
/*
* Copyright (c) 1989, 1993
#if 0
static char sccsid[] = "@(#)mountd.c 8.8 (Berkeley) 2/20/94";
#else
-static char rcsid[] = "$NetBSD: mountd.c,v 1.27.2.1 1995/11/01 00:06:22 jtc Exp $";
+static char rcsid[] = "$NetBSD: mountd.c,v 1.30 1995/11/28 05:25:47 jtc Exp $";
#endif
#endif /* not lint */
#include <unistd.h>
#include "pathnames.h"
-#ifdef DEBUG
#include <stdarg.h>
-#endif
/*
* Structures for keeping the mount list and export list
#define OP_ISO 0x20
#define OP_ALLDIRS 0x40
-#ifdef DEBUG
-int debug = 1;
-void SYSLOG __P((int, const char *, ...));
-#define syslog SYSLOG
-#else
int debug = 0;
-#endif
+void SYSLOG __P((int, const char *, ...));
/*
* Mountd server for NFS mount protocol as described in:
* NFS: Network File System Protocol Specification, RFC1094, Appendix A
* The optional arguments are the exports file name
* default: _PATH_EXPORTS
+ * "-d" to enable debugging
* and "-n" to allow nonroot mount.
*/
int
SVCXPRT *udptransp, *tcptransp;
int c;
- while ((c = getopt(argc, argv, "n")) != EOF)
+ while ((c = getopt(argc, argv, "dn")) != EOF)
switch (c) {
+ case 'd':
+ debug = 1;
+ break;
case 'n':
resvport_only = 0;
break;
default:
- fprintf(stderr, "Usage: mountd [-n] [export_file]\n");
+ fprintf(stderr, "Usage: mountd [-dn] [export_file]\n");
exit(1);
};
argc -= optind;
free((caddr_t)grp);
}
-#ifdef DEBUG
void
SYSLOG(int pri, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
+
+ if (debug)
+ vfprintf(stderr, fmt, ap);
+ else
+ vsyslog(pri, fmt, ap);
+
va_end(ap);
}
-#endif /* DEBUG */
/*
* Check options for consistency.