RHEL 9.0.0 Alpha bootstrap

The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/nfs-utils#ae3700f20b5680274b29ff27c2f54879b44ab34b
This commit is contained in:
Petr Šabata 2020-10-15 21:04:16 +02:00
parent 88d59eec9a
commit 9e917f864c
35 changed files with 7119 additions and 0 deletions

4
.gitignore vendored
View File

@ -0,0 +1,4 @@
x86_64
Makefile
/nfs-utils-2.5.1.tar.xz
nfs-utils-2.5.1/

7
24-nfs-server.conf Normal file
View File

@ -0,0 +1,7 @@
[service/nfs-server]
mechs = krb5
socket = /run/gssproxy.sock
cred_store = keytab:/etc/krb5.keytab
trusted = yes
kernel_nfsd = yes
euid = 0

9
id_resolver.conf Normal file
View File

@ -0,0 +1,9 @@
#
# nfsidmap(5) - The NFS idmapper upcall program
# Summary: Used by NFSv4 to map user/group ids into
# user/group names and names into in ids
# Options:
# -v Increases the verbosity of the output to syslog
# -t timeout Set the expiration timer, in seconds, on the key
#
create id_resolver * * /usr/sbin/nfsidmap %k %d

23
lockd.conf Normal file
View File

@ -0,0 +1,23 @@
#
# Set the NFS lock manager grace period. n is measured in seconds.
#options lockd nlm_grace_period=90
#
# Set the TCP port that the NFS lock manager should use.
# port must be a valid TCP port value (1-65535).
#options lockd nlm_tcpport
#
# Set the UDP port that the NFS lock manager should use.
# port must be a valid UDP port value (1-65535).
#options lockd nlm_udpport
#
# Set the maximum number of outstanding connections
#options lockd nlm_max_connections=1024
#
# Set the default time value for the NFS lock manager
# in seconds. Default is 10 secs (min 3 max 20)
#options lockd nlm_timeout=10
#
# Choose whether to record the caller_name or IP address
# this peer in the local rpc.statd's database.
#options lockd nsm_use_hostnames=0

22
nfs-convert.service Normal file
View File

@ -0,0 +1,22 @@
[Unit]
Description=Preprocess NFS configuration convertion
DefaultDependencies=no
Before=nfs-server.service nfs-mountd.service nfs-idmapd.service
Before=nfs-blkmap.service rpc-statd.service rpc-gssd.service
Before=rpc-statd-notify.service
After=initrd-root-fs.target
[Service]
Type=oneshot
ExecStart=/usr/libexec/nfs-utils/nfsconvert.sh
[Install]
RequiredBy=nfs-server.service
RequiredBy=nfs-mountd.service
RequiredBy=nfs-idmapd.service
RequiredBy=nfs-blkmap.service
RequiredBy=rpc-statd.service
RequiredBy=rpc-gssd.service
RequiredBy=rpc-statd-notify.service

View File

@ -0,0 +1,12 @@
diff -up nfs-utils-2.1.1/support/nfs/exports.c.orig nfs-utils-2.1.1/support/nfs/exports.c
--- nfs-utils-2.1.1/support/nfs/exports.c.orig 2017-01-12 10:21:39.000000000 -0500
+++ nfs-utils-2.1.1/support/nfs/exports.c 2017-04-26 12:46:24.186480312 -0400
@@ -507,7 +507,7 @@ void fix_pseudoflavor_flags(struct expor
static int
parseopts(char *cp, struct exportent *ep, int warn, int *had_subtree_opt_ptr)
{
- int had_subtree_opt = 0;
+ int had_subtree_opt = 1;
char *flname = efname?efname:"command line";
int flline = efp?efp->x_line:0;
unsigned int active = 0;

View File

@ -0,0 +1,58 @@
diff -up nfs-utils-2.1.1/utils/statd/sm-notify.man.orig nfs-utils-2.1.1/utils/statd/sm-notify.man
--- nfs-utils-2.1.1/utils/statd/sm-notify.man.orig 2017-04-26 12:45:14.205742654 -0400
+++ nfs-utils-2.1.1/utils/statd/sm-notify.man 2017-04-26 12:45:44.042630801 -0400
@@ -184,7 +184,7 @@ where NSM state information resides.
If this option is not specified,
.B sm-notify
uses
-.I /var/lib/nfs
+.I /var/lib/nfs/statd
by default.
.IP
After starting,
@@ -330,13 +330,13 @@ Currently, the
command supports sending notification only via datagram transport protocols.
.SH FILES
.TP 2.5i
-.I /var/lib/nfs/sm
+.I /var/lib/nfs/statd/sm
directory containing monitor list
.TP 2.5i
-.I /var/lib/nfs/sm.bak
+.I /var/lib/nfs/statd/sm.bak
directory containing notify list
.TP 2.5i
-.I /var/lib/nfs/state
+.I /var/lib/nfs/statd/state
NSM state number for this host
.TP 2.5i
.I /proc/sys/fs/nfs/nsm_local_state
diff -up nfs-utils-2.1.1/utils/statd/statd.man.orig nfs-utils-2.1.1/utils/statd/statd.man
--- nfs-utils-2.1.1/utils/statd/statd.man.orig 2017-01-12 10:21:39.000000000 -0500
+++ nfs-utils-2.1.1/utils/statd/statd.man 2017-04-26 12:45:44.043630798 -0400
@@ -253,7 +253,7 @@ where NSM state information resides.
If this option is not specified,
.B rpc.statd
uses
-.I /var/lib/nfs
+.I /var/lib/nfs/statd
by default.
.IP
After starting,
@@ -425,13 +425,13 @@ If set to a positive integer, has the sa
.IR \-\-no\-notify .
.SH FILES
.TP 2.5i
-.I /var/lib/nfs/sm
+.I /var/lib/nfs/statd/sm
directory containing monitor list
.TP 2.5i
-.I /var/lib/nfs/sm.bak
+.I /var/lib/nfs/statd/sm.bak
directory containing notify list
.TP 2.5i
-.I /var/lib/nfs/state
+.I /var/lib/nfs/statd/state
NSM state number for this host
.TP 2.5i
.I /var/run/run.statd.pid

View File

@ -0,0 +1,21 @@
diff -up nfs-utils-2.1.1/utils/statd/sm-notify.c.orig nfs-utils-2.1.1/utils/statd/sm-notify.c
--- nfs-utils-2.1.1/utils/statd/sm-notify.c.orig 2017-04-26 12:46:56.511359133 -0400
+++ nfs-utils-2.1.1/utils/statd/sm-notify.c 2017-04-26 12:47:18.155277994 -0400
@@ -28,6 +28,9 @@
#include <netdb.h>
#include <errno.h>
#include <grp.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
#include "conffile.h"
#include "sockaddr.h"
@@ -91,6 +94,7 @@ smn_lookup(const char *name)
};
int error;
+ res_init();
error = getaddrinfo(name, NULL, &hint, &ai);
if (error != 0) {
xlog(D_GENERAL, "getaddrinfo(3): %s", gai_strerror(error));

View File

@ -0,0 +1,12 @@
diff -up nfs-utils-2.4.2/utils/nfsidmap/nfsidmap.c.orig nfs-utils-2.4.2/utils/nfsidmap/nfsidmap.c
--- nfs-utils-2.4.2/utils/nfsidmap/nfsidmap.c.orig 2019-11-11 14:15:50.000000000 -0500
+++ nfs-utils-2.4.2/utils/nfsidmap/nfsidmap.c 2019-11-11 14:29:47.355661037 -0500
@@ -434,7 +434,7 @@ int main(int argc, char **argv)
xlog_stderr(verbose);
if ((argc - optind) != 2) {
- xlog_warn("Bad arg count. Check /etc/request-key.conf");
+ xlog_warn("Bad arg count. Check /etc/request-key.d/request-key.conf");
xlog_warn(USAGE, progname);
return EXIT_FAILURE;
}

View File

@ -0,0 +1,27 @@
commit a705076172b274463563416adffe55f129740267
Author: Steve Dickson <steved@redhat.com>
Date: Thu Jul 30 17:06:39 2015 -0400
rpc.gssd: Only clear the retval if it has not been set
In gssd_search_krb5_keytab() an error code can be
cleared by blindly setting retval to zero.
Reported-by: Jianhong Yin <jiyin@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
index f1ebc0d..ecf17a2 100644
--- a/utils/gssd/krb5_util.c
+++ b/utils/gssd/krb5_util.c
@@ -772,7 +772,9 @@ gssd_search_krb5_keytab(krb5_context context, krb5_keytab kt,
"keytab '%s'\n", k5err, kt_name);
}
- retval = 0;
+ /* Only clear the retval if has not been set */
+ if (retval < 0)
+ retval = 0;
out:
free(k5err);
return retval;

View File

@ -0,0 +1,42 @@
From 68852818f732b31d3deb7cc76ef16f4e61c41aec Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Sat, 9 May 2015 11:29:20 -0400
Subject: [PATCH] systemd: Set var-lib-nfs-rpc_pipefs.mount After= tmpfiles
OSTree is a mechanism for atomic updates of operating systems, with
designs for how system state is managed; in particular, `/var` should
start out empty, and components are responsible for creating content
there at runtime.
rpm-ostree consumes RPMs and commits them to an OSTree repository.
It has some support for automatically synthesizing systemd `tmpfiles.d`
snippets from RPM content in `/var` using systemd-tmpfiles.
However, in this case nfs-utils wants a mount point directory, and
it's running before systemd-tmpfiles. It should be perfectly fine to
do this mount after tmpfiles has run.
A better fix for this would be to move transient directories to
`/run`; However, that would be an invasive change, which can happen
after this fix.
Signed-off-by: Colin Walters <walters@verbum.org>
---
systemd/var-lib-nfs-rpc_pipefs.mount | 1 +
1 file changed, 1 insertion(+)
diff --git a/systemd/var-lib-nfs-rpc_pipefs.mount b/systemd/var-lib-nfs-rpc_pipefs.mount
index 33c5db6..26d1c76 100644
--- a/systemd/var-lib-nfs-rpc_pipefs.mount
+++ b/systemd/var-lib-nfs-rpc_pipefs.mount
@@ -1,6 +1,7 @@
[Unit]
Description=RPC Pipe File System
DefaultDependencies=no
+After=systemd-tmpfiles-setup.service
Conflicts=umount.target
[Mount]
--
1.8.3.1

View File

@ -0,0 +1,203 @@
diff -up nfs-utils-2.2.1/configure.ac.orig nfs-utils-2.2.1/configure.ac
--- nfs-utils-2.2.1/configure.ac.orig 2017-10-25 15:32:19.000000000 -0400
+++ nfs-utils-2.2.1/configure.ac 2017-10-25 15:52:43.287511759 -0400
@@ -552,6 +552,11 @@ AC_SUBST([AM_CFLAGS], ["$my_am_cflags"])
# Make sure that $ACLOCAL_FLAGS are used during a rebuild
AC_SUBST([ACLOCAL_AMFLAGS], ["-I $ac_macro_dir \$(ACLOCAL_FLAGS)"])
+# make libexecdir available for substituion in config files
+# 2 "evals" needed late to expand variable names.
+AC_SUBST([_libexecdir])
+AC_CONFIG_COMMANDS_PRE([eval eval _libexecdir=$libexecdir])
+
# make _sysconfdir available for substituion in config files
# 2 "evals" needed late to expand variable names.
AC_SUBST([_sysconfdir])
@@ -559,6 +564,7 @@ AC_CONFIG_COMMANDS_PRE([eval eval _sysco
AC_CONFIG_FILES([
Makefile
+ systemd/nfs-config.service
systemd/rpc-gssd.service
linux-nfs/Makefile
support/Makefile
diff -up nfs-utils-2.2.1/systemd/Makefile.am.orig nfs-utils-2.2.1/systemd/Makefile.am
--- nfs-utils-2.2.1/systemd/Makefile.am.orig 2017-10-25 15:32:19.000000000 -0400
+++ nfs-utils-2.2.1/systemd/Makefile.am 2017-10-25 15:52:43.287511759 -0400
@@ -6,6 +6,7 @@ unit_files = \
nfs-client.target \
rpc_pipefs.target \
\
+ nfs-config.service \
nfs-mountd.service \
nfs-server.service \
nfs-utils.service \
diff -up nfs-utils-2.2.1/systemd/nfs-blkmap.service.orig nfs-utils-2.2.1/systemd/nfs-blkmap.service
--- nfs-utils-2.2.1/systemd/nfs-blkmap.service.orig 2017-10-25 15:32:19.000000000 -0400
+++ nfs-utils-2.2.1/systemd/nfs-blkmap.service 2017-10-25 15:52:43.288511762 -0400
@@ -10,7 +10,8 @@ PartOf=nfs-utils.service
[Service]
Type=forking
PIDFile=/var/run/blkmapd.pid
-ExecStart=/usr/sbin/blkmapd
+EnvironmentFile=-/run/sysconfig/nfs-utils
+ExecStart=/usr/sbin/blkmapd $BLKMAPDARGS
[Install]
WantedBy=nfs-client.target
diff -up nfs-utils-2.2.1/systemd/nfs-config.service.in.orig nfs-utils-2.2.1/systemd/nfs-config.service.in
--- nfs-utils-2.2.1/systemd/nfs-config.service.in.orig 2017-10-25 15:52:43.288511762 -0400
+++ nfs-utils-2.2.1/systemd/nfs-config.service.in 2017-10-25 15:52:43.288511762 -0400
@@ -0,0 +1,13 @@
+[Unit]
+Description=Preprocess NFS configuration
+After=local-fs.target
+DefaultDependencies=no
+
+[Service]
+Type=oneshot
+# This service needs to run any time any nfs service
+# is started, so changes to local config files get
+# incorporated. Having "RemainAfterExit=no" (the default)
+# ensures this happens.
+RemainAfterExit=no
+ExecStart=@_libexecdir@/nfs-utils/nfs-utils_env.sh
diff -up nfs-utils-2.2.1/systemd/nfs-idmapd.service.orig nfs-utils-2.2.1/systemd/nfs-idmapd.service
--- nfs-utils-2.2.1/systemd/nfs-idmapd.service.orig 2017-10-25 15:32:19.000000000 -0400
+++ nfs-utils-2.2.1/systemd/nfs-idmapd.service 2017-10-25 15:52:43.288511762 -0400
@@ -6,6 +6,10 @@ After=rpc_pipefs.target local-fs.target
BindsTo=nfs-server.service
+Wants=nfs-config.service
+After=nfs-config.service
+
[Service]
+EnvironmentFile=-/run/sysconfig/nfs-utils
Type=forking
-ExecStart=/usr/sbin/rpc.idmapd
+ExecStart=/usr/sbin/rpc.idmapd $RPCIDMAPDARGS
diff -up nfs-utils-2.2.1/systemd/nfs-mountd.service.orig nfs-utils-2.2.1/systemd/nfs-mountd.service
--- nfs-utils-2.2.1/systemd/nfs-mountd.service.orig 2017-10-25 15:32:19.000000000 -0400
+++ nfs-utils-2.2.1/systemd/nfs-mountd.service 2017-10-25 15:52:43.289511766 -0400
@@ -8,6 +8,10 @@ After=network-online.target local-fs.tar
After=rpcbind.socket
BindsTo=nfs-server.service
+Wants=nfs-config.service
+After=nfs-config.service
+
[Service]
+EnvironmentFile=-/run/sysconfig/nfs-utils
Type=forking
-ExecStart=/usr/sbin/rpc.mountd
+ExecStart=/usr/sbin/rpc.mountd $RPCMOUNTDARGS
diff -up nfs-utils-2.2.1/systemd/nfs-server.service.orig nfs-utils-2.2.1/systemd/nfs-server.service
--- nfs-utils-2.2.1/systemd/nfs-server.service.orig 2017-10-25 15:32:19.000000000 -0400
+++ nfs-utils-2.2.1/systemd/nfs-server.service 2017-10-25 15:52:43.289511766 -0400
@@ -16,11 +16,16 @@ Before= rpc-statd-notify.service
Wants=auth-rpcgss-module.service
After=rpc-gssd.service gssproxy.service rpc-svcgssd.service
+Wants=nfs-config.service
+After=nfs-config.service
+
[Service]
+EnvironmentFile=-/run/sysconfig/nfs-utils
+
Type=oneshot
RemainAfterExit=yes
ExecStartPre=/usr/sbin/exportfs -r
-ExecStart=/usr/sbin/rpc.nfsd
+ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS
ExecStop=/usr/sbin/rpc.nfsd 0
ExecStopPost=/usr/sbin/exportfs -au
ExecStopPost=/usr/sbin/exportfs -f
diff -up nfs-utils-2.2.1/systemd/README.orig nfs-utils-2.2.1/systemd/README
--- nfs-utils-2.2.1/systemd/README.orig 2017-10-25 15:32:19.000000000 -0400
+++ nfs-utils-2.2.1/systemd/README 2017-10-25 15:52:43.289511766 -0400
@@ -19,8 +19,8 @@ by a suitable 'preset' setting:
can work (if no type is given, ".service" is assumed).
nfs-client.target
- If enabled, daemons needed for an nfs client are enabled.
- This does *not* include rpc.statd. The rpc-statd.service unit
+ If enabled, daemons needs for an nfs client are enabled.
+ This does *not* include rpc.statd. the rpc-statd.service unit
is started by /usr/sbin/start-statd which mount.nfs will run
if statd is needed.
@@ -52,19 +52,11 @@ It cannot stop rpc.statd or rpc.gssd as
client and systemd cannot specify is two-pronged reverse dependency.
(i.e. stop this unit if none of these units are running)
-Distro specific configuration can be included in /etc/nfs.conf, or
-by providing drop-in files which replace the ExecStart line for a given
-service, and possibly add an EnvironmentFile line.
-
-For example, if systemd/system/nfs-mountd.service.d/local.conf
-contained
- [Service]
- EnvironmentFile=/etc/sysconfig/nfs
- ExecStart=
- ExecStart=/usr/sbin/rpc.mountd $RPCMOUNTDOPTS
-
-then the setting of RPCMOUNTDOPTS in /etc/sysconfig/nfs would be
-passed to rpc.mountd.
+Distro specific commandline configuration can be provided by
+installing a script /usr/libexec/nfs-utils/nfs-utils_env.sh
+This should write /run/sysconfig/nfs-utils based on configuration
+information such as in /etc/sysconfig/nfs or /etc/defaults/nfs.
+It is run once by nfs-config.service.
rpc.gssd and rpc.svcgssd are assumed to be needed if /etc/krb5.keytab
is present.
diff -up nfs-utils-2.2.1/systemd/rpc-gssd.service.in.orig nfs-utils-2.2.1/systemd/rpc-gssd.service.in
--- nfs-utils-2.2.1/systemd/rpc-gssd.service.in.orig 2017-10-25 15:32:19.000000000 -0400
+++ nfs-utils-2.2.1/systemd/rpc-gssd.service.in 2017-10-25 15:52:43.290511769 -0400
@@ -9,6 +9,11 @@ ConditionPathExists=@_sysconfdir@/krb5.k
PartOf=nfs-utils.service
+Wants=nfs-config.service
+After=nfs-config.service
+
[Service]
+EnvironmentFile=-/run/sysconfig/nfs-utils
+
Type=forking
-ExecStart=/usr/sbin/rpc.gssd
+ExecStart=/usr/sbin/rpc.gssd $RPCGSSDARGS
diff -up nfs-utils-2.2.1/systemd/rpc-statd-notify.service.orig nfs-utils-2.2.1/systemd/rpc-statd-notify.service
--- nfs-utils-2.2.1/systemd/rpc-statd-notify.service.orig 2017-10-25 15:52:43.290511769 -0400
+++ nfs-utils-2.2.1/systemd/rpc-statd-notify.service 2017-10-25 15:56:28.102284921 -0400
@@ -10,7 +10,11 @@ After=nfs-server.service
PartOf=nfs-utils.service
+Wants=nfs-config.service
+After=nfs-config.service
+
[Service]
Type=forking
-ExecStart=-/usr/sbin/sm-notify
+EnvironmentFile=-/run/sysconfig/nfs-utils
+ExecStart=-/usr/sbin/sm-notify $SMNOTIFYARGS
RemainAfterExit=yes
diff -up nfs-utils-2.2.1/systemd/rpc-statd.service.orig nfs-utils-2.2.1/systemd/rpc-statd.service
--- nfs-utils-2.2.1/systemd/rpc-statd.service.orig 2017-10-25 15:32:19.000000000 -0400
+++ nfs-utils-2.2.1/systemd/rpc-statd.service 2017-10-25 15:52:43.291511772 -0400
@@ -8,8 +8,12 @@ After=network-online.target nss-lookup.t
PartOf=nfs-utils.service
+Wants=nfs-config.service
+After=nfs-config.service
+
[Service]
Environment=RPC_STATD_NO_NOTIFY=1
+EnvironmentFile=-/run/sysconfig/nfs-utils
Type=forking
PIDFile=/var/run/rpc.statd.pid
-ExecStart=/usr/sbin/rpc.statd
+ExecStart=/usr/sbin/rpc.statd $STATDARGS

View File

@ -0,0 +1,20 @@
commit ba03a02c2fd912f370e1f55de921a403bf5f9247
Author: Steve Dickson <steved@redhat.com>
Date: Thu Jun 22 12:56:41 2017 -0400
rpc.c: added include file so UINT16_MAX is defined.
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/support/nsm/rpc.c b/support/nsm/rpc.c
index 4e5f40e..0a8e56f 100644
--- a/support/nsm/rpc.c
+++ b/support/nsm/rpc.c
@@ -38,6 +38,7 @@
#include <sys/socket.h>
#include <sys/time.h>
+#include <stdint.h>
#include <time.h>
#include <stdbool.h>
#include <string.h>

View File

@ -0,0 +1,412 @@
commit 8d9bf479441d9d7a44a86b69026a7e9d431d3ade
Author: Justin Mitchell <jumitche@redhat.com>
Date: Tue Nov 7 09:28:25 2017 -0500
nfs-utils: Restore ABI compat with pre-merge libnfsidmap
Prior to merge libnfsidmap leaked many private symbols that were
not defined in its API, creating an accidental ABI.
This patch renames and unhides symbols in order to match that ABI
until a cleaned up API can be established and released.
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/support/include/conffile.h b/support/include/conffile.h
index d4cb6b4..ad20067 100644
--- a/support/include/conffile.h
+++ b/support/include/conffile.h
@@ -60,7 +60,7 @@ extern _Bool conf_get_bool(const char *, const char *, _Bool);
extern char *conf_get_str(const char *, const char *);
extern char *conf_get_str_with_def(const char *, const char *, char *);
extern char *conf_get_section(const char *, const char *, const char *);
-extern void conf_init(const char *);
+extern void conf_init_file(const char *);
extern void conf_cleanup(void);
extern int conf_match_num(const char *, const char *, int);
extern int conf_remove(int, const char *, const char *);
diff --git a/support/nfs/Makefile.am b/support/nfs/Makefile.am
index c037c46..e573b69 100644
--- a/support/nfs/Makefile.am
+++ b/support/nfs/Makefile.am
@@ -7,10 +7,10 @@ libnfs_la_SOURCES = exports.c rmtab.c xio.c rpcmisc.c rpcdispatch.c \
xcommon.c wildmat.c mydaemon.c \
rpc_socket.c getport.c \
svc_socket.c cacheio.c closeall.c nfs_mntent.c \
- svc_create.c atomicio.c strlcpy.c strlcat.c
+ svc_create.c atomicio.c strlcat.c
libnfs_la_LIBADD = libnfsconf.la
-libnfsconf_la_SOURCES = conffile.c xlog.c
+libnfsconf_la_SOURCES = conffile.c xlog.c strlcpy.c
MAINTAINERCLEANFILES = Makefile.in
diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c
index 9c5ed8e..dce8148 100644
--- a/support/nfs/conffile.c
+++ b/support/nfs/conffile.c
@@ -53,11 +53,9 @@
#include "conffile.h"
#include "xlog.h"
-#pragma GCC visibility push(hidden)
-
static void conf_load_defaults(void);
-static char * conf_load(const char *path);
-static int conf_set(int , const char *, const char *, const char *,
+static char * conf_readfile(const char *path);
+int conf_set(int , const char *, const char *, const char *,
const char *, int , int );
static void conf_parse(int trans, char *buf,
char **section, char **subsection);
@@ -79,12 +77,10 @@ TAILQ_HEAD (conf_trans_head, conf_trans) conf_trans_queue;
/*
* Radix-64 Encoding.
*/
-#if 0
-static const uint8_t bin2asc[]
+const uint8_t bin2asc[]
= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-#endif
-static const uint8_t asc2bin[] =
+const uint8_t asc2bin[] =
{
255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255,
@@ -370,7 +366,7 @@ conf_parse_line(int trans, char *line, int lineno, char **section, char **subsec
if (strcasecmp(line, "include")==0) {
/* load and parse subordinate config files */
- char * subconf = conf_load(val);
+ char * subconf = conf_readfile(val);
if (subconf == NULL) {
xlog_warn("config file error: line %d: "
"error loading included config", lineno);
@@ -435,7 +431,7 @@ conf_load_defaults(void)
}
static char *
-conf_load(const char *path)
+conf_readfile(const char *path)
{
struct stat sb;
if ((stat (path, &sb) == 0) || (errno != ENOENT)) {
@@ -444,19 +440,19 @@ conf_load(const char *path)
int fd = open (path, O_RDONLY, 0);
if (fd == -1) {
- xlog_warn("conf_reinit: open (\"%s\", O_RDONLY) failed", path);
+ xlog_warn("conf_readfile: open (\"%s\", O_RDONLY) failed", path);
return NULL;
}
new_conf_addr = malloc(sz+1);
if (!new_conf_addr) {
- xlog_warn("conf_reinit: malloc (%lu) failed", (unsigned long)sz);
+ xlog_warn("conf_readfile: malloc (%lu) failed", (unsigned long)sz);
goto fail;
}
/* XXX I assume short reads won't happen here. */
if (read (fd, new_conf_addr, sz) != (int)sz) {
- xlog_warn("conf_reinit: read (%d, %p, %lu) failed",
+ xlog_warn("conf_readfile: read (%d, %p, %lu) failed",
fd, new_conf_addr, (unsigned long)sz);
goto fail;
}
@@ -493,15 +489,19 @@ static void conf_free_bindings(void)
}
}
+#pragma GCC visibility push(hidden)
+/* these are the real fuinctions, hidden from being exported
+ * by libnfsidmap ABI compatability */
+
/* Open the config file and map it into our address space, then parse it. */
static void
-conf_reinit(const char *conf_file)
+conf_load_file(const char *conf_file)
{
int trans;
char * conf_data;
trans = conf_begin();
- conf_data = conf_load(conf_file);
+ conf_data = conf_readfile(conf_file);
if (conf_data == NULL)
return;
@@ -526,7 +526,7 @@ conf_reinit(const char *conf_file)
}
void
-conf_init (const char *conf_file)
+conf_init_file(const char *conf_file)
{
unsigned int i;
@@ -536,7 +536,7 @@ conf_init (const char *conf_file)
TAILQ_INIT (&conf_trans_queue);
if (conf_file == NULL) conf_file=NFS_CONFFILE;
- conf_reinit(conf_file);
+ conf_load_file(conf_file);
}
/*
@@ -560,6 +560,8 @@ conf_cleanup(void)
TAILQ_INIT(&conf_trans_queue);
}
+#pragma GCC visibility pop
+
/*
* Return the numeric value denoted by TAG in section SECTION or DEF
* if that tag does not exist.
@@ -575,6 +577,7 @@ conf_get_num(const char *section, const char *tag, int def)
return def;
}
+#pragma GCC visibility push(hidden)
/*
* Return the Boolean value denoted by TAG in section SECTION, or DEF
* if that tags does not exist.
@@ -606,6 +609,7 @@ conf_get_bool(const char *section, const char *tag, _Bool def)
return false;
return def;
}
+#pragma GCC visibility pop
/* Validate X according to the range denoted by TAG in section SECTION. */
int
@@ -651,6 +655,7 @@ conf_get_str_with_def(const char *section, const char *tag, char *def)
return result;
}
+#pragma GCC visibility push(hidden)
/*
* Find a section that may or may not have an argument
*/
@@ -682,6 +687,7 @@ retry:
}
return 0;
}
+#pragma GCC visibility pop
/*
* Build a list of string values out of the comma separated value denoted by
@@ -876,7 +882,7 @@ conf_trans_node(int transaction, enum conf_op op)
}
/* Queue a set operation. */
-static int
+int
conf_set(int transaction, const char *section, const char *arg,
const char *tag, const char *value, int override, int is_default)
{
diff --git a/support/nfsidmap/libnfsidmap.c b/support/nfsidmap/libnfsidmap.c
index 931387a..40011ee 100644
--- a/support/nfsidmap/libnfsidmap.c
+++ b/support/nfsidmap/libnfsidmap.c
@@ -89,6 +89,10 @@ gid_t nobody_gid = (gid_t)-1;
#define NFS4DNSTXTREC "_nfsv4idmapdomain"
#endif
+/* DEPRECATED these are for ABI compatibility only */
+char * conf_path = PATH_IDMAPDCONF;
+void conf_reinit(void);
+void conf_init(void);
/* Default logging fuction */
static void default_logger(const char *fmt, ...)
@@ -342,7 +346,6 @@ int nfs4_init_name_mapping(char *conffile)
char *nobody_user, *nobody_group;
char *nostrip;
char *reformatgroup;
- char *conf_path;
/* XXX: need to be able to reload configurations... */
if (nfs4_plugins) /* already succesfully initialized */
@@ -351,7 +354,7 @@ int nfs4_init_name_mapping(char *conffile)
conf_path = conffile;
else
conf_path = PATH_IDMAPDCONF;
- conf_init(conf_path);
+ conf_init_file(conf_path);
default_domain = conf_get_str("General", "Domain");
if (default_domain == NULL) {
dflt = 1;
@@ -710,3 +713,13 @@ void nfs4_set_debug(int dbg_level, void (*logger)(const char *, ...))
idmap_verbosity = dbg_level;
}
+void conf_reinit(void)
+{
+ conf_init_file(conf_path);
+}
+
+void conf_init(void)
+{
+ conf_init_file(conf_path);
+}
+
diff --git a/systemd/rpc-pipefs-generator.c b/systemd/rpc-pipefs-generator.c
index 59eee87..6e1d69c 100644
--- a/systemd/rpc-pipefs-generator.c
+++ b/systemd/rpc-pipefs-generator.c
@@ -121,7 +121,7 @@ int main(int argc, char *argv[])
exit(1);
}
- conf_init(NFS_CONFFILE);
+ conf_init_file(NFS_CONFFILE);
s = conf_get_str("general", "pipefs-directory");
if (!s)
exit(0);
diff --git a/utils/blkmapd/device-discovery.c b/utils/blkmapd/device-discovery.c
index 29bafb2..cae8c8d 100644
--- a/utils/blkmapd/device-discovery.c
+++ b/utils/blkmapd/device-discovery.c
@@ -456,7 +456,7 @@ int main(int argc, char **argv)
char *xrpcpipe_dir = NULL;
strncpy(rpcpipe_dir, RPCPIPE_DIR, sizeof(rpcpipe_dir));
- conf_init(NFS_CONFFILE);
+ conf_init_file(NFS_CONFFILE);
CONF_SAVE(xrpcpipe_dir, conf_get_str("general", "pipefs-directory"));
if (xrpcpipe_dir != NULL)
strlcpy(rpcpipe_dir, xrpcpipe_dir, sizeof(rpcpipe_dir));
diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
index beed1b3..448f195 100644
--- a/utils/exportfs/exportfs.c
+++ b/utils/exportfs/exportfs.c
@@ -107,7 +107,7 @@ main(int argc, char **argv)
xlog_stderr(1);
xlog_syslog(0);
- conf_init(NFS_CONFFILE);
+ conf_init_file(NFS_CONFFILE);
xlog_from_conffile("exportfs");
/* NOTE: following uses "mountd" section of nfs.conf !!!! */
diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
index 053a223..2c14e5f 100644
--- a/utils/gssd/gssd.c
+++ b/utils/gssd/gssd.c
@@ -842,7 +842,7 @@ read_gss_conf(void)
{
char *s;
- conf_init(NFS_CONFFILE);
+ conf_init_file(NFS_CONFFILE);
use_memcache = conf_get_bool("gssd", "use-memcache", use_memcache);
root_uses_machine_creds = conf_get_bool("gssd", "use-machine-creds",
root_uses_machine_creds);
diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c
index 4cbe148..2b9ecea 100644
--- a/utils/idmapd/idmapd.c
+++ b/utils/idmapd/idmapd.c
@@ -252,7 +252,7 @@ main(int argc, char **argv)
warn("Skipping configuration file \"%s\"", conf_path);
conf_path = NULL;
} else {
- conf_init(conf_path);
+ conf_init_file(conf_path);
verbose = conf_get_num("General", "Verbosity", 0);
cache_entry_expiration = conf_get_num("General",
"Cache-Expiration", DEFAULT_IDMAP_CACHE_EXPIRY);
@@ -264,13 +264,13 @@ main(int argc, char **argv)
}
} else {
conf_path = NFS_CONFFILE;
- conf_init(conf_path);
+ conf_init_file(conf_path);
CONF_SAVE(xpipefsdir, conf_get_str("General", "Pipefs-Directory"));
if (xpipefsdir != NULL)
strlcpy(pipefsdir, xpipefsdir, sizeof(pipefsdir));
conf_path = _PATH_IDMAPDCONF;
- conf_init(conf_path);
+ conf_init_file(conf_path);
verbose = conf_get_num("General", "Verbosity", 0);
cache_entry_expiration = conf_get_num("General",
"cache-expiration", DEFAULT_IDMAP_CACHE_EXPIRY);
diff --git a/utils/mount/mount_config.h b/utils/mount/mount_config.h
index e4f8511..7cc72fc 100644
--- a/utils/mount/mount_config.h
+++ b/utils/mount/mount_config.h
@@ -32,7 +32,7 @@ static inline void mount_config_init(char *program)
/*
* Read the the default mount options
*/
- conf_init(MOUNTOPTS_CONFFILE);
+ conf_init_file(MOUNTOPTS_CONFFILE);
}
static inline char *mount_config_opts(char *spec,
diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c
index 829f803..4c68702 100644
--- a/utils/mountd/mountd.c
+++ b/utils/mountd/mountd.c
@@ -679,7 +679,7 @@ main(int argc, char **argv)
else
progname = argv[0];
- conf_init(NFS_CONFFILE);
+ conf_init_file(NFS_CONFFILE);
xlog_from_conffile("mountd");
manage_gids = conf_get_bool("mountd", "manage-gids", manage_gids);
descriptors = conf_get_num("mountd", "descriptors", descriptors);
diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
index f973203..f41a2de 100644
--- a/utils/nfsd/nfsd.c
+++ b/utils/nfsd/nfsd.c
@@ -80,7 +80,7 @@ main(int argc, char **argv)
xlog_syslog(0);
xlog_stderr(1);
- conf_init(NFS_CONFFILE);
+ conf_init_file(NFS_CONFFILE);
xlog_from_conffile("nfsd");
count = conf_get_num("nfsd", "threads", count);
grace = conf_get_num("nfsd", "grace-time", grace);
diff --git a/utils/nfsdcltrack/nfsdcltrack.c b/utils/nfsdcltrack/nfsdcltrack.c
index 7830cf4..76b06d2 100644
--- a/utils/nfsdcltrack/nfsdcltrack.c
+++ b/utils/nfsdcltrack/nfsdcltrack.c
@@ -564,7 +564,7 @@ main(int argc, char **argv)
xlog_syslog(1);
xlog_stderr(0);
- conf_init(NFS_CONFFILE);
+ conf_init_file(NFS_CONFFILE);
xlog_from_conffile("nfsdcltrack");
val = conf_get_str("nfsdcltrack", "storagedir");
if (val)
diff --git a/utils/statd/sm-notify.c b/utils/statd/sm-notify.c
index d961dc0..6d19ec1 100644
--- a/utils/statd/sm-notify.c
+++ b/utils/statd/sm-notify.c
@@ -494,7 +494,7 @@ main(int argc, char **argv)
else
progname = argv[0];
- conf_init(NFS_CONFFILE);
+ conf_init_file(NFS_CONFFILE);
xlog_from_conffile("sm-notify");
opt_max_retry = conf_get_num("sm-notify", "retry-time", opt_max_retry / 60) * 60;
opt_srcport = conf_get_str("sm-notify", "outgoing-port");
diff --git a/utils/statd/statd.c b/utils/statd/statd.c
index 1443715..197d853 100644
--- a/utils/statd/statd.c
+++ b/utils/statd/statd.c
@@ -273,7 +273,7 @@ int main (int argc, char **argv)
/* Set hostname */
MY_NAME = NULL;
- conf_init(NFS_CONFFILE);
+ conf_init_file(NFS_CONFFILE);
xlog_from_conffile("statd");
out_port = conf_get_num("statd", "outgoing-port", out_port);
port = conf_get_num("statd", "port", port);

View File

@ -0,0 +1,32 @@
commit 5f32083c759b468f5b0cb9302e4fe2848d37cc5b
Author: Steve Dickson <steved@redhat.com>
Date: Tue Apr 10 10:25:40 2018 -0400
mount.nfs: Fix auto protocol negotiation
Commit 71b807e1 introduce a regression that
caused v3 not to be tried when v4 was not
supported by the server during auto negation.
A check of the type in nfs_nfs_version() was
reverted back to only check for the "nfs4"
string not the "nfs" string which fixed the
problem.
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/utils/mount/network.c b/utils/mount/network.c
index 9a2c878..e490399 100644
--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -1279,8 +1279,8 @@ nfs_nfs_version(char *type, struct mount_options *options, struct nfs_version *v
}
}
- if (!found && strncmp(type, "nfs", 3) == 0)
- version_val = "4";
+ if (!found && strcmp(type, "nfs4") == 0)
+ version_val = type + 3;
else if (!found)
return 1;
else if (i <= 2 ) {

View File

@ -0,0 +1,44 @@
commit 1a372a7b656ddf2be21ddad70b6c64c9d1d9d161
Author: Steve Dickson <steved@redhat.com>
Date: Tue Apr 17 14:26:44 2018 -0400
nfsd: Set default minor versions
Due to the way the kernel stores the supported
minor versions, when a minor is turned off,
via the -N flag, it can only turned back on
via -V flag.
The default minor values should also enable
these minor versions.
Acked-by: J. Bruce Fields <bfields@fieldses.org>
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/support/include/nfs/nfs.h b/support/include/nfs/nfs.h
index 7933ff5..b7d9e06 100644
--- a/support/include/nfs/nfs.h
+++ b/support/include/nfs/nfs.h
@@ -40,6 +40,7 @@ struct nfs_fh_len {
#define NFSCTL_TCPISSET(_cltbits) ((_cltbits) & NFSCTL_TCPBIT)
#define NFSCTL_VERDEFAULT (0xc) /* versions 3 and 4 */
+#define NFSCTL_MINDEFAULT (0x7) /* minor versions 4.1 and 4.2 */
#define NFSCTL_VERSET(_cltbits, _v) ((_cltbits) |= (1 << ((_v) - 1)))
#define NFSCTL_MINORSET(_cltbits, _v) ((_cltbits) |= (1 << (_v)))
#define NFSCTL_UDPSET(_cltbits) ((_cltbits) |= NFSCTL_UDPBIT)
diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
index f41a2de..2303a5d 100644
--- a/utils/nfsd/nfsd.c
+++ b/utils/nfsd/nfsd.c
@@ -65,8 +65,8 @@ main(int argc, char **argv)
int hcounter = 0;
struct conf_list *hosts;
int socket_up = 0;
- unsigned int minorvers = 0;
- unsigned int minorversset = 0;
+ unsigned int minorvers = NFSCTL_MINDEFAULT;
+ unsigned int minorversset = NFSCTL_MINDEFAULT;
unsigned int minormask = 0;
unsigned int versbits = NFSCTL_VERDEFAULT;
unsigned int protobits = NFSCTL_PROTODEFAULT;

View File

@ -0,0 +1,11 @@
diff -up nfs-utils-2.3.1/systemd/nfs-server.service.orig nfs-utils-2.3.1/systemd/nfs-server.service
--- nfs-utils-2.3.1/systemd/nfs-server.service.orig 2018-01-19 10:25:38.153513857 -0500
+++ nfs-utils-2.3.1/systemd/nfs-server.service 2018-01-19 10:30:52.977245126 -0500
@@ -26,6 +26,7 @@ Type=oneshot
RemainAfterExit=yes
ExecStartPre=/usr/sbin/exportfs -r
ExecStart=/usr/sbin/rpc.nfsd
+ExecStart=-/bin/sh -c 'if systemctl -q is-active gssproxy; then systemctl reload gssproxy ; fi'
ExecStop=/usr/sbin/rpc.nfsd 0
ExecStopPost=/usr/sbin/exportfs -au
ExecStopPost=/usr/sbin/exportfs -f

View File

@ -0,0 +1,43 @@
commit 5743891761f99bdfe6bf89956dab3a0e4c8a0fd0
Author: Steve Dickson <steved@redhat.com>
Date: Wed Jun 27 12:42:05 2018 -0400
Revert "gssd.c: Remomved a couple of warning errors"
This reverts commit 98118f5e382cdeb1acf25370768d5dfdc254ba5d.
Added back the 'm' character which cause memory to be
allocated for the string convertions.
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
index 7b21ee2..2c14e5f 100644
--- a/utils/gssd/gssd.c
+++ b/utils/gssd/gssd.c
@@ -279,16 +279,16 @@ gssd_read_service_info(int dirfd, struct clnt_info *clp)
* (commit bf19aacecbeebccb2c3d150a8bd9416b7dba81fe)
*/
numfields = fscanf(info,
- "RPC server: %s\n"
- "service: %s (%d) version %d\n"
- "address: %s\n"
- "protocol: %s\n"
- "port: %s\n",
- (char *)&server,
- (char *)&service, &program, &version,
- (char *)&address,
- (char *)&protoname,
- (char *)&port);
+ "RPC server: %ms\n"
+ "service: %ms (%d) version %d\n"
+ "address: %ms\n"
+ "protocol: %ms\n"
+ "port: %ms\n",
+ &server,
+ &service, &program, &version,
+ &address,
+ &protoname,
+ &port);
switch (numfields) {

View File

@ -0,0 +1,89 @@
diff -up nfs-utils-2.3.3/utils/mountd/mountd.man.orig nfs-utils-2.3.3/utils/mountd/mountd.man
--- nfs-utils-2.3.3/utils/mountd/mountd.man.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/utils/mountd/mountd.man 2018-10-26 09:53:10.005127368 -0400
@@ -232,36 +232,7 @@ section include
which each have same same meaning as given by
.BR rpc.nfsd (8).
-.SH TCP_WRAPPERS SUPPORT
-You can protect your
-.B rpc.mountd
-listeners using the
-.B tcp_wrapper
-library or
-.BR iptables (8).
-.PP
-Note that the
-.B tcp_wrapper
-library supports only IPv4 networking.
-.PP
-Add the hostnames of NFS peers that are allowed to access
-.B rpc.mountd
-to
-.IR /etc/hosts.allow .
-Use the daemon name
-.B mountd
-even if the
-.B rpc.mountd
-binary has a different name.
-.PP
-Hostnames used in either access file will be ignored when
-they can not be resolved into IP addresses.
-For further information see the
-.BR tcpd (8)
-and
-.BR hosts_access (5)
-man pages.
-.SS IPv6 and TI-RPC support
+.SH IPv6 and TI-RPC support
TI-RPC is a pre-requisite for supporting NFS on IPv6.
If TI-RPC support is built into
.BR rpc.mountd ,
@@ -288,7 +259,6 @@ table of clients accessing server's expo
.BR nfs (5),
.BR nfs.conf (5),
.BR tcpd (8),
-.BR hosts_access (5),
.BR iptables (8),
.BR netconfig (5)
.sp
diff -up nfs-utils-2.3.3/utils/statd/statd.man.orig nfs-utils-2.3.3/utils/statd/statd.man
--- nfs-utils-2.3.3/utils/statd/statd.man.orig 2018-10-26 09:52:27.609358805 -0400
+++ nfs-utils-2.3.3/utils/statd/statd.man 2018-10-26 09:53:37.345978117 -0400
@@ -319,28 +319,6 @@ chooses, simply use
.BR chown (1)
to set the owner of
the state directory.
-.PP
-You can also protect your
-.B rpc.statd
-listeners using the
-.B tcp_wrapper
-library or
-.BR iptables (8).
-To use the
-.B tcp_wrapper
-library, add the hostnames of peers that should be allowed access to
-.IR /etc/hosts.allow .
-Use the daemon name
-.B statd
-even if the
-.B rpc.statd
-binary has a different filename.
-.P
-For further information see the
-.BR tcpd (8)
-and
-.BR hosts_access (5)
-man pages.
.SH ADDITIONAL NOTES
Lock recovery after a reboot is critical to maintaining data integrity
and preventing unnecessary application hangs.
@@ -445,7 +423,6 @@ network transport capability database
.BR rpc.nfsd (8),
.BR rpcbind (8),
.BR tcpd (8),
-.BR hosts_access (5),
.BR iptables (8),
.BR netconfig (5)
.sp

View File

@ -0,0 +1,21 @@
diff -up nfs-utils-2.3.4/nfs.conf.orig nfs-utils-2.3.4/nfs.conf
--- nfs-utils-2.3.4/nfs.conf.orig 2019-05-10 14:49:49.000000000 -0400
+++ nfs-utils-2.3.4/nfs.conf 2019-05-10 14:58:20.198714920 -0400
@@ -13,7 +13,7 @@
# rpc-verbosity=0
# use-memcache=0
# use-machine-creds=1
-# use-gss-proxy=0
+use-gss-proxy=1
# avoid-dns=1
# limit-to-legacy-enctypes=0
# context-timeout=0
@@ -77,6 +77,5 @@
# outgoing-port=
# outgoing-addr=
# lift-grace=y
-#
-[svcgssd]
-# principal=
+
+#tag1234 - Used for install purposes only

View File

@ -0,0 +1,29 @@
commit 47aa0c9683e048eb325dc9779a5aff41250c2c68
Author: Steve Dickson <steved@redhat.com>
Date: Tue Dec 11 12:51:37 2018 -0500
nfsref: switch the way libraries are linked.
Link the static libs before the dynamic libs allowing
the routines in the static libs to be defined
by the dynamic libs
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/utils/nfsref/Makefile.am b/utils/nfsref/Makefile.am
index 44edc83..2409dd0 100644
--- a/utils/nfsref/Makefile.am
+++ b/utils/nfsref/Makefile.am
@@ -27,9 +27,9 @@ noinst_HEADERS = nfsref.h
sbin_PROGRAMS = nfsref
nfsref_SOURCES = add.c lookup.c nfsref.c remove.c
-LDADD = $(LIBXML2) $(LIBCAP) \
- ../../support/nfs/libnfs.la \
- ../../support/junction/libjunction.la
+LDADD = ../../support/nfs/libnfs.la \
+ ../../support/junction/libjunction.la \
+ $(LIBXML2) $(LIBCAP)
man8_MANS = nfsref.man

View File

@ -0,0 +1,47 @@
From 94de9a2112cddfdacdb7d63b5c24be99e3db4124
From: Steve Dickson <steved@redhat.com>
Date: Tue, 29 Jan 2019 15:31:06 -0500
Subject: [PATCH] nfs-utils: Removed new error=format-overflow=2 errors
With the latest C99-compliant gcc printf, sprintf, etc
now only support up to 4k in buffer sizes. There were
only a couple places that had to change to not
violated this new restriction
Signed-off-by: Steve Dickson <steved@redhat.com>
---
utils/blkmapd/device-discovery.c | 2 +-
utils/mount/error.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/utils/blkmapd/device-discovery.c b/utils/blkmapd/device-discovery.c
index 3a202e0..2ce60f8 100644
--- a/utils/blkmapd/device-discovery.c
+++ b/utils/blkmapd/device-discovery.c
@@ -239,7 +239,7 @@ int bl_discover_devices(void)
{
FILE *f;
int n;
- char buf[PATH_MAX], devname[PATH_MAX], fulldevname[PATH_MAX+NAME_MAX];
+ char buf[PATH_MAX], devname[NAME_MAX], fulldevname[PATH_MAX];
/* release previous list */
bl_release_disk();
diff --git a/utils/mount/error.c b/utils/mount/error.c
index dfe5c7d..562f312 100644
--- a/utils/mount/error.c
+++ b/utils/mount/error.c
@@ -50,8 +50,8 @@
extern char *progname;
-static char errbuf[BUFSIZ];
-static char *erreob = &errbuf[BUFSIZ];
+static char errbuf[PATH_MAX];
+static char *erreob = &errbuf[PATH_MAX];
/* Convert RPC errors into strings */
static int rpc_strerror(int spos)
--
2.20.1

View File

@ -0,0 +1,118 @@
commit a8133e1fd174267536cd459e19cfe0a1cbbe037c
Author: Steve Dickson <steved@redhat.com>
Date: Wed May 22 13:55:37 2019 -0400
sqlite.c: Use PRIx64 macro to print 64-bit integers
On 32 bit machines, using "%016lx" format throws out
an format error due to the -Werror=format=2
compiler option. On 64 bit machines using that
format is correct.
So use the PRIx64 macro to have the correct
format defined on the different machines.
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/utils/nfsdcld/sqlite.c b/utils/nfsdcld/sqlite.c
index faa62f9..cd658ef 100644
--- a/utils/nfsdcld/sqlite.c
+++ b/utils/nfsdcld/sqlite.c
@@ -59,6 +59,7 @@
#include <limits.h>
#include <sqlite3.h>
#include <linux/limits.h>
+#include <inttypes.h>
#include "xlog.h"
#include "sqlite.h"
@@ -535,7 +536,7 @@ sqlite_copy_cltrack_records(int *num_rec)
xlog(L_ERROR, "Unable to begin transaction: %s", err);
goto rollback;
}
- ret = snprintf(buf, sizeof(buf), "DELETE FROM \"rec-%016lx\";",
+ ret = snprintf(buf, sizeof(buf), "DELETE FROM \"rec-%" PRIx64 "\";",
current_epoch);
if (ret < 0) {
xlog(L_ERROR, "sprintf failed!");
@@ -550,7 +551,7 @@ sqlite_copy_cltrack_records(int *num_rec)
xlog(L_ERROR, "Unable to clear records from current epoch: %s", err);
goto rollback;
}
- ret = snprintf(buf, sizeof(buf), "INSERT INTO \"rec-%016lx\" "
+ ret = snprintf(buf, sizeof(buf), "INSERT INTO \"rec-%" PRIx64 "\" "
"SELECT id FROM attached.clients;",
current_epoch);
if (ret < 0) {
@@ -703,7 +704,7 @@ sqlite_insert_client(const unsigned char *clname, const size_t namelen)
int ret;
sqlite3_stmt *stmt = NULL;
- ret = snprintf(buf, sizeof(buf), "INSERT OR REPLACE INTO \"rec-%016lx\" "
+ ret = snprintf(buf, sizeof(buf), "INSERT OR REPLACE INTO \"rec-%" PRIx64 "\" "
"VALUES (?);", current_epoch);
if (ret < 0) {
xlog(L_ERROR, "sprintf failed!");
@@ -748,7 +749,7 @@ sqlite_remove_client(const unsigned char *clname, const size_t namelen)
int ret;
sqlite3_stmt *stmt = NULL;
- ret = snprintf(buf, sizeof(buf), "DELETE FROM \"rec-%016lx\" "
+ ret = snprintf(buf, sizeof(buf), "DELETE FROM \"rec-%" PRIx64 "\" "
"WHERE id==?;", current_epoch);
if (ret < 0) {
xlog(L_ERROR, "sprintf failed!");
@@ -798,7 +799,7 @@ sqlite_check_client(const unsigned char *clname, const size_t namelen)
int ret;
sqlite3_stmt *stmt = NULL;
- ret = snprintf(buf, sizeof(buf), "SELECT count(*) FROM \"rec-%016lx\" "
+ ret = snprintf(buf, sizeof(buf), "SELECT count(*) FROM \"rec-%" PRIx64 "\" "
"WHERE id==?;", recovery_epoch);
if (ret < 0) {
xlog(L_ERROR, "sprintf failed!");
@@ -873,7 +874,7 @@ sqlite_grace_start(void)
tcur++;
ret = snprintf(buf, sizeof(buf), "UPDATE grace "
- "SET current = %ld, recovery = %ld;",
+ "SET current = %" PRId64 ", recovery = %" PRId64 ";",
(int64_t)tcur, (int64_t)trec);
if (ret < 0) {
xlog(L_ERROR, "sprintf failed!");
@@ -891,7 +892,7 @@ sqlite_grace_start(void)
goto rollback;
}
- ret = snprintf(buf, sizeof(buf), "CREATE TABLE \"rec-%016lx\" "
+ ret = snprintf(buf, sizeof(buf), "CREATE TABLE \"rec-%" PRIx64 "\" "
"(id BLOB PRIMARY KEY);",
tcur);
if (ret < 0) {
@@ -915,7 +916,7 @@ sqlite_grace_start(void)
* values in the grace table, just clear out the records for
* the current reboot epoch.
*/
- ret = snprintf(buf, sizeof(buf), "DELETE FROM \"rec-%016lx\";",
+ ret = snprintf(buf, sizeof(buf), "DELETE FROM \"rec-%" PRIx64 "\";",
tcur);
if (ret < 0) {
xlog(L_ERROR, "sprintf failed!");
@@ -976,7 +977,7 @@ sqlite_grace_done(void)
goto rollback;
}
- ret = snprintf(buf, sizeof(buf), "DROP TABLE \"rec-%016lx\";",
+ ret = snprintf(buf, sizeof(buf), "DROP TABLE \"rec-%" PRIx64 "\";",
recovery_epoch);
if (ret < 0) {
xlog(L_ERROR, "sprintf failed!");
@@ -1027,7 +1028,7 @@ sqlite_iterate_recovery(int (*cb)(struct cld_client *clnt), struct cld_client *c
return -EINVAL;
}
- ret = snprintf(buf, sizeof(buf), "SELECT * FROM \"rec-%016lx\";",
+ ret = snprintf(buf, sizeof(buf), "SELECT * FROM \"rec-%" PRIx64 "\";",
recovery_epoch);
if (ret < 0) {
xlog(L_ERROR, "sprintf failed!");

View File

@ -0,0 +1,49 @@
commit a709f25c1da4a2fb44a1f3fd060298fbbd88aa3c
Author: Steve Dickson <steved@redhat.com>
Date: Tue May 14 15:52:50 2019 -0400
mount: Report correct error in the fall_back cases.
In mount auto negotiation, a v3 mount is tried
when the v4 fails with error that could mean
v4 is not supported.
When the v3 mount fails, the original v4 failure
should be used to set the errno, not the v3 failure.
Fixes:https://bugzilla.redhat.com/show_bug.cgi?id=1709961
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index 1bb7a73..901f995 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -889,7 +889,7 @@ out:
*/
static int nfs_autonegotiate(struct nfsmount_info *mi)
{
- int result;
+ int result, olderrno;
result = nfs_try_mount_v4(mi);
check_result:
@@ -949,7 +949,18 @@ fall_back:
if (mi->version.v_mode == V_GENERAL)
/* v2,3 fallback not allowed */
return result;
- return nfs_try_mount_v3v2(mi, FALSE);
+
+ /*
+ * Save the original errno in case the v3
+ * mount fails from one of the fall_back cases.
+ * Report the first failure not the v3 mount failure
+ */
+ olderrno = errno;
+ if ((result = nfs_try_mount_v3v2(mi, FALSE)))
+ return result;
+
+ errno = olderrno;
+ return result;
}
/*

View File

@ -0,0 +1,77 @@
commit 50ef80739d9e1e0df6616289ef2ff626a94666ee
Author: Steve Dickson <steved@redhat.com>
Date: Thu May 23 09:24:49 2019 -0400
rpc.mountd: Fix e_hostname and e_uuid leaks
strdup of exportent uuid and hostname in getexportent() ends up leaking
memory. Free the memory before getexportent() is called again from xtab_read()
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1713360
Signed-off-by: Nikhil Kshirsagar <nkshirsa@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/support/export/xtab.c b/support/export/xtab.c
index d42eeef..1e1d679 100644
--- a/support/export/xtab.c
+++ b/support/export/xtab.c
@@ -50,6 +50,14 @@ xtab_read(char *xtab, char *lockfn, int is_export)
while ((xp = getexportent(is_export==0, 0)) != NULL) {
if (!(exp = export_lookup(xp->e_hostname, xp->e_path, is_export != 1)) &&
!(exp = export_create(xp, is_export!=1))) {
+ if(xp->e_hostname) {
+ free(xp->e_hostname);
+ xp->e_hostname=NULL;
+ }
+ if(xp->e_uuid) {
+ free(xp->e_uuid);
+ xp->e_uuid=NULL;
+ }
continue;
}
switch (is_export) {
@@ -62,7 +70,16 @@ xtab_read(char *xtab, char *lockfn, int is_export)
if ((xp->e_flags & NFSEXP_FSID) && xp->e_fsid == 0)
v4root_needed = 0;
break;
- }
+ }
+ if(xp->e_hostname) {
+ free(xp->e_hostname);
+ xp->e_hostname=NULL;
+ }
+ if(xp->e_uuid) {
+ free(xp->e_uuid);
+ xp->e_uuid=NULL;
+ }
+
}
endexportent();
xfunlock(lockid);
diff --git a/support/nfs/exports.c b/support/nfs/exports.c
index 5f4cb95..a7582ca 100644
--- a/support/nfs/exports.c
+++ b/support/nfs/exports.c
@@ -179,9 +179,20 @@ getexportent(int fromkernel, int fromexports)
}
ee.e_hostname = xstrdup(hostname);
- if (parseopts(opt, &ee, fromexports && !has_default_subtree_opts, NULL) < 0)
- return NULL;
+ if (parseopts(opt, &ee, fromexports && !has_default_subtree_opts, NULL) < 0) {
+ if(ee.e_hostname)
+ {
+ xfree(ee.e_hostname);
+ ee.e_hostname=NULL;
+ }
+ if(ee.e_uuid)
+ {
+ xfree(ee.e_uuid);
+ ee.e_uuid=NULL;
+ }
+ return NULL;
+ }
/* resolve symlinks */
if (realpath(ee.e_path, rpath) != NULL) {
rpath[sizeof (rpath) - 1] = '\0';

View File

@ -0,0 +1,83 @@
commit ca668e35d16ca296dee1bd000de8eb8d20433a21
Author: Chuck Lever <chuck.lever@oracle.com>
Date: Tue May 28 10:02:49 2019 -0400
rpc.mountd: Fix mountd segfault
After commit 8f459a072f93 ("Remove abuse of ai_canonname") the
ai_canonname field in addrinfo structs returned from
host_reliable_addrinfo() is always NULL. This results in mountd
segfaults when there are netgroups or hostname wildcards in
/etc/exports.
Add an extra DNS query in check_wildcard() and check_netgroup() to
obtain the client's canonical hostname instead of dereferencing
the NULL pointer.
Reported-by: Mark Wagner <mark@lanfear.net>
Fixes: 8f459a072f93 ("Remove abuse of ai_canonname")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/support/export/client.c b/support/export/client.c
index a1fba01..ea4f89d 100644
--- a/support/export/client.c
+++ b/support/export/client.c
@@ -608,24 +608,36 @@ check_subnetwork(const nfs_client *clp, const struct addrinfo *ai)
static int
check_wildcard(const nfs_client *clp, const struct addrinfo *ai)
{
- char *cname = clp->m_hostname;
- char *hname = ai->ai_canonname;
+ char *hname, *cname = clp->m_hostname;
struct hostent *hp;
char **ap;
+ int match;
- if (wildmat(hname, cname))
- return 1;
+ match = 0;
+
+ hname = host_canonname(ai->ai_addr);
+ if (hname == NULL)
+ goto out;
+
+ if (wildmat(hname, cname)) {
+ match = 1;
+ goto out;
+ }
/* See if hname aliases listed in /etc/hosts or nis[+]
* match the requested wildcard */
hp = gethostbyname(hname);
if (hp != NULL) {
for (ap = hp->h_aliases; *ap; ap++)
- if (wildmat(*ap, cname))
- return 1;
+ if (wildmat(*ap, cname)) {
+ match = 1;
+ goto out;
+ }
}
- return 0;
+out:
+ free(hname);
+ return match;
}
/*
@@ -645,11 +657,9 @@ check_netgroup(const nfs_client *clp, const struct addrinfo *ai)
match = 0;
- hname = strdup(ai->ai_canonname);
- if (hname == NULL) {
- xlog(D_GENERAL, "%s: no memory for strdup", __func__);
+ hname = host_canonname(ai->ai_addr);
+ if (hname == NULL)
goto out;
- }
/* First, try to match the hostname without
* splitting off the domain */

View File

@ -0,0 +1,14 @@
diff -up nfs-utils-2.4.2/systemd/auth-rpcgss-module.service.orig nfs-utils-2.4.2/systemd/auth-rpcgss-module.service
--- nfs-utils-2.4.2/systemd/auth-rpcgss-module.service.orig 2019-11-13 12:09:41.000000000 -0500
+++ nfs-utils-2.4.2/systemd/auth-rpcgss-module.service 2019-12-18 11:32:04.656735515 -0500
@@ -7,8 +7,8 @@
[Unit]
Description=Kernel Module supporting RPCSEC_GSS
DefaultDependencies=no
-Before=gssproxy.service rpc-svcgssd.service rpc-gssd.service
-Wants=gssproxy.service rpc-svcgssd.service rpc-gssd.service
+Before=gssproxy.service rpc-gssd.service
+Wants=gssproxy.service rpc-gssd.service
ConditionPathExists=/etc/krb5.keytab
[Service]

View File

@ -0,0 +1,37 @@
diff -up nfs-utils-2.5.1/tools/mountstats/mountstats.py.orig nfs-utils-2.5.1/tools/mountstats/mountstats.py
--- nfs-utils-2.5.1/tools/mountstats/mountstats.py.orig 2020-09-08 10:59:58.289384682 -0400
+++ nfs-utils-2.5.1/tools/mountstats/mountstats.py 2020-09-08 14:02:05.560514346 -0400
@@ -951,10 +951,11 @@ def print_iostat_summary(old, new, devic
if not old or device not in old:
stats.display_iostats(time)
else:
- old_stats = DeviceData()
- old_stats.parse_stats(old[device])
- diff_stats = stats.compare_iostats(old_stats)
- diff_stats.display_iostats(time)
+ if ("fstype autofs" not in str(old[device])) and ("fstype autofs" not in str(new[device])):
+ old_stats = DeviceData()
+ old_stats.parse_stats(old[device])
+ diff_stats = stats.compare_iostats(old_stats)
+ diff_stats.display_iostats(time)
def iostat_command(args):
"""iostat-like command for NFS mount points
diff -up nfs-utils-2.5.1/tools/nfs-iostat/nfs-iostat.py.orig nfs-utils-2.5.1/tools/nfs-iostat/nfs-iostat.py
--- nfs-utils-2.5.1/tools/nfs-iostat/nfs-iostat.py.orig 2020-09-08 10:59:58.286384653 -0400
+++ nfs-utils-2.5.1/tools/nfs-iostat/nfs-iostat.py 2020-09-08 14:02:05.560514346 -0400
@@ -470,10 +470,13 @@ def parse_stats_file(filename):
def print_iostat_summary(old, new, devices, time, options):
stats = {}
diff_stats = {}
+ devicelist = []
if old:
# Trim device list to only include intersection of old and new data,
# this addresses umounts due to autofs mountpoints
- devicelist = [x for x in old if x in devices]
+ for device in devices:
+ if "fstype autofs" not in str(old[device]):
+ devicelist.append(device)
else:
devicelist = devices

View File

@ -0,0 +1,29 @@
commit 086e6fdce887dd68e51b7bac4a2f21cea9a4fe01
Author: Steve Dickson <steved@redhat.com>
Date: Fri Sep 4 14:15:53 2020 -0400
rpc.idmapd: Do not free config variables
Commit 93e8f092e added a conf_cleanup() call to clean
up memory after the config file was parsed. It turns
out that memory still needed and it is not very much
so the call is removed.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1873965
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c
index f3d2314..51c71fb 100644
--- a/utils/idmapd/idmapd.c
+++ b/utils/idmapd/idmapd.c
@@ -306,9 +306,6 @@ main(int argc, char **argv)
serverstart = 0;
}
- /* Config memory is no longer needed */
- conf_cleanup();
-
while ((opt = getopt(argc, argv, GETOPTSTR)) != -1)
switch (opt) {
case 'v':

3020
nfs-utils-2.5.2-rc4.patch Normal file

File diff suppressed because it is too large Load Diff

2117
nfs-utils.spec Normal file

File diff suppressed because it is too large Load Diff

38
nfs.sysconfig Normal file
View File

@ -0,0 +1,38 @@
#
#
# To set lockd kernel module parameters please see
# /etc/modprobe.d/lockd.conf
#
#
# Optional arguments passed to rpc.nfsd. See rpc.nfsd(8)
RPCNFSDARGS=""
# Number of nfs server processes to be started.
# The default is 8.
# RPCNFSDCOUNT=16
#
# Set V4 grace period in seconds
#NFSD_V4_GRACE=90
#
# Set V4 lease period in seconds
#NFSD_V4_LEASE=90
#
# Optional arguments passed to rpc.mountd. See rpc.mountd(8)
RPCMOUNTDOPTS=""
#
# Optional arguments passed to rpc.statd. See rpc.statd(8)
STATDARGS=""
# Optional arguments passed to sm-notify. See sm-notify(8)
SMNOTIFYARGS=""
#
#
# Optional arguments passed to rpc.idmapd. See rpc.idmapd(8)
RPCIDMAPDARGS=""
#
# Optional arguments passed to rpc.gssd. See rpc.gssd(8)
RPCGSSDARGS=""
# Enable usage of gssproxy. See gssproxy-mech(8).
GSS_USE_PROXY="yes"
#
# Optional arguments passed to blkmapd. See blkmapd(8)
BLKMAPDARGS=""

310
nfsconvert.py Normal file
View File

@ -0,0 +1,310 @@
#!/usr/bin/env python3
"""
Read in the deprecated /etc/sysconfig/nfs file and
set the corresponding values in nfs.conf
"""
from __future__ import print_function
import os
import sys
import getopt
import subprocess
import configparser
CONF_NFS = '/etc/nfs.conf'
CONF_IDMAP = '/etc/idmapd.conf'
SYSCONF_NFS = '/etc/sysconfig/nfs'
SYSCONF_BACKUP = ".rpmsave"
CONF_TOOL = '/usr/sbin/nfsconf'
# options for nfsd found in RPCNFSDARGS
OPTS_NFSD = 'dH:p:rR:N:V:stTuUG:L:'
LONG_NFSD = ['debug', 'host=', 'port=', 'rdma=', 'nfs-version=', 'no-nfs-version=',
'tcp', 'no-tcp', 'udp', 'no-udp', 'grace-time=', 'lease-time=']
CONV_NFSD = {'-d': (CONF_NFS, 'nfsd', 'debug', 'all'),
'-H': (CONF_NFS, 'nfsd', 'host', ','),
'-p': (CONF_NFS, 'nfsd', 'port', '$1'),
'-r': (CONF_NFS, 'nfsd', 'rdma', 'nfsrdma'),
'-R': (CONF_NFS, 'nfsd', 'rdma', '$1'),
'-N': (CONF_NFS, 'nfsd', 'vers$1', 'n'),
'-V': (CONF_NFS, 'nfsd', 'vers$1', 'y'),
'-t': (CONF_NFS, 'nfsd', 'tcp', '1'),
'-T': (CONF_NFS, 'nfsd', 'tcp', '0'),
'-u': (CONF_NFS, 'nfsd', 'udp', '1'),
'-U': (CONF_NFS, 'nfsd', 'udp', '0'),
'-G': (CONF_NFS, 'nfsd', 'grace-time', '$1'),
'-L': (CONF_NFS, 'nfsd', 'lease-time', '$1'),
'$1': (CONF_NFS, 'nfsd', 'threads', '$1'),
'--debug': (CONF_NFS, 'nfsd', 'debug', 'all'),
'--host': (CONF_NFS, 'nfsd', 'host', ','),
'--port': (CONF_NFS, 'nfsd', 'port', '$1'),
'--rdma': (CONF_NFS, 'nfsd', 'rdma', '$1'),
'--no-nfs-version': (CONF_NFS, 'nfsd', 'vers$1', 'n'),
'--nfs-version': (CONF_NFS, 'nfsd', 'vers$1', 'y'),
'--tcp': (CONF_NFS, 'nfsd', 'tcp', '1'),
'--no-tcp': (CONF_NFS, 'nfsd', 'tcp', '0'),
'--udp': (CONF_NFS, 'nfsd', 'udp', '1'),
'--no-udp': (CONF_NFS, 'nfsd', 'udp', '0'),
'--grace-time': (CONF_NFS, 'nfsd', 'grace-time', '$1'),
'--lease-time': (CONF_NFS, 'nfsd', 'lease-time', '$1'),
}
# options for mountd found in RPCMOUNTDOPTS
OPTS_MOUNTD = 'go:d:H:p:N:nrs:t:V:'
LONG_MOUNTD = ['descriptors=', 'debug=', 'nfs-version=', 'no-nfs-version=',
'port=', 'no-tcp', 'ha-callout=', 'state-directory-path=',
'num-threads=', 'reverse-lookup', 'manage-gids', 'no-udp']
CONV_MOUNTD = {'-g': (CONF_NFS, 'mountd', 'manage-gids', '1'),
'-o': (CONF_NFS, 'mountd', 'descriptors', '$1'),
'-d': (CONF_NFS, 'mountd', 'debug', '$1'),
'-H': (CONF_NFS, 'mountd', 'ha-callout', '$1'),
'-p': (CONF_NFS, 'mountd', 'port', '$1'),
'-N': (CONF_NFS, 'nfsd', 'vers$1', 'n'),
'-V': (CONF_NFS, 'nfsd', 'vers$1', 'y'),
'-n': (CONF_NFS, 'nfsd', 'tcp', '0'),
'-s': (CONF_NFS, 'mountd', 'stat-directory-path', '$1'),
'-t': (CONF_NFS, 'mountd', 'threads', '$1'),
'-r': (CONF_NFS, 'mountd', 'reverse-lookup', '1'),
'-u': (CONF_NFS, 'nfsd', 'udp', '0'),
'--manage-gids': (CONF_NFS, 'mountd', 'manage-gids', '1'),
'--descriptors': (CONF_NFS, 'mountd', 'descriptors', '$1'),
'--debug': (CONF_NFS, 'mountd', 'debug', '$1'),
'--ha-callout': (CONF_NFS, 'mountd', 'ha-callout', '$1'),
'--port': (CONF_NFS, 'mountd', 'port', '$1'),
'--nfs-version': (CONF_NFS, 'nfsd', 'vers$1', 'y'),
'--no-nfs-version': (CONF_NFS, 'nfsd', 'vers$1', 'n'),
'--no-tcp': (CONF_NFS, 'nfsd', 'tcp', '0'),
'--state-directory-path': (CONF_NFS, 'mountd', 'state-directory-path', '$1'),
'--num-threads': (CONF_NFS, 'mountd', 'threads', '$1'),
'--reverse-lookup': (CONF_NFS, 'mountd', 'reverse-lookup', '1'),
'--no-udp': (CONF_NFS, 'nfsd', 'udp', '0'),
}
# options for statd found in STATDARG
OPTS_STATD = 'o:p:T:U:n:P:H:'
LONG_STATD = ['outgoing-port=', 'port=', 'name=', 'state-directory-path=',
'ha-callout=', 'nlm-port=', 'nlm-udp-port=']
CONV_STATD = {'-o': (CONF_NFS, 'statd', 'outgoing-port', '$1'),
'-p': (CONF_NFS, 'statd', 'port', '$1'),
'-T': (CONF_NFS, 'lockd', 'port', '$1'),
'-U': (CONF_NFS, 'lockd', 'udp-port', '$1'),
'-n': (CONF_NFS, 'statd', 'name', '$1'),
'-P': (CONF_NFS, 'statd', 'state-directory-path', '$1'),
'-H': (CONF_NFS, 'statd', 'ha-callout', '$1'),
'--outgoing-port': (CONF_NFS, 'statd', 'outgoing-port', '$1'),
'--port': (CONF_NFS, 'statd', 'port', '$1'),
'--name': (CONF_NFS, 'statd', 'name', '$1'),
'--state-directory-path': (CONF_NFS, 'statd', 'state-directory-path', '$1'),
'--ha-callout': (CONF_NFS, 'statd', 'ha-callout', '$1'),
'--nlm-port': (CONF_NFS, 'lockd', 'port', '$1'),
'--nlm-udp-port': (CONF_NFS, 'lockd', 'udp-port', '$1'),
}
# options for sm-notify found in SMNOTIFYARGS
OPTS_SMNOTIFY = 'dm:np:v:P:'
CONV_SMNOTIFY = {'-d': (CONF_NFS, 'sm-notify', 'debug', 'all'),
'-m': (CONF_NFS, 'sm-notify', 'retry-time', '$1'),
'-n': (CONF_NFS, 'sm-notify', 'update-state', '1'),
'-p': (CONF_NFS, 'sm-notify', 'outgoing-port', '$1'),
'-v': (CONF_NFS, 'sm-notify', 'outgoing-addr', '$1'),
'-P': (CONF_NFS, 'statd', 'state-directory-path', '$1'),
}
# options for idmapd found in RPCIDMAPDARGS
OPTS_IDMAPD = 'vp:CS'
CONV_IDMAPD = {'-v': (CONF_IDMAP, 'general', 'verbosity', '+'),
'-p': (CONF_NFS, 'general', 'pipefs-directory', '$1'),
'-C': (CONF_IDMAP, 'general', 'client-only', '1'),
'-S': (CONF_IDMAP, 'general', 'server-only', '1'),
}
# options for gssd found in RPCGSSDARGS
OPTS_GSSD = 'Mnvrp:k:d:t:T:R:lD'
CONV_GSSD = {'-M': (CONF_NFS, 'gssd', 'use-memcache', '1'),
'-n': (CONF_NFS, 'gssd', 'root_uses_machine_creds', '0'),
'-v': (CONF_NFS, 'gssd', 'verbosity', '+'),
'-r': (CONF_NFS, 'gssd', 'rpc-verbosity', '+'),
'-p': (CONF_NFS, 'general', 'pipefs-directory', '$1'),
'-k': (CONF_NFS, 'gssd', 'keytab-file', '$1'),
'-d': (CONF_NFS, 'gssd', 'cred-cache-directory', '$1'),
'-t': (CONF_NFS, 'gssd', 'context-timeout', '$1'),
'-T': (CONF_NFS, 'gssd', 'rpc-timeout', '$1'),
'-R': (CONF_NFS, 'gssd', 'preferred-realm', '$1'),
'-l': (CONF_NFS, 'gssd', 'limit-to-legacy-enctypes', '0'),
'-D': (CONF_NFS, 'gssd', 'avoid-dns', '0'),
}
# options for blkmapd found in BLKMAPDARGS
OPTS_BLKMAPD = ''
CONV_BLKMAPD = {}
# meta list of all the getopt lists
GETOPT_MAPS = [('RPCNFSDARGS', OPTS_NFSD, LONG_NFSD, CONV_NFSD),
('RPCMOUNTDOPTS', OPTS_MOUNTD, LONG_MOUNTD, CONV_MOUNTD),
('STATDARG', OPTS_STATD, LONG_STATD, CONV_STATD),
('STATDARGS', OPTS_STATD, LONG_STATD, CONV_STATD),
('SMNOTIFYARGS', OPTS_SMNOTIFY, [], CONV_SMNOTIFY),
('RPCIDMAPDARGS', OPTS_IDMAPD, [], CONV_IDMAPD),
('RPCGSSDARGS', OPTS_GSSD, [], CONV_GSSD),
('BLKMAPDARGS', OPTS_BLKMAPD, [], CONV_BLKMAPD),
]
# map for all of the single option values
VALUE_MAPS = {'LOCKD_TCPPORT': (CONF_NFS, 'lockd', 'port', '$1'),
'LOCKD_UDPPORT': (CONF_NFS, 'lockd', 'udp-port', '$1'),
'RPCNFSDCOUNT': (CONF_NFS, 'nfsd', 'threads', '$1'),
'NFSD_V4_GRACE': (CONF_NFS, 'nfsd', 'grace-time', '$1'),
'NFSD_V4_LEASE': (CONF_NFS, 'nfsd', 'lease-time', '$1'),
'MOUNTD_PORT': (CONF_NFS, 'mountd', 'port', '$1'),
'STATD_PORT': (CONF_NFS, 'statd', 'port', '$1'),
'STATD_OUTGOING_PORT': (CONF_NFS, 'statd', 'outgoing-port', '$1'),
'STATD_HA_CALLOUT': (CONF_NFS, 'statd', 'ha-callout', '$1'),
'GSS_USE_PROXY': (CONF_NFS, 'gssd', 'use-gss-proxy', '$1')
}
def eprint(*args, **kwargs):
""" Print error to stderr """
print(*args, file=sys.stderr, **kwargs)
def makesub(param, value):
""" Variable substitution """
return param.replace('$1', value)
def set_value(value, entry):
""" Set a configuration value by running nfsconf tool"""
cfile, section, tag, param = entry
tag = makesub(tag, value)
param = makesub(param, value)
if param == '+':
param = value
if param == ',':
param = value
args = [CONF_TOOL, "--file", cfile, "--set", section, tag, param]
try:
subprocess.check_output(args, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
print("Error running nfs-conf tool:\n %s" % (e.output.decode()))
print("Args: %s\n" % args)
raise Exception
def convert_getopt(optname, options, optstring, longopts, conversions):
""" Parse option string into seperate config items
Take a getopt string and a table of conversions
parse it all and spit out the converted config
Keyword arguments:
options -- the argv string to convert
optstring -- getopt format option list
conversions -- table of translations
"""
optcount = 0
try:
args = options.strip('\"').split()
optlist, optargs = getopt.gnu_getopt(args, optstring, longopts=longopts)
except getopt.GetoptError as err:
eprint(err)
raise Exception
setlist = {}
for (k, v) in optlist:
if k in conversions:
# it's already been set once
param = conversions[k][3]
tag = k + makesub(conversions[k][2], v)
if tag in setlist:
value = setlist[tag][0]
# is it a cummulative entry
if param == '+':
value = str(int(value) + 1)
if param == ',':
value += "," + v
else:
if param == '+':
value = "1"
elif param == ',':
value = v
else:
value = v
setlist[tag] = (value, conversions[k])
else:
if v:
eprint("Ignoring unrecognised option %s=%s in %s" % (k, v, optname))
else:
eprint("Ignoring unrecognised option %s in %s" % (k, optname))
for v, c in setlist.values():
try:
set_value(v, c)
optcount += 1
except Exception:
raise
i = 1
for o in optargs:
opname = '$' + str(i)
if opname in conversions:
try:
set_value(o, conversions[opname])
optcount += 1
except Exception:
raise
else:
eprint("Unrecognised trailing arguments")
raise Exception
i += 1
return optcount
def map_values():
""" Main function """
mapcount = 0
# Lets load the old config
with open(SYSCONF_NFS) as cfile:
file_content = '[sysconf]\n' + cfile.read()
sysconfig = configparser.RawConfigParser()
sysconfig.read_string(file_content)
# Map all the getopt option lists
for (name, opts, lopts, conv) in GETOPT_MAPS:
if name in sysconfig['sysconf']:
try:
mapcount += convert_getopt(name, sysconfig['sysconf'][name], opts,
lopts, conv)
except Exception:
eprint("Error whilst converting %s to nfsconf options." % (name))
raise
# Map the single value options
for name, opts in VALUE_MAPS.items():
if name in sysconfig['sysconf']:
try:
value = sysconfig['sysconf'][name]
set_value(value.strip('\"'), opts)
mapcount += 1
except Exception:
raise
# All went well, move aside the old file
# but dont bother if there were no changes and
# an old config file already exists
backupfile = SYSCONF_NFS + SYSCONF_BACKUP
if mapcount > 0 or not os.path.exists(backupfile):
try:
os.replace(SYSCONF_NFS, backupfile)
except OSError as err:
eprint("Error moving old config %s: %s" % (SYSCONF_NFS, err))
raise
# Main routine
try:
map_values()
except Exception as e:
eprint(e)
eprint("Conversion failed. Please correct the error and try again.")
exit(1)

38
nfsconvert.sh Normal file
View File

@ -0,0 +1,38 @@
#!/bin/bash
#
# Convert /etc/sysconfig/nfs values in /etc/nfs.conf valuse
#
#
# No file no conversion
#
if [ ! -f /etc/sysconfig/nfs ]; then
exit 0
fi
#
# See if the conversion happen already
#
grep "nfs.conf" /etc/sysconfig/nfs > /dev/null
if [ $? -eq 0 ]; then
exit 0
fi
if [ -f /etc/nfs.conf.rpmnew ]; then
# See if it is the we want to use
grep tag1234 /etc/nfs.conf.rpmnew > /dev/null
if [ $? -eq 0 ]; then
cp /etc/nfs.conf /etc/nfs.conf.rpmsave
cat /etc/nfs.conf.rpmnew | sed '/tag123/d' > /etc/nfs.conf
rm /etc/nfs.conf.rpmnew
fi
else
cp /etc/nfs.conf /etc/nfs.conf.rpmsave
fi
#
# Do the conversion
#
/usr/sbin/nfsconvert

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (nfs-utils-2.5.1.tar.xz) = 474055f75a2e11e3b4e3f265a4d057157819c8071a98f31f8023109204230f9b4d9ea7568dd6cf207f3f3b164d4d4250f982d32719089dc91ecc2689de52efc1