import nfs-utils-2.5.4-5.el9

This commit is contained in:
CentOS Sources 2021-11-03 21:13:58 -04:00 committed by Stepan Oksanichenko
commit bee38ec553
17 changed files with 2803 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/nfs-utils-2.5.4.tar.xz

1
.nfs-utils.metadata Normal file
View File

@ -0,0 +1 @@
1b097d511c85f95671619f51b37abd75d56ea777 SOURCES/nfs-utils-2.5.4.tar.xz

9
SOURCES/10-nfsv4.conf Normal file
View File

@ -0,0 +1,9 @@
[ NFSMount_Global_Options ]
# This statically named section defines global mount
# options that can be applied on all NFS mount.
#
# Setting this option makes it mandatory the server supports the
# given version. The mount will fail if the given version is
# not support by the server.
Nfsvers=4

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
SOURCES/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
SOURCES/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

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.5.4/utils/statd/sm-notify.man.orig nfs-utils-2.5.4/utils/statd/sm-notify.man
--- nfs-utils-2.5.4/utils/statd/sm-notify.man.orig 2021-06-10 14:07:47.000000000 -0400
+++ nfs-utils-2.5.4/utils/statd/sm-notify.man 2021-06-24 14:46:32.413626193 -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,
@@ -338,13 +338,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.5.4/utils/statd/statd.man.orig nfs-utils-2.5.4/utils/statd/statd.man
--- nfs-utils-2.5.4/utils/statd/statd.man.orig 2021-06-10 14:07:47.000000000 -0400
+++ nfs-utils-2.5.4/utils/statd/statd.man 2021-06-24 14:46:32.414626197 -0400
@@ -251,7 +251,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,
@@ -431,13 +431,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 /run/run.statd.pid

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,11 @@
diff -up nfs-utils-2.5.2/systemd/nfs-server.service.orig nfs-utils-2.5.2/systemd/nfs-server.service
--- nfs-utils-2.5.2/systemd/nfs-server.service.orig 2020-12-16 12:31:27.677558163 -0500
+++ nfs-utils-2.5.2/systemd/nfs-server.service 2020-12-16 12:33:56.751806659 -0500
@@ -23,6 +23,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,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,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,131 @@
diff --git a/support/nfsidmap/nss.c b/support/nfsidmap/nss.c
index 669760b7..0f43076e 100644
--- a/support/nfsidmap/nss.c
+++ b/support/nfsidmap/nss.c
@@ -365,10 +365,8 @@ static int _nss_name_to_gid(char *name, gid_t *gid, int dostrip)
out_buf:
free(buf);
out_name:
- if (dostrip)
- free(localname);
- if (get_reformat_group())
- free(ref_name);
+ free(localname);
+ free(ref_name);
out:
return err;
}
diff --git a/support/nfsidmap/regex.c b/support/nfsidmap/regex.c
index fdbb2e2f..958b4ac8 100644
--- a/support/nfsidmap/regex.c
+++ b/support/nfsidmap/regex.c
@@ -157,6 +157,7 @@ again:
IDMAP_LOG(4, ("regexp_getpwnam: name '%s' mapped to '%s'",
name, localname));
+ free(localname);
*err_p = 0;
return pw;
diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
index 4113cbab..833d8e01 100644
--- a/utils/gssd/gssd.c
+++ b/utils/gssd/gssd.c
@@ -1016,7 +1016,7 @@ read_gss_conf(void)
keytabfile = s;
s = conf_get_str("gssd", "cred-cache-directory");
if (s)
- ccachedir = s;
+ ccachedir = strdup(s);
s = conf_get_str("gssd", "preferred-realm");
if (s)
preferred_realm = s;
@@ -1070,7 +1070,8 @@ main(int argc, char *argv[])
keytabfile = optarg;
break;
case 'd':
- ccachedir = optarg;
+ free(ccachedir);
+ ccachedir = strdup(optarg);
break;
case 't':
context_timeout = atoi(optarg);
@@ -1133,7 +1134,6 @@ main(int argc, char *argv[])
}
if (ccachedir) {
- char *ccachedir_copy;
char *ptr;
for (ptr = ccachedir, i = 2; *ptr; ptr++)
@@ -1141,8 +1141,7 @@ main(int argc, char *argv[])
i++;
ccachesearch = malloc(i * sizeof(char *));
- ccachedir_copy = strdup(ccachedir);
- if (!ccachedir_copy || !ccachesearch) {
+ if (!ccachesearch) {
printerr(0, "malloc failure\n");
exit(EXIT_FAILURE);
}
@@ -1274,6 +1273,7 @@ main(int argc, char *argv[])
free(preferred_realm);
free(ccachesearch);
+ free(ccachedir);
return rc < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}
diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
index c5f1152e..6d059f33 100644
--- a/utils/gssd/krb5_util.c
+++ b/utils/gssd/krb5_util.c
@@ -1129,6 +1129,12 @@ query_krb5_ccache(const char* cred_cache, char **ret_princname,
*str = '\0';
*ret_princname = strdup(princstring);
*ret_realm = strdup(str+1);
+ if (!*ret_princname || !*ret_realm) {
+ free(*ret_princname);
+ free(*ret_realm);
+ *ret_princname = NULL;
+ *ret_realm = NULL;
+ }
}
k5_free_unparsed_name(context, princstring);
}
@@ -1350,15 +1356,19 @@ gssd_get_krb5_machine_cred_list(char ***list)
if (retval)
continue;
if (i + 1 > listsize) {
+ char **tmplist;
listsize += listinc;
- l = (char **)
+ tmplist = (char **)
realloc(l, listsize * sizeof(char *));
- if (l == NULL) {
+ if (tmplist == NULL) {
+ gssd_free_krb5_machine_cred_list(l);
retval = ENOMEM;
goto out_lock;
}
+ l = tmplist;
}
if ((l[i++] = strdup(ple->ccname)) == NULL) {
+ gssd_free_krb5_machine_cred_list(l);
retval = ENOMEM;
goto out_lock;
}
diff --git a/utils/mountd/rmtab.c b/utils/mountd/rmtab.c
index 2da97615..752fdb66 100644
--- a/utils/mountd/rmtab.c
+++ b/utils/mountd/rmtab.c
@@ -233,6 +233,9 @@ mountlist_list(void)
m->ml_directory = strdup(rep->r_path);
if (m->ml_hostname == NULL || m->ml_directory == NULL) {
+ free(m->ml_hostname);
+ free(m->ml_directory);
+ free(m);
mountlist_freeall(mlist);
mlist = NULL;
xlog(L_ERROR, "%s: memory allocation failed",

View File

@ -0,0 +1,69 @@
commit 4dd8d833c9350d42528ada0fd65aee41b712f41d
Author: Steve Dickson <steved@redhat.com>
Date: Tue Jul 20 17:14:04 2021 -0400
mount.nfs: Fix the sloppy option processing
The new mount API broke how the sloppy option is parsed.
So the option processing needs to be moved up in
the mount.nfs command.
The option needs to be the first option in the string
that is passed into the kernel with the -s mount(8)
and/or the -o sloppy is used.
Commit 92b664ef fixed the process of the -s flag
and this version fixes the -o sloppy processing
as well works when libmount-mount is and is not
enabled plus cleans up the mount options passed
to the kernel.
Reviewed-and-tested-by: Dave Wysochanski <dwysocha@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/utils/mount/nfs.man b/utils/mount/nfs.man
index f98cb47d..f1b76936 100644
--- a/utils/mount/nfs.man
+++ b/utils/mount/nfs.man
@@ -555,6 +555,13 @@ using the FS-Cache facility. See cachefilesd(8)
and <kernel_source>/Documentation/filesystems/caching
for detail on how to configure the FS-Cache facility.
Default value is nofsc.
+.TP 1.5i
+.B sloppy
+The
+.B sloppy
+option is an alternative to specifying
+.BR mount.nfs " -s " option.
+
.SS "Options for NFS versions 2 and 3 only"
Use these options, along with the options in the above subsection,
for NFS versions 2 and 3 only.
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index 82b054a5..fa67a66f 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -339,11 +339,19 @@ static int nfs_verify_lock_option(struct mount_options *options)
static int nfs_insert_sloppy_option(struct mount_options *options)
{
- if (!sloppy || linux_version_code() < MAKE_VERSION(2, 6, 27))
+ if (linux_version_code() < MAKE_VERSION(2, 6, 27))
return 1;
- if (po_insert(options, "sloppy") == PO_FAILED)
- return 0;
+ if (po_contains(options, "sloppy")) {
+ po_remove_all(options, "sloppy");
+ sloppy++;
+ }
+
+ if (sloppy) {
+ if (po_insert(options, "sloppy") == PO_FAILED)
+ return 0;
+ }
+
return 1;
}

View File

@ -0,0 +1,86 @@
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 */
diff --git a/utils/nfsdcltrack/nfsdcltrack.c b/utils/nfsdcltrack/nfsdcltrack.c
index 2f8bea81..7c1c4bcc 100644
--- a/utils/nfsdcltrack/nfsdcltrack.c
+++ b/utils/nfsdcltrack/nfsdcltrack.c
@@ -33,6 +33,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
+#include <inttypes.h>
#include <unistd.h>
#include <libgen.h>
#include <sys/inotify.h>
@@ -525,7 +526,7 @@ cltrack_gracedone(const char *timestr)
if (*tail)
return -EINVAL;
- xlog(D_GENERAL, "%s: grace done. gracetime=%ld", __func__, gracetime);
+ xlog(D_GENERAL, "%s: grace done. gracetime=%"PRIu64, __func__, gracetime);
ret = sqlite_remove_unreclaimed(gracetime);
diff --git a/utils/nfsdcltrack/sqlite.c b/utils/nfsdcltrack/sqlite.c
index b6573544..78c22af8 100644
--- a/utils/nfsdcltrack/sqlite.c
+++ b/utils/nfsdcltrack/sqlite.c
@@ -46,6 +46,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
+#include <inttypes.h>
#include <unistd.h>
#include <sqlite3.h>
#include <stdint.h>
@@ -545,7 +546,7 @@ sqlite_remove_unreclaimed(uint64_t grace_start)
int ret;
char *err = NULL;
- ret = snprintf(buf, sizeof(buf), "DELETE FROM clients WHERE time < %ld",
+ ret = snprintf(buf, sizeof(buf), "DELETE FROM clients WHERE time < %"PRIu64,
grace_start);
if (ret < 0) {
return ret;

2250
SPECS/nfs-utils.spec Normal file

File diff suppressed because it is too large Load Diff