From: Steve Dickson <steved@redhat.com>
To: Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: [PATCH 3/3] mountd: Return ENOENT when an export does not exist.
Date: Mon, 26 Nov 2012 15:17:09 -0500 [thread overview]
Message-ID: <1353961029-6317-3-git-send-email-steved@redhat.com> (raw)
In-Reply-To: <1353961029-6317-1-git-send-email-steved@redhat.com>
When an export does not exist, ENOENT should be
returned instead of EACCES
Signed-off-by: Steve Dickson <steved@redhat.com>
---
utils/mountd/auth.c | 11 ++++++++++-
utils/mountd/mountd.c | 5 ++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/utils/mountd/auth.c b/utils/mountd/auth.c
index 508040a..c81c3a8 100644
--- a/utils/mountd/auth.c
+++ b/utils/mountd/auth.c
@@ -232,7 +232,7 @@ auth_authenticate(const char *what, const struct sockaddr *caller,
char *p = NULL;
char buf[INET6_ADDRSTRLEN];
struct addrinfo *ai = NULL;
- enum auth_error error = bad_path;
+ enum auth_error error = bad_path, first_error = success;
if (path[0] != '/') {
xlog(L_WARNING, "Bad path in %s request from %s: \"%s\"",
@@ -258,7 +258,15 @@ auth_authenticate(const char *what, const struct sockaddr *caller,
p = strrchr(epath, '/');
if (p == epath) p++;
*p = '\0';
+ /*
+ * Recored the first error, ignoring the error when "/"
+ * is tried and fails
+ */
+ if (first_error == success)
+ first_error = error;
}
+ if (first_error != success)
+ error = first_error;
switch (error) {
case bad_path:
@@ -277,6 +285,7 @@ auth_authenticate(const char *what, const struct sockaddr *caller,
break;
case not_exported:
+ errno = ENOENT;
xlog(L_WARNING, "refused %s request from %s for %s (%s): not exported",
what, ai->ai_canonname, path, epath);
break;
diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c
index 993b6e6..efd4b49 100644
--- a/utils/mountd/mountd.c
+++ b/utils/mountd/mountd.c
@@ -472,7 +472,10 @@ get_rootfh(struct svc_req *rqstp, dirpath *path, nfs_export **expret,
/* Now authenticate the intruder... */
exp = auth_authenticate("mount", sap, p);
if (exp == NULL) {
- *error = MNT3ERR_ACCES;
+ if (errno == ENOENT)
+ *error = MNT3ERR_NOENT;
+ else
+ *error = MNT3ERR_ACCES;
return NULL;
}
if (stat(p, &stb) < 0) {
--
1.7.11.7
next prev parent reply other threads:[~2012-11-26 20:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-26 20:17 [PATCH 1/3] mount.nfs: Continue to trying address when the server return ENOENT Steve Dickson
2012-11-26 20:17 ` [PATCH 2/3] mount.nfs: error message clean up Steve Dickson
2012-11-26 20:17 ` Steve Dickson [this message]
2012-11-27 16:53 ` [PATCH 1/3] mount.nfs: Continue to trying address when the server return ENOENT Steve Dickson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1353961029-6317-3-git-send-email-steved@redhat.com \
--to=steved@redhat.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.