mountd(8): Produce vaguely meaningful error messages
Sponsored by: Dell EMC Isilon
This commit is contained in:
parent
f849badfe4
commit
354fce2869
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=329009
@ -201,7 +201,7 @@ static struct hostlist *get_ht(void);
|
||||
static int get_line(void);
|
||||
static void get_mountlist(void);
|
||||
static int get_net(char *, struct netmsk *, int);
|
||||
static void getexp_err(struct exportlist *, struct grouplist *);
|
||||
static void getexp_err(struct exportlist *, struct grouplist *, const char *);
|
||||
static struct grouplist *get_grp(void);
|
||||
static void hang_dirp(struct dirlist *, struct grouplist *,
|
||||
struct exportlist *, int);
|
||||
@ -1450,12 +1450,13 @@ get_exportlist_one(void)
|
||||
tgrp = grp = get_grp();
|
||||
while (len > 0) {
|
||||
if (len > MNTNAMLEN) {
|
||||
getexp_err(ep, tgrp);
|
||||
getexp_err(ep, tgrp, "mountpoint too long");
|
||||
goto nextline;
|
||||
}
|
||||
if (*cp == '-') {
|
||||
if (ep == (struct exportlist *)NULL) {
|
||||
getexp_err(ep, tgrp);
|
||||
getexp_err(ep, tgrp,
|
||||
"flag before export path definition");
|
||||
goto nextline;
|
||||
}
|
||||
if (debug)
|
||||
@ -1463,7 +1464,7 @@ get_exportlist_one(void)
|
||||
got_nondir = 1;
|
||||
if (do_opt(&cp, &endcp, ep, grp, &has_host,
|
||||
&exflags, &anon)) {
|
||||
getexp_err(ep, tgrp);
|
||||
getexp_err(ep, tgrp, NULL);
|
||||
goto nextline;
|
||||
}
|
||||
} else if (*cp == '/') {
|
||||
@ -1471,8 +1472,7 @@ get_exportlist_one(void)
|
||||
*endcp = '\0';
|
||||
if (v4root_phase > 1) {
|
||||
if (dirp != NULL) {
|
||||
syslog(LOG_ERR, "Multiple V4 dirs");
|
||||
getexp_err(ep, tgrp);
|
||||
getexp_err(ep, tgrp, "Multiple V4 dirs");
|
||||
goto nextline;
|
||||
}
|
||||
}
|
||||
@ -1482,14 +1482,12 @@ get_exportlist_one(void)
|
||||
syslog(LOG_ERR, "Warning: exporting of "
|
||||
"automounted fs %s not supported", cp);
|
||||
if (got_nondir) {
|
||||
syslog(LOG_ERR, "dirs must be first");
|
||||
getexp_err(ep, tgrp);
|
||||
getexp_err(ep, tgrp, "dirs must be first");
|
||||
goto nextline;
|
||||
}
|
||||
if (v4root_phase == 1) {
|
||||
if (dirp != NULL) {
|
||||
syslog(LOG_ERR, "Multiple V4 dirs");
|
||||
getexp_err(ep, tgrp);
|
||||
getexp_err(ep, tgrp, "Multiple V4 dirs");
|
||||
goto nextline;
|
||||
}
|
||||
if (strlen(v4root_dirpath) == 0) {
|
||||
@ -1499,7 +1497,7 @@ get_exportlist_one(void)
|
||||
!= 0) {
|
||||
syslog(LOG_ERR,
|
||||
"different V4 dirpath %s", cp);
|
||||
getexp_err(ep, tgrp);
|
||||
getexp_err(ep, tgrp, NULL);
|
||||
goto nextline;
|
||||
}
|
||||
dirp = cp;
|
||||
@ -1512,7 +1510,8 @@ get_exportlist_one(void)
|
||||
fsb.f_fsid.val[0] ||
|
||||
ep->ex_fs.val[1] !=
|
||||
fsb.f_fsid.val[1]) {
|
||||
getexp_err(ep, tgrp);
|
||||
getexp_err(ep, tgrp,
|
||||
"fsid mismatch");
|
||||
goto nextline;
|
||||
}
|
||||
} else {
|
||||
@ -1545,7 +1544,8 @@ get_exportlist_one(void)
|
||||
dirplen = len;
|
||||
}
|
||||
} else {
|
||||
getexp_err(ep, tgrp);
|
||||
getexp_err(ep, tgrp,
|
||||
"symbolic link in export path or statfs failed");
|
||||
goto nextline;
|
||||
}
|
||||
*endcp = savedc;
|
||||
@ -1554,7 +1554,8 @@ get_exportlist_one(void)
|
||||
*endcp = '\0';
|
||||
got_nondir = 1;
|
||||
if (ep == (struct exportlist *)NULL) {
|
||||
getexp_err(ep, tgrp);
|
||||
getexp_err(ep, tgrp,
|
||||
"host(s) before export path definition");
|
||||
goto nextline;
|
||||
}
|
||||
|
||||
@ -1592,7 +1593,7 @@ get_exportlist_one(void)
|
||||
len = endcp - cp;
|
||||
}
|
||||
if (check_options(dirhead)) {
|
||||
getexp_err(ep, tgrp);
|
||||
getexp_err(ep, tgrp, NULL);
|
||||
goto nextline;
|
||||
}
|
||||
if (!has_host) {
|
||||
@ -1605,8 +1606,7 @@ get_exportlist_one(void)
|
||||
* host(s) on the same line.
|
||||
*/
|
||||
} else if ((opt_flags & OP_NET) && tgrp->gr_next) {
|
||||
syslog(LOG_ERR, "network/host conflict");
|
||||
getexp_err(ep, tgrp);
|
||||
getexp_err(ep, tgrp, "network/host conflict");
|
||||
goto nextline;
|
||||
|
||||
/*
|
||||
@ -1618,14 +1618,13 @@ get_exportlist_one(void)
|
||||
while (grp && grp->gr_type == GT_IGNORE)
|
||||
grp = grp->gr_next;
|
||||
if (! grp) {
|
||||
getexp_err(ep, tgrp);
|
||||
getexp_err(ep, tgrp, "no valid entries");
|
||||
goto nextline;
|
||||
}
|
||||
}
|
||||
|
||||
if (v4root_phase == 1) {
|
||||
syslog(LOG_ERR, "V4:root, no dirp, ignored");
|
||||
getexp_err(ep, tgrp);
|
||||
getexp_err(ep, tgrp, "V4:root, no dirp, ignored");
|
||||
goto nextline;
|
||||
}
|
||||
|
||||
@ -1638,7 +1637,7 @@ get_exportlist_one(void)
|
||||
do {
|
||||
if (do_mount(ep, grp, exflags, &anon, dirp, dirplen,
|
||||
&fsb)) {
|
||||
getexp_err(ep, tgrp);
|
||||
getexp_err(ep, tgrp, NULL);
|
||||
goto nextline;
|
||||
}
|
||||
} while (grp->gr_next && (grp = grp->gr_next));
|
||||
@ -1880,12 +1879,17 @@ get_grp(void)
|
||||
* Clean up upon an error in get_exportlist().
|
||||
*/
|
||||
static void
|
||||
getexp_err(struct exportlist *ep, struct grouplist *grp)
|
||||
getexp_err(struct exportlist *ep, struct grouplist *grp, const char *reason)
|
||||
{
|
||||
struct grouplist *tgrp;
|
||||
|
||||
if (!(opt_flags & OP_QUIET))
|
||||
syslog(LOG_ERR, "bad exports list line %s", line);
|
||||
if (!(opt_flags & OP_QUIET)) {
|
||||
if (reason != NULL)
|
||||
syslog(LOG_ERR, "bad exports list line '%s': %s", line,
|
||||
reason);
|
||||
else
|
||||
syslog(LOG_ERR, "bad exports list line '%s'", line);
|
||||
}
|
||||
if (ep && (ep->ex_flag & EX_LINKED) == 0)
|
||||
free_exp(ep);
|
||||
while (grp) {
|
||||
|
Loading…
Reference in New Issue
Block a user