Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4440597ybi; Mon, 3 Jun 2019 10:54:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqweL42/MD2z10HqOH/+BPiITV/Rb9gaZOsyTheX5Q5JoTCknKffaPb0DW0vhgBqgFIjnn9v X-Received: by 2002:aa7:9159:: with SMTP id 25mr32759668pfi.64.1559584444842; Mon, 03 Jun 2019 10:54:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559584444; cv=none; d=google.com; s=arc-20160816; b=AnBTsr6rhC/PjrEYvhEKT9/hbZZQSHuN7EFMHE/tAY7TgjK4yFxmS+5PUcEZMSRM98 88tcjNRIY7Q2p4coddPARZZqZN6LxaAZCFeVsyBrEgK9KZshwOY+ryIXWeR0YLcKN8oN Et5anO8Qy6U5zHGrywYMqjsr678D0gNm0o8K04f9HZIEqMxq3KW2UwNcaThKK4NnwO5S b64Byb8YMHIzdaSY9CJEOat9NlnPbnpI3ocxke/zlX9U3eUzlWpbjqAz378cG1/UoUfC YbEBWrL/pYcOyqj4alTN8/HXmExvnbvupdmt2f/FxuFSwKWfexLavw5j2UN5w1xQ7dra chjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=j1UkUfTZsFI//kdDQAkgjA8sveaR01sXEVy3hYpGpgU=; b=uBp3iUWNXMccheNScKUnPwX0sNoa7w8hTHkX4CRLRnyEQ+vRTEjIvpQ3m4qzPFZMCh ifGNgzpvdGBAXDbWbwOQFJKluY0fUSHU6JNAbNBzDIdX6s0dyFarNuy2kL4/NlLm+0fV Vmq4eqEzb1XQkad/+l2N0vFW+bnHDJpBvUYT8zEE2+t6ezll5zNDJX6IgfjH5QqhFEmw lkNWbSkXZp6RrVMscyyG7LORxXY0N9qi7gpmtAvyEATd3YHsJIqDaO2WZiLls7ufeAmP kZgVwVtSrkUDKlEqL4y0G7bG+uaaZAWv43e/pSdnThthYZjK0Q9iQeCaRZmtG4meRwud xjBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=O+PWbM4X; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x12si17257313pll.438.2019.06.03.10.53.50; Mon, 03 Jun 2019 10:54:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=O+PWbM4X; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729031AbfFCRP7 (ORCPT + 99 others); Mon, 3 Jun 2019 13:15:59 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:41254 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726823AbfFCRP6 (ORCPT ); Mon, 3 Jun 2019 13:15:58 -0400 Received: by mail-io1-f66.google.com with SMTP id w25so14926258ioc.8 for ; Mon, 03 Jun 2019 10:15:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=j1UkUfTZsFI//kdDQAkgjA8sveaR01sXEVy3hYpGpgU=; b=O+PWbM4X5IO/s7or71I4Nisp4D6ldT9VlOAVIMGioG4xDqAmF7IXYEQ1d1E8u+aX7R CAHFlj8LZgomtIi0XTt4AVICdFclpp2hhEgwuPbtRDuYnK8W85xF0AMT306NxpZRUjji VAeon4QPwE5oIYKfyUgjTOs5ZkaGcK8f7RZYMxBxxTVcVoaLc44n21YGCH+IRDvTjB3B sh65XncYpp2CsqYyl/sprfCekuKM9rkDkKTycRv6OUrb20XpfzLs+ZBKWRARjF4ERD+j Av0bzhwxKDKWPGj6+66er6SPppIos+ANEp/FtHZ3g+jtzHVRTSvlfJnks2rFTWkHZYPD YIog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=j1UkUfTZsFI//kdDQAkgjA8sveaR01sXEVy3hYpGpgU=; b=gtH0tNT5V9CIInvpCn3IsiN0qjLt7f/ZTOfV6n8ow0Nahp3FyLUqU6DxZ/ISkh2Ml4 dHMTMSHP0H2Ph+BghZ7n4gGJUnuL+ZlypFj4A2iQctuN3oSAFKTughVXm1+HaY3ILZrS +3ZijloE8opX3WnETkV8rpZZADK44VbC9ZU4S4iEaMowJJTq0co9YL1v6lJ8jp/d2AXR YCayCVOMsaemtQJqTYIbj+c7/i80l1wIAt3MVBggonuUPA+U5rGrdIbW1IIyX2WnVqhm JnbT27bzCvA0leAYx0T0TbmOkGxfvzuUGFkWj8j8RxfqQSFc/yzS3j+w0nhso5+jeRa4 SJgg== X-Gm-Message-State: APjAAAWIt2epoX+j4CY0LSPLvQY1NJOYwj0WFsVq4xvg1gPAA5mMwuNW x+AgVuk9oPjeJhCUDgWeAQAbd9s= X-Received: by 2002:a6b:7d49:: with SMTP id d9mr11490728ioq.50.1559582157600; Mon, 03 Jun 2019 10:15:57 -0700 (PDT) Received: from localhost.localdomain (50-36-175-138.alma.mi.frontiernet.net. [50.36.175.138]) by smtp.gmail.com with ESMTPSA id b8sm1971375ioj.16.2019.06.03.10.15.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Jun 2019 10:15:56 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Steve Dickson Cc: "J. Bruce Fields" , linux-nfs@vger.kernel.org Subject: [PATCH 3/3] mountd: Canonicalise the rootdir in exportent_mkrealpath() Date: Mon, 3 Jun 2019 13:12:27 -0400 Message-Id: <20190603171227.29148-4-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190603171227.29148-3-trond.myklebust@hammerspace.com> References: <20190603171227.29148-1-trond.myklebust@hammerspace.com> <20190603171227.29148-2-trond.myklebust@hammerspace.com> <20190603171227.29148-3-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Ensure that we canonicalise the export path when generating the real path. Signed-off-by: Trond Myklebust --- support/export/export.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/support/export/export.c b/support/export/export.c index 82bbb54c5e9e..c753f68e4d63 100644 --- a/support/export/export.c +++ b/support/export/export.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -21,6 +22,7 @@ #include "nfslib.h" #include "exportfs.h" #include "nfsd_path.h" +#include "xlog.h" exp_hash_table exportlist[MCL_MAXTYPES] = {{NULL, {{NULL,NULL}, }}, }; static int export_hash(char *); @@ -38,8 +40,14 @@ exportent_mkrealpath(struct exportent *eep) const char *chroot = nfsd_path_nfsd_rootdir(); char *ret = NULL; - if (chroot) - ret = nfsd_path_prepend_dir(chroot, eep->e_path); + if (chroot) { + char buffer[PATH_MAX]; + if (realpath(chroot, buffer)) + ret = nfsd_path_prepend_dir(buffer, eep->e_path); + else + xlog(D_GENERAL, "%s: failed to resolve path %s: %m", + __func__, chroot); + } if (!ret) ret = xstrdup(eep->e_path); eep->e_realpath = ret; -- 2.21.0