Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp911266pxf; Wed, 7 Apr 2021 14:52:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwl07u/Lu12k+yI+sDeDrM0OcVlAvXWFpEz/WowDQE530ptqczRdQclT6MW8Gt0KUi0cdX1 X-Received: by 2002:a05:6402:2208:: with SMTP id cq8mr7076546edb.122.1617832328705; Wed, 07 Apr 2021 14:52:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617832328; cv=none; d=google.com; s=arc-20160816; b=GsIDnYcnwdP93S8ZYqAtSVU2oTmQcFaLfy5UZ2H1F3t4ONQvnBd7bxT7mnBnmyQovT J/MFQPGmzWf3GEhWiUpsfxDENZWiHRXNLUnbVdeeEXLvwAclNaKrFuI+sgm0bunGMPDO SVfH7Z9Xaqrf/cKK0yOZNXhEbMxut0nO26UxVngQj1d5TSWfqkzM+0R8+xGYXKSg++MT GNxh0GFqVBjQ3F1JMkYD/3yL23qwBHmCQ9sMDaDI4okgPNJNGzFIfhQ6taM6FjG5bQ4c PhWv5zpcY+xCNxKp7U0xq9rWxY+aEF7ZriORwPbuwhAdf5QrkOmu52GkcdhColNVorO+ Cl4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=Sa71qRprNwfgzLcPFVKiyVQP/xPLIdg7V1SGge3U7CY=; b=dES2qrpGlB01+CzwzLe5FCfiPbW1eFnlFDvvjtaZopiSzsrP2x8H7NhPsacs1oJGfp zKSorqTeqbIwoTfLlhh7CcmCOfDtIkrTCYwVOVlK2ge7Lnfb9vJZIF/MZiQqeATf6qw5 3dtQfHHI1ZlMvAIu7RuRiNbEinoFdJJE6c4Ea76ZrV/Yt9pf16WfEajtHJGbGTHsMDiJ Sy6dOniIFWQgDQsh+nlymirvByJX6FeJE4S4jVqDZJVRPKCVD6Rq/8xf6cpInSemteSm V7fK7Lo/ZJIy5v5s7NKDadNh7OPDUpKpvGNCdzWkiEO4KAWBr33JNAYTa4Ax20YaHCYg TY3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ENfGIkn9; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i6si20287227edu.313.2021.04.07.14.51.45; Wed, 07 Apr 2021 14:52:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ENfGIkn9; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355293AbhDGS2Q (ORCPT + 99 others); Wed, 7 Apr 2021 14:28:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:29327 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355247AbhDGS2O (ORCPT ); Wed, 7 Apr 2021 14:28:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617820084; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Sa71qRprNwfgzLcPFVKiyVQP/xPLIdg7V1SGge3U7CY=; b=ENfGIkn9pGIaxGmjshJXce94DFagcQ1hH40+mJEvYwR8O53Q3bQ+EA8P+EGfMZGdYWaxzm uomnv30jir2nwgvJbHtjkCWLD7xLO4MtJyj/ROYRNCCLbv40FMNihW287/YIqoMfRFBD1X 8RBQwprLfQ607DszkPbP/Ry0xgDgXQ8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-262-Vof35Xr4OEOKEVE1fhJkCw-1; Wed, 07 Apr 2021 14:28:02 -0400 X-MC-Unique: Vof35Xr4OEOKEVE1fhJkCw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 24A091006CBF for ; Wed, 7 Apr 2021 18:28:02 +0000 (UTC) Received: from madhat.boston.devel.redhat.com (ovpn-112-148.phx2.redhat.com [10.3.112.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id D3F525D9D0; Wed, 7 Apr 2021 18:28:01 +0000 (UTC) Subject: Re: [PATCH] exportfs: make root unexportable To: Roberto Bergantinos Corpas Cc: linux-nfs@vger.kernel.org References: <20210329105435.17431-1-rbergant@redhat.com> From: Steve Dickson Message-ID: Date: Wed, 7 Apr 2021 14:30:12 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210329105435.17431-1-rbergant@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Hello, On 3/29/21 6:54 AM, Roberto Bergantinos Corpas wrote: > If root of the filesystem is exported, it cannot be explicitly > unexported, since unexportfs_parsed, in order to deal with trailing > '/', will leave nlen at 0 for root exported case > > Signed-off-by: Roberto Bergantinos Corpas > --- > utils/exportfs/exportfs.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c > index 9fcae0b3..9b6f4f5a 100644 > --- a/utils/exportfs/exportfs.c > +++ b/utils/exportfs/exportfs.c > @@ -372,7 +372,7 @@ unexportfs_parsed(char *hname, char *path, int verbose) > * so need to deal with it. > */ > size_t nlen = strlen(path); > - while (path[nlen - 1] == '/') > + while ((path[nlen - 1] == '/') && (nlen > 1)) > nlen--; I decided to use Ondrej's version sine the nlen is tested first before the index into path was made. steved. > > for (exp = exportlist[htype].p_head; exp; exp = exp->m_next) { >