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>
This commit is contained in:
Alfred Perlstein 1999-10-06 18:20:44 +00:00
parent 4085cc2dee
commit cb479b1136
2 changed files with 22 additions and 4 deletions

View File

@ -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;

View File

@ -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;