All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Mayhew <smayhew@redhat.com>
To: steved@redhat.com
Cc: linux-nfs@vger.kernel.org
Subject: [nfs-utils PATCH] exportfs: fix path comparison in unexportfs_parsed()
Date: Thu, 15 Dec 2016 14:37:21 -0500	[thread overview]
Message-ID: <1481830641-15595-1-git-send-email-smayhew@redhat.com> (raw)

Passing a path like /export1 to unexportfs_parsed() matches not only
/export1, but /export11, /export100, /export1forthemoney, etc. which can
result in some nasty surprises when unexporting individual exports.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
 utils/exportfs/exportfs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
index b7a910e..a763272 100644
--- a/utils/exportfs/exportfs.c
+++ b/utils/exportfs/exportfs.c
@@ -345,6 +345,8 @@ unexportfs_parsed(char *hname, char *path, int verbose)
 		nlen--;
 
 	for (exp = exportlist[htype].p_head; exp; exp = exp->m_next) {
+		if (strlen(exp->m_export.e_path) != nlen)
+			continue;
 		if (path && strncmp(path, exp->m_export.e_path, nlen))
 			continue;
 		if (htype != exp->m_client->m_type)
-- 
2.7.4


             reply	other threads:[~2016-12-15 19:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-15 19:37 Scott Mayhew [this message]
2016-12-17 18:43 ` [nfs-utils PATCH] exportfs: fix path comparison in unexportfs_parsed() 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=1481830641-15595-1-git-send-email-smayhew@redhat.com \
    --to=smayhew@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=steved@redhat.com \
    /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.