aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfred Perlstein <alfred@FreeBSD.org>1999-10-06 18:20:44 +0000
committerAlfred Perlstein <alfred@FreeBSD.org>1999-10-06 18:20:44 +0000
commitcb479b1136ec42760b5f3706657cb41fc0605cdf (patch)
tree06fb3754e6c996e27bf7941b27f63e0b3923b26f
parent4085cc2dee47680825ae816d66414460906415c9 (diff)
downloadsrc-cb479b1136ec42760b5f3706657cb41fc0605cdf.tar.gz
src-cb479b1136ec42760b5f3706657cb41fc0605cdf.zip
Put the umount request through the same translation as the mount
request. Fix some uninitialized warnings and a style bug while we are here. Problem still exists where a failed umount can be misreported as success. Submitted by: Martin Blapp <mb@imp.ch>
Notes
Notes: svn path=/head/; revision=51968
-rw-r--r--sbin/mountd/mountd.c13
-rw-r--r--usr.sbin/mountd/mountd.c13
2 files changed, 22 insertions, 4 deletions
diff --git a/sbin/mountd/mountd.c b/sbin/mountd/mountd.c
index cc5e572d137c..3c8beb3b4544 100644
--- a/sbin/mountd/mountd.c
+++ b/sbin/mountd/mountd.c
@@ -413,7 +413,7 @@ mntsrv(rqstp, transp)
* or a regular file if the -r option was specified
* and it exists.
*/
- if (realpath(rpcpath, dirpath) == 0 ||
+ if (realpath(rpcpath, dirpath) == NULL ||
stat(dirpath, &stb) < 0 ||
(!S_ISDIR(stb.st_mode) &&
(dir_only || !S_ISREG(stb.st_mode))) ||
@@ -502,12 +502,17 @@ mntsrv(rqstp, transp)
svcerr_weakauth(transp);
return;
}
- if (!svc_getargs(transp, xdr_dir, dirpath)) {
+ if (!svc_getargs(transp, xdr_dir, rpcpath)) {
syslog(LOG_NOTICE, "undecodable umount request from %s",
inet_ntoa(saddrin));
svcerr_decode(transp);
return;
}
+ if (realpath(rpcpath, dirpath) == NULL) {
+ syslog(LOG_NOTICE, "umount request from %s "
+ "for non existent path %s",
+ inet_ntoa(saddrin), dirpath);
+ }
if (!svc_sendreply(transp, xdr_void, (caddr_t)NULL))
syslog(LOG_ERR, "can't send reply");
hp = gethostbyaddr((caddr_t)&saddr, sizeof(saddr), AF_INET);
@@ -745,6 +750,9 @@ get_exportlist()
char *cp, *endcp, *dirp, *hst, *usr, *dom, savedc;
int len, has_host, exflags, got_nondir, dirplen, num, i, netgrp;
+ dirp = NULL;
+ dirplen = 0;
+
/*
* First, get rid of the old list
*/
@@ -1342,6 +1350,7 @@ do_opt(cpp, endcpp, ep, grp, has_hostp, exflagsp, cr)
char *cp, *endcp, *cpopt, savedc, savedc2;
int allflag, usedarg;
+ savedc2 = '\0';
cpopt = *cpp;
cpopt++;
cp = *endcpp;
diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c
index cc5e572d137c..3c8beb3b4544 100644
--- a/usr.sbin/mountd/mountd.c
+++ b/usr.sbin/mountd/mountd.c
@@ -413,7 +413,7 @@ mntsrv(rqstp, transp)
* or a regular file if the -r option was specified
* and it exists.
*/
- if (realpath(rpcpath, dirpath) == 0 ||
+ if (realpath(rpcpath, dirpath) == NULL ||
stat(dirpath, &stb) < 0 ||
(!S_ISDIR(stb.st_mode) &&
(dir_only || !S_ISREG(stb.st_mode))) ||
@@ -502,12 +502,17 @@ mntsrv(rqstp, transp)
svcerr_weakauth(transp);
return;
}
- if (!svc_getargs(transp, xdr_dir, dirpath)) {
+ if (!svc_getargs(transp, xdr_dir, rpcpath)) {
syslog(LOG_NOTICE, "undecodable umount request from %s",
inet_ntoa(saddrin));
svcerr_decode(transp);
return;
}
+ if (realpath(rpcpath, dirpath) == NULL) {
+ syslog(LOG_NOTICE, "umount request from %s "
+ "for non existent path %s",
+ inet_ntoa(saddrin), dirpath);
+ }
if (!svc_sendreply(transp, xdr_void, (caddr_t)NULL))
syslog(LOG_ERR, "can't send reply");
hp = gethostbyaddr((caddr_t)&saddr, sizeof(saddr), AF_INET);
@@ -745,6 +750,9 @@ get_exportlist()
char *cp, *endcp, *dirp, *hst, *usr, *dom, savedc;
int len, has_host, exflags, got_nondir, dirplen, num, i, netgrp;
+ dirp = NULL;
+ dirplen = 0;
+
/*
* First, get rid of the old list
*/
@@ -1342,6 +1350,7 @@ do_opt(cpp, endcpp, ep, grp, has_hostp, exflagsp, cr)
char *cp, *endcp, *cpopt, savedc, savedc2;
int allflag, usedarg;
+ savedc2 = '\0';
cpopt = *cpp;
cpopt++;
cp = *endcpp;