mount.nfs: insert 'sloppy' at beginning of the options (bz 1987070)

Signed-off-by: Steve Dickson <steved@redhat.com>
Resolves: bz1987070
This commit is contained in:
Steve Dickson 2021-08-18 13:55:14 -04:00
parent 0cf132f10c
commit 78e3eab31b
22 changed files with 53 additions and 5752 deletions

View File

@ -1,21 +0,0 @@
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

@ -1,27 +0,0 @@
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

@ -1,42 +0,0 @@
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

@ -1,203 +0,0 @@
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

@ -1,20 +0,0 @@
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

@ -1,412 +0,0 @@
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

@ -1,32 +0,0 @@
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

@ -1,44 +0,0 @@
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

@ -1,43 +0,0 @@
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

@ -1,29 +0,0 @@
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

@ -1,47 +0,0 @@
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

@ -1,118 +0,0 @@
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

@ -1,49 +0,0 @@
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

@ -1,77 +0,0 @@
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

@ -1,83 +0,0 @@
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

@ -1,37 +0,0 @@
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

@ -1,29 +0,0 @@
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':

File diff suppressed because it is too large Load Diff

View File

@ -1,301 +0,0 @@
diff --git a/support/misc/nfsd_path.c b/support/misc/nfsd_path.c
index 8efbfcd..65e53c1 100644
--- a/support/misc/nfsd_path.c
+++ b/support/misc/nfsd_path.c
@@ -110,7 +110,7 @@ nfsd_setup_workqueue(void)
if (!rootdir)
return;
-printf("rootdir %s\n", rootdir);
+
nfsd_wq = xthread_workqueue_alloc();
if (!nfsd_wq)
return;
diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c
index 3d13610..a4ea067 100644
--- a/support/nfs/conffile.c
+++ b/support/nfs/conffile.c
@@ -52,10 +52,14 @@
#include <libgen.h>
#include <sys/file.h>
#include <time.h>
+#include <dirent.h>
#include "conffile.h"
#include "xlog.h"
+#define CONF_FILE_EXT ".conf"
+#define CONF_FILE_EXT_LEN ((int) (sizeof(CONF_FILE_EXT) - 1))
+
#pragma GCC visibility push(hidden)
static void conf_load_defaults(void);
@@ -456,7 +460,7 @@ conf_parse_line(int trans, char *line, const char *filename, int lineno, char **
free(subconf);
} else {
/* XXX Perhaps should we not ignore errors? */
- conf_set(trans, *section, *subsection, line, val, 0, 0);
+ conf_set(trans, *section, *subsection, line, val, 1, 0);
}
}
@@ -577,6 +581,30 @@ static void conf_free_bindings(void)
}
}
+static int
+conf_load_files(int trans, const char *conf_file)
+{
+ char *conf_data;
+ char *section = NULL;
+ char *subsection = NULL;
+
+ conf_data = conf_readfile(conf_file);
+ if (conf_data == NULL)
+ return 1;
+
+ /* Load default configuration values. */
+ conf_load_defaults();
+
+ /* Parse config contents into the transaction queue */
+ conf_parse(trans, conf_data, &section, &subsection, conf_file);
+ if (section)
+ free(section);
+ if (subsection)
+ free(subsection);
+ free(conf_data);
+
+ return 0;
+}
/* Open the config file and map it into our address space, then parse it. */
static int
conf_load_file(const char *conf_file)
@@ -609,18 +637,129 @@ conf_load_file(const char *conf_file)
return 0;
}
+static void
+conf_init_dir(const char *conf_file)
+{
+ struct dirent **namelist = NULL;
+ char *dname, fname[PATH_MAX], *cname;
+ int n = 0, nfiles = 0, i, fname_len, dname_len;
+ int trans, rv, path_len;
+
+ dname = malloc(strlen(conf_file) + 3);
+ if (dname == NULL) {
+ xlog(L_WARNING, "conf_init_dir: malloc: %s", strerror(errno));
+ return;
+ }
+ sprintf(dname, "%s.d", conf_file);
+
+ n = scandir(dname, &namelist, NULL, versionsort);
+ if (n < 0) {
+ if (errno != ENOENT) {
+ xlog(L_WARNING, "conf_init_dir: scandir %s: %s",
+ dname, strerror(errno));
+ }
+ free(dname);
+ return;
+ } else if (n == 0) {
+ free(dname);
+ return;
+ }
+
+ trans = conf_begin();
+ dname_len = strlen(dname);
+ for (i = 0; i < n; i++ ) {
+ struct dirent *d = namelist[i];
+
+ switch (d->d_type) {
+ case DT_UNKNOWN:
+ case DT_REG:
+ case DT_LNK:
+ break;
+ default:
+ continue;
+ }
+ if (*d->d_name == '.')
+ continue;
+
+ fname_len = strlen(d->d_name);
+ path_len = (fname_len + dname_len);
+ if (!fname_len || path_len > PATH_MAX) {
+ xlog(L_WARNING, "conf_init_dir: Too long file name: %s in %s",
+ d->d_name, dname);
+ continue;
+ }
+
+ /*
+ * Check the naming of the file. Only process files
+ * that end with CONF_FILE_EXT
+ */
+ if (fname_len <= CONF_FILE_EXT_LEN) {
+ xlog(D_GENERAL, "conf_init_dir: %s: name too short",
+ d->d_name);
+ continue;
+ }
+ cname = (d->d_name + (fname_len - CONF_FILE_EXT_LEN));
+ if (strcmp(cname, CONF_FILE_EXT) != 0) {
+ xlog(D_GENERAL, "conf_init_dir: %s: invalid file extension",
+ d->d_name);
+ continue;
+ }
+
+ rv = snprintf(fname, PATH_MAX, "%s/%s", dname, d->d_name);
+ if (rv < path_len) {
+ xlog(L_WARNING, "conf_init_dir: file name: %s/%s too short",
+ d->d_name, dname);
+ continue;
+ }
+
+ if (conf_load_files(trans, fname))
+ continue;
+ nfiles++;
+ }
+
+ if (nfiles) {
+ /* Apply the configuration values */
+ conf_end(trans, 1);
+ }
+ for (i = 0; i < n; i++)
+ free(namelist[i]);
+ free(namelist);
+ free(dname);
+
+ return;
+}
+
int
conf_init_file(const char *conf_file)
{
unsigned int i;
+ int ret;
for (i = 0; i < sizeof conf_bindings / sizeof conf_bindings[0]; i++)
LIST_INIT (&conf_bindings[i]);
TAILQ_INIT (&conf_trans_queue);
- if (conf_file == NULL) conf_file=NFS_CONFFILE;
- return conf_load_file(conf_file);
+ if (conf_file == NULL)
+ conf_file=NFS_CONFFILE;
+
+ /*
+ * First parse the give config file
+ * then parse the config.conf.d directory
+ * (if it exists)
+ *
+ */
+ ret = conf_load_file(conf_file);
+
+ /*
+ * When the same variable is set in both files
+ * the conf.d file will override the config file.
+ * This allows automated admin systems to
+ * have the final say.
+ */
+ conf_init_dir(conf_file);
+
+ return ret;
}
/*
diff --git a/systemd/nfs-v4client.target b/systemd/nfs-v4client.target
new file mode 100644
index 0000000..3d1064e
--- /dev/null
+++ b/systemd/nfs-v4client.target
@@ -0,0 +1,12 @@
+[Unit]
+Description=NFS client services
+Before=remote-fs-pre.target
+Wants=remote-fs-pre.target
+
+# GSS services dependencies and ordering
+Wants=auth-rpcgss-module.service
+After=rpc-gssd.service rpc-svcgssd.service gssproxy.service
+
+[Install]
+WantedBy=multi-user.target
+WantedBy=remote-fs.target
diff --git a/systemd/nfs.conf.man b/systemd/nfs.conf.man
index 3f1c726..16e0ec4 100644
--- a/systemd/nfs.conf.man
+++ b/systemd/nfs.conf.man
@@ -265,7 +265,15 @@ Only
is recognized.
.SH FILES
+.TP 10n
.I /etc/nfs.conf
+Default NFS client configuration file
+.TP 10n
+.I /etc/nfs.conf.d
+When this directory exists and files ending
+with ".conf" exist, those files will be
+used to set configuration variables. These
+files will override variables set in /etc/nfs.conf
.SH SEE ALSO
.BR nfsdcltrack (8),
.BR rpc.nfsd (8),
diff --git a/tools/mountstats/mountstats.py b/tools/mountstats/mountstats.py
index 25e92a1..23876fc 100755
--- a/tools/mountstats/mountstats.py
+++ b/tools/mountstats/mountstats.py
@@ -378,7 +378,10 @@ class DeviceData:
print('\t%12s: %s' % (op, " ".join(str(x) for x in self.__rpc_data[op])))
elif vers == '4':
for op in Nfsv4ops:
- print('\t%12s: %s' % (op, " ".join(str(x) for x in self.__rpc_data[op])))
+ try:
+ print('\t%12s: %s' % (op, " ".join(str(x) for x in self.__rpc_data[op])))
+ except KeyError:
+ continue
else:
print('\tnot implemented for version %d' % vers)
print()
diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
index 9d5e575..9fcae0b 100644
--- a/utils/exportfs/exportfs.c
+++ b/utils/exportfs/exportfs.c
@@ -176,10 +176,10 @@ main(int argc, char **argv)
xlog(L_ERROR, "-r and -u are incompatible");
return 1;
}
-printf("point 1\n");
+
if (!setup_state_path_names(progname, ETAB, ETABTMP, ETABLCK, &etab))
return 1;
-printf("point 2\n");
+
if (optind == argc && ! f_all) {
if (force_flush) {
cache_flush(1);
@@ -193,7 +193,6 @@ printf("point 2\n");
return 0;
}
}
-printf("point 3\n");
/*
* Serialize things as best we can
diff --git a/utils/mount/nfsmount.conf.man b/utils/mount/nfsmount.conf.man
index 3aa3456..4f8f351 100644
--- a/utils/mount/nfsmount.conf.man
+++ b/utils/mount/nfsmount.conf.man
@@ -88,6 +88,13 @@ the background (i.e. done asynchronously).
.TP 10n
.I /etc/nfsmount.conf
Default NFS mount configuration file
+.TP 10n
+.I /etc/nfsmount.conf.d
+When this directory exists and files ending
+with ".conf" exist, those files will be
+used to set configuration variables. These
+files will override variables set
+in /etc/nfsmount.conf
.PD
.SH SEE ALSO
.BR nfs (5),

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,44 @@
diff -up nfs-utils-2.5.4/utils/nfsdcltrack/nfsdcltrack.c.orig nfs-utils-2.5.4/utils/nfsdcltrack/nfsdcltrack.c
--- nfs-utils-2.5.4/utils/nfsdcltrack/nfsdcltrack.c.orig 2021-06-10 14:07:47.000000000 -0400
+++ nfs-utils-2.5.4/utils/nfsdcltrack/nfsdcltrack.c 2021-08-18 13:44:11.839124879 -0400
@@ -507,7 +507,7 @@ cltrack_gracedone(const char *timestr)
{
int ret;
char *tail;
- time_t gracetime;
+ uint64_t gracetime;
ret = sqlite_prepare_dbh(storagedir);
diff -up nfs-utils-2.5.4/utils/nfsdcltrack/sqlite.c.orig nfs-utils-2.5.4/utils/nfsdcltrack/sqlite.c
--- nfs-utils-2.5.4/utils/nfsdcltrack/sqlite.c.orig 2021-06-10 14:07:47.000000000 -0400
+++ nfs-utils-2.5.4/utils/nfsdcltrack/sqlite.c 2021-08-18 13:48:16.264408309 -0400
@@ -48,6 +48,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <sqlite3.h>
+#include <stdint.h>
#include <linux/limits.h>
#include "xlog.h"
@@ -539,7 +540,7 @@ out_err:
* remove any client records that were not reclaimed since grace_start.
*/
int
-sqlite_remove_unreclaimed(time_t grace_start)
+sqlite_remove_unreclaimed(uint64_t grace_start)
{
int ret;
char *err = NULL;
diff -up nfs-utils-2.5.4/utils/nfsdcltrack/sqlite.h.orig nfs-utils-2.5.4/utils/nfsdcltrack/sqlite.h
--- nfs-utils-2.5.4/utils/nfsdcltrack/sqlite.h.orig 2021-06-10 14:07:47.000000000 -0400
+++ nfs-utils-2.5.4/utils/nfsdcltrack/sqlite.h 2021-08-18 13:44:11.839124879 -0400
@@ -26,7 +26,7 @@ int sqlite_insert_client(const unsigned
int sqlite_remove_client(const unsigned char *clname, const size_t namelen);
int sqlite_check_client(const unsigned char *clname, const size_t namelen,
const bool has_session);
-int sqlite_remove_unreclaimed(const time_t grace_start);
+int sqlite_remove_unreclaimed(const uint64_t grace_start);
int sqlite_query_reclaiming(const time_t grace_start);
#endif /* _SQLITE_H */

View File

@ -2,7 +2,7 @@ Summary: NFS utilities and supporting clients and daemons for the kernel NFS ser
Name: nfs-utils
URL: http://linux-nfs.org/
Version: 2.5.4
Release: 2%{?dist}
Release: 3%{?dist}
Epoch: 1
# group all 32bit related archs
@ -14,6 +14,11 @@ Source2: lockd.conf
Source3: 24-nfs-server.conf
Source4: 10-nfsv4.conf
#
# RHEL9.0
#
Patch001: nfs-utils-2.5.4-mount-sloppy.patch
Patch100: nfs-utils-1.2.1-statdpath-man.patch
Patch101: nfs-utils-1.2.1-exp-subtree-warn-off.patch
Patch102: nfs-utils-1.2.5-idmap-errmsg.patch
@ -436,6 +441,9 @@ fi
%{_mandir}/*/nfsiostat.8.gz
%changelog
* Wed Aug 18 2021 Steve Dickson <steved@redhat.com> 2.5.4-3
- mount.nfs: insert 'sloppy' at beginning of the options (bz 1987070)
* Mon Aug 16 2021 Steve Dickson <steved@redhat.com> 2.5.4-2
- Remove nfsconvert command (bz 1937811)