- New version: nfs-utils-2.3.3

The nfsidmap library source has been merged into
  nfs-utils, so this source package now makes
  nfsidmap and nfsidmap-devel packages.
  New program "nfsconf" improves access to nfs config files.

OBS-URL: https://build.opensuse.org/package/show/Base:System/nfs-utils?expand=0&rev=194
This commit is contained in:
Neil Brown 2018-10-25 05:36:26 +00:00 committed by Git OBS Bridge
parent 3e9193b0eb
commit 45f817e83b
14 changed files with 70 additions and 283 deletions

View File

@ -1,38 +0,0 @@
From 5ec9d9034650ae4372dc1bd44d33a1e8768e3409 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.com>
Date: Wed, 8 Feb 2017 08:18:34 +1100
Subject: [PATCH] conffile: ignore empty environment variables.
conf_set() already refuses to set an empty value, so if
foo=
appear in the config file, it will be ignored.
This patch extends the policy to environment variables, so empty
environment variables are treats as though they didn't exist.
This means that a separate environment file (e.g. /etc/sysconfig/nfs)
will be treated the same way whether it is:
- included in the [environment] section of /etc/nfs.conf
- sourced by the shell before running code
- sourced by the systemd EnvironmentFile directive.
Signed-off-by: NeilBrown <neilb@suse.com>
---
support/nfs/conffile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c
index e717c1e39bab..203efd2aa602 100644
--- a/support/nfs/conffile.c
+++ b/support/nfs/conffile.c
@@ -533,7 +533,7 @@ retry:
* or from environment
*/
char *env = getenv(cb->value+1);
- if (env)
+ if (env && *env)
return env;
section = "environment";
tag = cb->value + 1;
--
2.11.0

View File

@ -1,43 +0,0 @@
From 5b7da9d70261583e67e114b36cb19973de15606d Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.com>
Date: Wed, 8 Feb 2017 08:22:36 +1100
Subject: [PATCH] mount: call setgroups() before setuid()
It is generally wise to call setgroups() (and setgid()) before calling
setuid() to ensure no unexpected permission leaks happen.
SUSE's build system check all binaries for conformance with this
and generates a warning for mountd.
As we set setting the uid to 0, there is no risk that the group list
will provide extra permissions, so there is no real risk here.
But it is nice to silence warnings, and including a setgroups()
call is probably a good practice to encourage.
Signed-off-by: NeilBrown <neilb@suse.com>
---
utils/mount/network.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/utils/mount/network.c b/utils/mount/network.c
index d1c8fec75174..281e9354a7fa 100644
--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -33,6 +33,7 @@
#include <errno.h>
#include <netdb.h>
#include <time.h>
+#include <grp.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -804,6 +805,7 @@ int start_statd(void)
pid_t pid = fork();
switch (pid) {
case 0: /* child */
+ setgroups(0, NULL);
setgid(0);
setuid(0);
execle(START_STATD, START_STATD, NULL, envp);
--
2.11.0

View File

@ -1,71 +0,0 @@
From 93b39628e0a2053d9b37cab7a60d78f782cb88ea Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.com>
Date: Wed, 8 Feb 2017 12:56:38 +1100
Subject: [PATCH] nfs-server-generator: handle 'noauto' mounts correctly.
When this code was written the systemd documentation stated
that "RequiresMountsFor" ignored mountpoints marked as "noauto".
Unfortunately this is incorrect. Consquently a filesystem marked
as noauto that is also NFS exported will currently be mounted when
the NFS server is started. This is not what people expect.
So add a check for the noauto flag. If any ancestor of a given
export point has the noauto flag, no RequiresMountsFor will be
generated for that point.
Also skip RequiresMountsFor for exports marked 'mountpoint', as their
absence is, theoretically, already handled by mountd.
URL: https://github.com/systemd/systemd/issues/5249
Signed-off-by: NeilBrown <neilb@suse.com>
---
systemd/nfs-server-generator.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/systemd/nfs-server-generator.c b/systemd/nfs-server-generator.c
index cc99969e9922..4aa65094ca07 100644
--- a/systemd/nfs-server-generator.c
+++ b/systemd/nfs-server-generator.c
@@ -84,6 +84,28 @@ static void systemd_escape(FILE *f, char *path)
}
}
+static int has_noauto_flag(char *path)
+{
+ FILE *fstab;
+ struct mntent *mnt;
+
+ fstab = setmntent("/etc/fstab", "r");
+ if (!fstab)
+ return 0;
+
+ while ((mnt = getmntent(fstab)) != NULL) {
+ int l = strlen(mnt->mnt_dir);
+ if (strncmp(mnt->mnt_dir, path, l) != 0)
+ continue;
+ if (path[l] && path[l] != '/')
+ continue;
+ if (hasmntopt(mnt, "noauto"))
+ break;
+ }
+ fclose(fstab);
+ return mnt != NULL;
+}
+
int main(int argc, char *argv[])
{
char *path;
@@ -124,6 +146,10 @@ int main(int argc, char *argv[])
for (exp = exportlist[i].p_head; exp; exp = exp->m_next) {
if (!is_unique(&list, exp->m_export.e_path))
continue;
+ if (exp->m_export.e_mountpoint)
+ continue;
+ if (has_noauto_flag(exp->m_export.e_path))
+ continue;
if (strchr(exp->m_export.e_path, ' '))
fprintf(f, "RequiresMountsFor=\"%s\"\n",
exp->m_export.e_path);
--
2.11.0

View File

@ -1,4 +0,0 @@
# When nfs is stopped or restarted, nfs-client must too.
[Unit]
PartOf=nfs.service

View File

@ -1,4 +0,0 @@
# When nfsserver is stopped or restarted, nfs-server must too.
[Unit]
PartOf=nfsserver.service

View File

@ -6,9 +6,9 @@
support/nfs/exports.c | 2 ++
1 file changed, 2 insertions(+)
--- nfs-utils-1.3.1.orig/support/nfs/exports.c
+++ nfs-utils-1.3.1/support/nfs/exports.c
@@ -649,6 +649,8 @@ bad_option:
--- a/support/nfs/exports.c
+++ b/support/nfs/exports.c
@@ -657,6 +657,8 @@ bad_option:
} else if (strncmp(opt, "replicas=", 9) == 0) {
ep->e_fslocmethod = FSLOC_REPLICA;
ep->e_fslocdata = strdup(opt+9);

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0faeb54c70b84e6bd3b9b6901544b1f6add8d246f35c1683e402daf4e0c719ef
size 606028

3
nfs-utils-2.3.3.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f68b34793831b05f1fd5760d6bdec92772c7684177586a99a61e7b444f336322
size 662280

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Thu Oct 25 05:32:30 UTC 2018 - Neil Brown <nfbrown@suse.com>
- New version: nfs-utils-2.3.3
The nfsidmap library source has been merged into
nfs-utils, so this source package now makes
nfsidmap and nfsidmap-devel packages.
New program "nfsconf" improves access to nfs config files.
-------------------------------------------------------------------
Mon Aug 6 07:29:37 UTC 2018 - schwab@suse.de

View File

@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
@ -22,7 +22,7 @@
%endif
Name: nfs-utils
Version: 2.1.1
Version: 2.3.3
Release: 0
Summary: Support Utilities for Kernel nfsd
License: GPL-2.0-or-later
@ -38,10 +38,6 @@ Source7: fw-client
Source8: fw-server
Source11: idmapd.conf
Source13: nfs-utils.rpmlintrc
Source15: nfsserver.service
Source16: nfs.service
Source17: nfs-server.nfsserver.conf
Source18: nfs-client.nfs.conf
Source20: nfs-mountd.options.conf
Source21: nfs-server.options.conf
Source22: rpc-gssd.options.conf
@ -51,24 +47,19 @@ Source25: rpc-svcgssd.options.conf
Source26: nfs.conf
Source27: nfs-kernel-server.tmpfiles.conf
Patch0: nfs-utils-1.0.7-bind-syntax.patch
Patch1: 0001-conffile-ignore-empty-environment-variables.patch
Patch2: 0002-mount-call-setgroups-before-setuid.patch
Patch3: 0003-nfs-server-generator-handle-noauto-mounts-correctly.patch
Patch4: nsm-headers.patch
Patch5: sysmacros.patch
BuildRequires: e2fsprogs-devel
BuildRequires: fedfs-utils-devel
BuildRequires: gcc-c++
BuildRequires: libtool
BuildRequires: pkgconfig
BuildRequires: rpcgen
BuildRequires: systemd-rpm-macros
BuildRequires: tcpd-devel
BuildRequires: pkgconfig(devmapper)
BuildRequires: pkgconfig(kdb)
BuildRequires: pkgconfig(krb5)
BuildRequires: pkgconfig(libevent)
BuildRequires: pkgconfig(libnfsidmap) >= 0.24
BuildRequires: pkgconfig(libtirpc)
BuildRequires: pkgconfig(mount)
BuildRequires: pkgconfig(sqlite3)
@ -86,6 +77,7 @@ Summary: Support Utilities for NFS
Group: Productivity/Networking/NFS
Requires: keyutils
Requires: netcfg
Requires: nfsidmap
Requires: rpcbind
Requires(post): %fillup_prereq
Requires(pre): permissions
@ -116,6 +108,29 @@ tune the number of server threads via the sysconfig variable
USE_KERNEL_NFSD_NUMBER. For quota over NFS support, install the quota
package.
%package -n nfsidmap
Summary: NFSv4 ID Mapping Library
Group: Productivity/Networking/NFS
Version: 1.0
Release: 0
%package -n nfsidmap-devel
Summary: NFSv4 ID Mapping Library development libraries
Group: Development/Libraries/C and C++
Version: 1.0
Release: 0
Requires: nfsidmap = %{version}
%description -n nfsidmap
In NFSv4, identities of users are conveyed by names rather than user ID
and group ID. Both the NFS server and client code in the kernel need to
translate these to numeric IDs.
%description -n nfsidmap-devel
In NFSv4, identities of users are conveyed by names rather than user ID
and group ID. Both the NFS server and client code in the kernel need to
translate these to numeric IDs.
%package -n nfs-doc
Summary: Support Utilities for NFS
Group: Productivity/Networking/NFS
@ -129,11 +144,6 @@ This package contains additional NFS documentation.
%prep
%setup -q -a 1
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
cp %{SOURCE6} .
@ -150,6 +160,7 @@ export LDFLAGS="-pie"
--enable-nfsdcltrack \
--enable-mount \
--enable-libmount-mount \
--disable-static \
--enable-mountconfig
make %{?_smp_mflags}
cd nfs
@ -163,10 +174,7 @@ done
%install
make %{?_smp_mflags} DESTDIR=%{buildroot} install
install -D -m 644 %{SOURCE15} %{buildroot}%{_unitdir}/nfsserver.service
install -D -m 644 %{SOURCE16} %{buildroot}%{_unitdir}/nfs.service
install -D -m 644 %{SOURCE17} %{buildroot}%{_unitdir}/nfs-server.service.d/nfsserver.conf
install -D -m 644 %{SOURCE18} %{buildroot}%{_unitdir}/nfs-client.target.d/nfs.conf
find %{buildroot} -type f -name '*.la' -delete -print
install -D -m 644 %{SOURCE20} %{buildroot}%{_unitdir}/nfs-mountd.service.d/options.conf
install -D -m 644 %{SOURCE21} %{buildroot}%{_unitdir}/nfs-server.service.d/options.conf
install -D -m 644 %{SOURCE22} %{buildroot}%{_unitdir}/rpc-gssd.service.d/options.conf
@ -175,9 +183,7 @@ install -D -m 644 %{SOURCE24} %{buildroot}%{_unitdir}/rpc-statd-notify.service.d
install -D -m 644 %{SOURCE25} %{buildroot}%{_unitdir}/rpc-svcgssd.service.d/options.conf
install -D -m 644 %{SOURCE26} %{buildroot}%{_sysconfdir}/nfs.conf
install -D -m 644 %{SOURCE27} %{buildroot}%{_prefix}/lib/tmpfiles.d/nfs-kernel-server.conf
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rcnfsserver
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rcnfs-server
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rcnfs
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rcnfs-client
# sysconfig-data
mkdir -p %{buildroot}%{_fillupdir}
@ -202,7 +208,7 @@ chmod 644 %{buildroot}%{_sbindir}/{mountstats,nfsiostat}
/usr/bin/getent passwd statd >/dev/null || \
/usr/sbin/useradd -r -c 'NFS statd daemon' \
-s /sbin/nologin -d %{_localstatedir}/lib/nfs -g nogroup statd
%service_add_pre nfs.service auth-rpcgss-module.service nfs-idmapd.service nfs-blkmap.service rpc-statd-notify.service rpc-gssd.service rpc-statd.service rpc-svcgssd.service
%service_add_pre auth-rpcgss-module.service nfs-idmapd.service nfs-blkmap.service rpc-statd-notify.service rpc-gssd.service rpc-statd.service rpc-svcgssd.service
%post -n nfs-client
chown statd:nogroup %{_localstatedir}/lib/nfs > /dev/null 2>&1 || :
@ -221,22 +227,24 @@ fi
%{fillup_only -n nfs nfs}
#
%set_permissions /sbin/mount.nfs
%service_add_post nfs.service auth-rpcgss-module.service nfs-idmapd.service nfs-blkmap.service rpc-statd-notify.service rpc-gssd.service rpc-statd.service rpc-svcgssd.service
/sbin/ldconfig
%service_add_post auth-rpcgss-module.service nfs-idmapd.service nfs-blkmap.service rpc-statd-notify.service rpc-gssd.service rpc-statd.service rpc-svcgssd.service
%preun -n nfs-client
%service_del_preun nfs.service auth-rpcgss-module.service nfs-idmapd.service nfs-blkmap.service rpc-statd-notify.service rpc-gssd.service rpc-statd.service rpc-svcgssd.service
%service_del_preun auth-rpcgss-module.service nfs-idmapd.service nfs-blkmap.service rpc-statd-notify.service rpc-gssd.service rpc-statd.service rpc-svcgssd.service
%postun -n nfs-client
%service_del_postun nfs.service auth-rpcgss-module.service nfs-idmapd.service nfs-blkmap.service rpc-statd-notify.service rpc-gssd.service rpc-statd.service rpc-svcgssd.service
/sbin/ldconfig
%service_del_postun auth-rpcgss-module.service nfs-idmapd.service nfs-blkmap.service rpc-statd-notify.service rpc-gssd.service rpc-statd.service rpc-svcgssd.service
%verifyscript -n nfs-client
%verify_permissions -e /sbin/mount.nfs
%pre -n nfs-kernel-server
%service_add_pre nfsserver.service nfs-svcgssd.service nfs-mountd.service nfs-server.service
%service_add_pre nfs-svcgssd.service nfs-mountd.service nfs-server.service
%preun -n nfs-kernel-server
%service_del_preun nfsserver.service nfs-svcgssd.service nfs-mountd.service nfs-server.service
%service_del_preun nfs-svcgssd.service nfs-mountd.service nfs-server.service
%post -n nfs-kernel-server
### migrate from /var/lock/subsys
@ -248,12 +256,12 @@ if [ -f %{_localstatedir}/lock/subsys/nfsserver-rpc.idmapd ]; then
mv %{_localstatedir}/lock/subsys/nfsserver-rpc.idmapd /run/nfs
fi
###
%service_add_post nfsserver.service nfs-mountd.service nfs-server.service
%service_add_post nfs-mountd.service nfs-server.service
%tmpfiles_create nfs-kernel-server.conf
%set_permissions /var/lib/nfs/rmtab
%postun -n nfs-kernel-server
%service_del_postun nfsserver.service nfs-mountd.service nfs-server.service
%service_del_postun nfs-mountd.service nfs-server.service
%verifyscript -n nfs-kernel-server
%verify_permissions -e /var/lib/nfs/rmtab
@ -272,7 +280,6 @@ fi
%attr(0755,root,root) %{_sbindir}/nfsiostat
%{_sbindir}/nfsidmap
%{_sbindir}/nfsstat
%{_sbindir}/rcnfs
%{_sbindir}/rcnfs-client
%{_sbindir}/rpc.gssd
%{_sbindir}/rpc.idmapd
@ -283,6 +290,7 @@ fi
%{_sbindir}/start-statd
%{_sbindir}/blkmapd
%{_sbindir}/rpc.svcgssd
%{_sbindir}/nfsconf
%{_unitdir}/auth-rpcgss-module.service
%{_unitdir}/nfs-blkmap.service
%{_unitdir}/nfs-client.target
@ -290,29 +298,26 @@ fi
%{_unitdir}/nfs-utils.service
%{_unitdir}/rpc-gssd.service
%{_unitdir}/rpc-gssd.service.d
%{_unitdir}/rpc-gssd.service.d/options.conf
%{_unitdir}/rpc_pipefs.target
%{_unitdir}/rpc-statd-notify.service
%{_unitdir}/rpc-statd-notify.service.d
%{_unitdir}/rpc-statd-notify.service.d/options.conf
%{_unitdir}/rpc-statd.service
%{_unitdir}/rpc-statd.service.d
%{_unitdir}/rpc-statd.service.d/options.conf
%{_unitdir}/rpc-svcgssd.service
%{_unitdir}/rpc-svcgssd.service.d
%{_unitdir}/rpc-svcgssd.service.d/options.conf
%{_unitdir}/var-lib-nfs-rpc_pipefs.mount
%{_unitdir}/nfs.service
%dir %{_unitdir}/nfs-client.target.d
%{_unitdir}/nfs-client.target.d/nfs.conf
%dir /usr/lib/systemd/system-generators
/usr/lib/systemd/system-generators/nfs-server-generator
/usr/lib/systemd/system-generators/rpc-pipefs-generator
%{_mandir}/man5/nfsmount.conf.5%{ext_man}
%{_mandir}/man5/nfs.conf.5%{ext_man}
%{_mandir}/man5/nfs.5%{ext_man}
%{_mandir}/man5/idmapd.conf.5%{ext_man}
%{_mandir}/man7/nfs.systemd.7%{ext_man}
%{_mandir}/man8/mount.nfs.8%{ext_man}
%{_mandir}/man8/nfsidmap.8%{ext_man}
%{_mandir}/man8/nfsstat.8%{ext_man}
%{_mandir}/man8/nfsconf.8%{ext_man}
%{_mandir}/man8/rpc.sm-notify.8%{ext_man}
%{_mandir}/man8/showmount.8%{ext_man}
%{_mandir}/man8/sm-notify.8%{ext_man}
@ -342,16 +347,11 @@ fi
%defattr(-,root,root)
%{_unitdir}/nfs-mountd.service
%{_unitdir}/nfs-mountd.service.d
%{_unitdir}/nfs-mountd.service.d/options.conf
%{_unitdir}/nfs-server.service
%{_unitdir}/nfs-server.service.d
%{_unitdir}/nfs-server.service.d/options.conf
%{_unitdir}/proc-fs-nfsd.mount
%{_unitdir}/nfsserver.service
%{_unitdir}/nfs-server.service.d/nfsserver.conf
%{_prefix}/lib/tmpfiles.d/nfs-kernel-server.conf
%{_sbindir}/exportfs
%{_sbindir}/rcnfsserver
%{_sbindir}/rcnfs-server
%{_sbindir}/rpc.mountd
%{_sbindir}/rpc.nfsd
@ -368,6 +368,17 @@ fi
%config(noreplace) %{_localstatedir}/lib/nfs/rmtab
%config %attr(0644,root,root) %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/nfs-kernel-server
%files -n nfsidmap
%doc support/nfsidmap/README
%{_libdir}/libnfsidmap/
%{_libdir}/libnfsidmap.so.1*
%{_mandir}/man3/*
%files -n nfsidmap-devel
%{_libdir}/libnfsidmap.so
%{_includedir}/*.h
%{_libdir}/pkgconfig/libnfsidmap.pc
%files -n nfs-doc
%defattr(-,root,root)
%doc nfs/*.html nfs/*.ps README.NFSv4

View File

@ -1,23 +0,0 @@
[Unit]
Description=Alias for NFS client
# The systemd alias mechanism (using symlinks) isn't rich enough.
# If you "systemctl enable" an alias, it doesn't enable the
# target.
# This service file creates a sufficiently rich alias for nfs-client
# (which is the canonical upstream name)
# "start", "stop", "restart", "reload" on this will do the same to nfs-client.
# "enable" on this will only enable this service, but when it starts, that
# starts nfs-client, so it is effectively enabled.
# nfs-server.d/nfsserver.conf is part of this service.
Requires= nfs-client.target
PropagatesReloadTo=nfs-client.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/true
[Install]
WantedBy=multi-user.target

View File

@ -1,26 +0,0 @@
[Unit]
Description=Alias for NFS server
# The systemd alias mechanism (using symlinks) isn't rich enough.
# If you "systemctl enable" an alias, it doesn't enable the
# target.
# This service file creates a sufficiently rich alias for nfs-server
# (which is the canonical upstream name)
# "start", "stop", "restart", "reload" on this will do the same to nfs-server.
# "enable" on this will only enable this service, but when it starts, that
# starts nfs-server, so it is effectively enabled.
# nfs-server.d/nfsserver.conf is part of this service.
Requires= nfs-server.service
[Service]
Type=oneshot
ExecStart=/bin/true
RemainAfterExit=yes
# Can't just PropagatesReloadTo to nfs-server.service
# as reload fails if we don't have our own ExecReload
# So copy that from nfs-server.service
ExecReload=/usr/sbin/exportfs -r
[Install]
WantedBy=multi-user.target

View File

@ -1,12 +0,0 @@
Index: nfs-utils-2.1.1/support/nsm/rpc.c
===================================================================
--- nfs-utils-2.1.1.orig/support/nsm/rpc.c
+++ nfs-utils-2.1.1/support/nsm/rpc.c
@@ -41,6 +41,7 @@
#include <time.h>
#include <stdbool.h>
#include <string.h>
+#include <stdint.h>
#include <unistd.h>
#include <fcntl.h>

View File

@ -1,12 +0,0 @@
Index: nfs-utils-2.1.1/utils/blkmapd/device-discovery.c
===================================================================
--- nfs-utils-2.1.1.orig/utils/blkmapd/device-discovery.c
+++ nfs-utils-2.1.1/utils/blkmapd/device-discovery.c
@@ -27,6 +27,7 @@
*/
#include <sys/types.h>
+#include <sys/sysmacros.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/mount.h>