d50c5c1730
- Update to version 2.5.4-rc4 to get all recent fixes: e4ce810a Move declaration of etab and rmtab into libraries 7a4e2d1d Remove 'force' arg from cache_flush() c5528f40 Fix NFSv4 export of tmpfs filesystems ed83085f gssd: use mutex to protect decrement of refcount 972dba0f nfs-utils: Enable the retrieval of raw config settings without expansion 964f4861 nfs-utils: Factor out common structure cleanup calls 8219bdb0 Replace all /var/run with /run 81727afe Fix `statx()` emulation breaking exports a41afe9e mountd/exports: Fix typo in the man page 2f669b6f NFS server should enable RDMA by default d77ece22 mountd/exportd: only log confirmed clients, and poll for updates ac266e2e exportfs: fix unexporting of '/' 7abd15e3 nfsdclnts: Ignore SIGPIPE signal edeb3815 mountd: add logging of NFSv4 clients attaching and detaching. f8e2c8d4 mountd: make default ttl settable by option cc150093 mountd: add --cache-use-ipaddr option to force use_ipaddr c7a954ae mountd: add logging for authentication results for accesses. 1a8156f8 mountd/exports: update man page fec7347e mountd: Don't proactively add export info when fh info is requested. a72c151f mountd: reject unknown client IP when !use_ipaddr. 05bacfed gssd: Add options to rpc.gssd to allow for the use of $HOME/.k5identity files 7e559dbd exportd: server-side gid management - 0001-Replace-all-var-run-with-run.patch is now part of nfs-utils-2-5-4-rc3.patch OBS-URL: https://build.opensuse.org/request/show/895195 OBS-URL: https://build.opensuse.org/package/show/Base:System/nfs-utils?expand=0&rev=240
484 lines
14 KiB
Diff
484 lines
14 KiB
Diff
Commits:
|
|
972dba0f nfs-utils: Enable the retrieval of raw config settings without expansion
|
|
964f4861 nfs-utils: Factor out common structure cleanup calls
|
|
8219bdb0 Replace all /var/run with /run
|
|
81727afe Fix `statx()` emulation breaking exports
|
|
a41afe9e mountd/exports: Fix typo in the man page
|
|
|
|
diff --git a/support/include/conffile.h b/support/include/conffile.h
|
|
index 7d974fe9..c4a3ca62 100644
|
|
--- a/support/include/conffile.h
|
|
+++ b/support/include/conffile.h
|
|
@@ -61,6 +61,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 char *conf_get_entry(const char *, const char *, const char *);
|
|
extern int conf_init_file(const char *);
|
|
extern void conf_cleanup(void);
|
|
extern int conf_match_num(const char *, const char *, int);
|
|
diff --git a/support/misc/xstat.c b/support/misc/xstat.c
|
|
index a438fbcc..6f751f7f 100644
|
|
--- a/support/misc/xstat.c
|
|
+++ b/support/misc/xstat.c
|
|
@@ -85,6 +85,7 @@ int xlstat(const char *pathname, struct stat *statbuf)
|
|
return 0;
|
|
else if (errno != ENOSYS)
|
|
return -1;
|
|
+ errno = 0;
|
|
return fstatat(AT_FDCWD, pathname, statbuf, AT_NO_AUTOMOUNT |
|
|
AT_SYMLINK_NOFOLLOW);
|
|
}
|
|
@@ -95,6 +96,7 @@ int xstat(const char *pathname, struct stat *statbuf)
|
|
return 0;
|
|
else if (errno != ENOSYS)
|
|
return -1;
|
|
+ errno = 0;
|
|
return fstatat(AT_FDCWD, pathname, statbuf, AT_NO_AUTOMOUNT);
|
|
}
|
|
|
|
diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c
|
|
index a4ea0676..fd4a17ad 100644
|
|
--- a/support/nfs/conffile.c
|
|
+++ b/support/nfs/conffile.c
|
|
@@ -132,6 +132,39 @@ conf_hash(const char *s)
|
|
return hash;
|
|
}
|
|
|
|
+/*
|
|
+ * free all the component parts of a conf_binding struct
|
|
+ */
|
|
+static void free_confbind(struct conf_binding *cb)
|
|
+{
|
|
+ if (!cb)
|
|
+ return;
|
|
+ if (cb->section)
|
|
+ free(cb->section);
|
|
+ if (cb->arg)
|
|
+ free(cb->arg);
|
|
+ if (cb->tag)
|
|
+ free(cb->tag);
|
|
+ if (cb->value)
|
|
+ free(cb->value);
|
|
+ free(cb);
|
|
+}
|
|
+
|
|
+static void free_conftrans(struct conf_trans *ct)
|
|
+{
|
|
+ if (!ct)
|
|
+ return;
|
|
+ if (ct->section)
|
|
+ free(ct->section);
|
|
+ if (ct->arg)
|
|
+ free(ct->arg);
|
|
+ if (ct->tag)
|
|
+ free(ct->tag);
|
|
+ if (ct->value)
|
|
+ free(ct->value);
|
|
+ free(ct);
|
|
+}
|
|
+
|
|
/*
|
|
* Insert a tag-value combination from LINE (the equal sign is at POS)
|
|
*/
|
|
@@ -147,11 +180,7 @@ conf_remove_now(const char *section, const char *tag)
|
|
&& strcasecmp(cb->tag, tag) == 0) {
|
|
LIST_REMOVE(cb, link);
|
|
xlog(LOG_INFO,"[%s]:%s->%s removed", section, tag, cb->value);
|
|
- free(cb->section);
|
|
- free(cb->arg);
|
|
- free(cb->tag);
|
|
- free(cb->value);
|
|
- free(cb);
|
|
+ free_confbind(cb);
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -171,11 +200,7 @@ conf_remove_section_now(const char *section)
|
|
unseen = 0;
|
|
LIST_REMOVE(cb, link);
|
|
xlog(LOG_INFO, "[%s]:%s->%s removed", section, cb->tag, cb->value);
|
|
- free(cb->section);
|
|
- free(cb->arg);
|
|
- free(cb->tag);
|
|
- free(cb->value);
|
|
- free(cb);
|
|
+ free_confbind(cb);
|
|
}
|
|
}
|
|
return unseen;
|
|
@@ -571,11 +596,7 @@ static void conf_free_bindings(void)
|
|
for (; cb; cb = next) {
|
|
next = LIST_NEXT(cb, link);
|
|
LIST_REMOVE(cb, link);
|
|
- free(cb->section);
|
|
- free(cb->arg);
|
|
- free(cb->tag);
|
|
- free(cb->value);
|
|
- free(cb);
|
|
+ free_confbind(cb);
|
|
}
|
|
LIST_INIT(&conf_bindings[i]);
|
|
}
|
|
@@ -774,11 +795,7 @@ conf_cleanup(void)
|
|
for (node = TAILQ_FIRST(&conf_trans_queue); node; node = next) {
|
|
next = TAILQ_NEXT(node, link);
|
|
TAILQ_REMOVE (&conf_trans_queue, node, link);
|
|
- if (node->section) free(node->section);
|
|
- if (node->arg) free(node->arg);
|
|
- if (node->tag) free(node->tag);
|
|
- if (node->value) free(node->value);
|
|
- free (node);
|
|
+ free_conftrans(node);
|
|
}
|
|
TAILQ_INIT(&conf_trans_queue);
|
|
}
|
|
@@ -874,6 +891,29 @@ conf_get_str_with_def(const char *section, const char *tag, char *def)
|
|
return result;
|
|
}
|
|
|
|
+/*
|
|
+ * Retrieve an entry without interpreting its contents
|
|
+ */
|
|
+char *
|
|
+conf_get_entry(const char *section, const char *arg, const char *tag)
|
|
+{
|
|
+ struct conf_binding *cb;
|
|
+
|
|
+ cb = LIST_FIRST (&conf_bindings[conf_hash (section)]);
|
|
+ for (; cb; cb = LIST_NEXT (cb, link)) {
|
|
+ if (strcasecmp(section, cb->section) != 0)
|
|
+ continue;
|
|
+ if (arg && (cb->arg == NULL || strcasecmp(arg, cb->arg) != 0))
|
|
+ continue;
|
|
+ if (!arg && cb->arg)
|
|
+ continue;
|
|
+ if (strcasecmp(tag, cb->tag) != 0)
|
|
+ continue;
|
|
+ return cb->value;
|
|
+ }
|
|
+ return 0;
|
|
+}
|
|
+
|
|
/*
|
|
* Find a section that may or may not have an argument
|
|
*/
|
|
@@ -1144,14 +1184,7 @@ conf_set(int transaction, const char *section, const char *arg,
|
|
return 0;
|
|
|
|
fail:
|
|
- if (node->tag)
|
|
- free(node->tag);
|
|
- if (node->arg)
|
|
- free(node->arg);
|
|
- if (node->section)
|
|
- free(node->section);
|
|
- if (node)
|
|
- free(node);
|
|
+ free_conftrans(node);
|
|
return 1;
|
|
}
|
|
|
|
@@ -1177,10 +1210,7 @@ conf_remove(int transaction, const char *section, const char *tag)
|
|
return 0;
|
|
|
|
fail:
|
|
- if (node && node->section)
|
|
- free (node->section);
|
|
- if (node)
|
|
- free (node);
|
|
+ free_conftrans(node);
|
|
return 1;
|
|
}
|
|
|
|
@@ -1201,8 +1231,7 @@ conf_remove_section(int transaction, const char *section)
|
|
return 0;
|
|
|
|
fail:
|
|
- if (node)
|
|
- free(node);
|
|
+ free_conftrans(node);
|
|
return 1;
|
|
}
|
|
|
|
@@ -1233,15 +1262,7 @@ conf_end(int transaction, int commit)
|
|
}
|
|
}
|
|
TAILQ_REMOVE (&conf_trans_queue, node, link);
|
|
- if (node->section)
|
|
- free(node->section);
|
|
- if (node->arg)
|
|
- free(node->arg);
|
|
- if (node->tag)
|
|
- free(node->tag);
|
|
- if (node->value)
|
|
- free(node->value);
|
|
- free (node);
|
|
+ free_conftrans(node);
|
|
}
|
|
}
|
|
return 0;
|
|
diff --git a/support/nfs/getport.c b/support/nfs/getport.c
|
|
index e458d8fe..813f7bf9 100644
|
|
--- a/support/nfs/getport.c
|
|
+++ b/support/nfs/getport.c
|
|
@@ -904,7 +904,7 @@ int nfs_getport_ping(struct sockaddr *sap, const socklen_t salen,
|
|
* listen on AF_LOCAL.
|
|
*
|
|
* If that doesn't work (for example, if portmapper is running, or rpcbind
|
|
- * isn't listening on /var/run/rpcbind.sock), send a query via UDP to localhost
|
|
+ * isn't listening on /run/rpcbind.sock), send a query via UDP to localhost
|
|
* (UDP doesn't leave a socket in TIME_WAIT, and the timeout is a relatively
|
|
* short 3 seconds).
|
|
*/
|
|
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
|
|
index 57af37b1..e47ad135 100644
|
|
--- a/tests/test-lib.sh
|
|
+++ b/tests/test-lib.sh
|
|
@@ -56,5 +56,5 @@ start_statd() {
|
|
|
|
# shut down statd
|
|
kill_statd() {
|
|
- kill `cat /var/run/rpc.statd.pid`
|
|
+ kill `cat /run/rpc.statd.pid`
|
|
}
|
|
diff --git a/tools/nfsconf/nfsconf.man b/tools/nfsconf/nfsconf.man
|
|
index 30791988..d44e86fb 100644
|
|
--- a/tools/nfsconf/nfsconf.man
|
|
+++ b/tools/nfsconf/nfsconf.man
|
|
@@ -11,6 +11,12 @@ nfsconf \- Query various NFS configuration settings
|
|
.IR infile.conf ]
|
|
.RI [ outfile ]
|
|
.P
|
|
+.B nfsconf \-\-entry
|
|
+.RB [ \-\-arg
|
|
+.IR subsection]
|
|
+.IR section
|
|
+.IR tag
|
|
+.P
|
|
.B nfsconf \-\-get
|
|
.RB [ \-v | \-\-verbose ]
|
|
.RB [ \-f | \-\-file
|
|
@@ -58,6 +64,8 @@ from a range of nfs-utils configuration files.
|
|
The following modes are available:
|
|
.IP "\fB\-d, \-\-dump\fP"
|
|
Output an alphabetically sorted dump of the current configuration in conf file format. Accepts an optional filename in which to write the output.
|
|
+.IP "\fB\-e, \-\-entry\fP"
|
|
+retrieve the config entry rather than its current expanded value
|
|
.IP "\fB\-i, \-\-isset\fP"
|
|
Test if a specific tag has a value set.
|
|
.IP "\fB\-g, \-\-get\fP"
|
|
@@ -75,7 +83,7 @@ Increase verbosity and print debugging information.
|
|
.B \-f, \-\-file \fIinfile\fR
|
|
Select a different config file to operate upon, default is
|
|
.I /etc/nfs.conf
|
|
-.SS Options only valid in \fB\-\-get\fR and \fB\-\-isset\fR modes.
|
|
+.SS Options only valid in \fB\-\-entry\fR and \fB\-\-get\fR and \fB\-\-isset\fR modes.
|
|
.TP
|
|
.B \-a, \-\-arg \fIsubsection\fR
|
|
Select a specific sub-section
|
|
diff --git a/tools/nfsconf/nfsconfcli.c b/tools/nfsconf/nfsconfcli.c
|
|
index 361d386e..b2ef96d1 100644
|
|
--- a/tools/nfsconf/nfsconfcli.c
|
|
+++ b/tools/nfsconf/nfsconfcli.c
|
|
@@ -11,6 +11,7 @@
|
|
typedef enum {
|
|
MODE_NONE,
|
|
MODE_GET,
|
|
+ MODE_ENTRY,
|
|
MODE_ISSET,
|
|
MODE_DUMP,
|
|
MODE_SET,
|
|
@@ -30,6 +31,8 @@ static void usage(const char *name)
|
|
fprintf(stderr, " Outputs the configuration to the named file\n");
|
|
fprintf(stderr, " --get [--arg subsection] {section} {tag}\n");
|
|
fprintf(stderr, " Output one specific config value\n");
|
|
+ fprintf(stderr, " --entry [--arg subsection] {section} {tag}\n");
|
|
+ fprintf(stderr, " Output the uninterpreted config entry\n");
|
|
fprintf(stderr, " --isset [--arg subsection] {section} {tag}\n");
|
|
fprintf(stderr, " Return code indicates if config value is present\n");
|
|
fprintf(stderr, " --set [--arg subsection] {section} {tag} {value}\n");
|
|
@@ -55,6 +58,7 @@ int main(int argc, char **argv)
|
|
int index = 0;
|
|
struct option long_options[] = {
|
|
{"get", no_argument, 0, 'g' },
|
|
+ {"entry", no_argument, 0, 'e' },
|
|
{"set", no_argument, 0, 's' },
|
|
{"unset", no_argument, 0, 'u' },
|
|
{"arg", required_argument, 0, 'a' },
|
|
@@ -66,7 +70,7 @@ int main(int argc, char **argv)
|
|
{NULL, 0, 0, 0 }
|
|
};
|
|
|
|
- c = getopt_long(argc, argv, "gsua:id::f:vm:", long_options, &index);
|
|
+ c = getopt_long(argc, argv, "gesua:id::f:vm:", long_options, &index);
|
|
if (c == -1) break;
|
|
|
|
switch (c) {
|
|
@@ -86,6 +90,9 @@ int main(int argc, char **argv)
|
|
case 'g':
|
|
mode = MODE_GET;
|
|
break;
|
|
+ case 'e':
|
|
+ mode = MODE_ENTRY;
|
|
+ break;
|
|
case 's':
|
|
mode = MODE_SET;
|
|
break;
|
|
@@ -167,8 +174,8 @@ int main(int argc, char **argv)
|
|
if (dumpfile)
|
|
fclose(out);
|
|
} else
|
|
- /* --iset and --get share a lot of code */
|
|
- if (mode == MODE_GET || mode == MODE_ISSET) {
|
|
+ /* --isset and --get share a lot of code */
|
|
+ if (mode == MODE_GET || mode == MODE_ISSET || mode == MODE_ENTRY) {
|
|
char * section = NULL;
|
|
char * tag = NULL;
|
|
const char * val;
|
|
@@ -186,14 +193,17 @@ int main(int argc, char **argv)
|
|
tag = argv[optind++];
|
|
|
|
/* retrieve the specified tags value */
|
|
- val = conf_get_section(section, arg, tag);
|
|
+ if (mode == MODE_ENTRY)
|
|
+ val = conf_get_entry(section, arg, tag);
|
|
+ else
|
|
+ val = conf_get_section(section, arg, tag);
|
|
if (val != NULL) {
|
|
/* ret=0, success, mode --get wants to output the value as well */
|
|
- if (mode == MODE_GET)
|
|
+ if (mode != MODE_ISSET)
|
|
printf("%s\n", val);
|
|
} else {
|
|
/* ret=1, no value found, tell the user if they asked */
|
|
- if (mode == MODE_GET && verbose)
|
|
+ if (mode != MODE_ISSET && verbose)
|
|
fprintf(stderr, "Tag '%s' not found\n", tag);
|
|
ret = 1;
|
|
}
|
|
diff --git a/utils/blkmapd/device-discovery.c b/utils/blkmapd/device-discovery.c
|
|
index f5f9b10b..77ebe736 100644
|
|
--- a/utils/blkmapd/device-discovery.c
|
|
+++ b/utils/blkmapd/device-discovery.c
|
|
@@ -64,7 +64,7 @@
|
|
#define EVENT_BUFSIZE (1024 * EVENT_SIZE)
|
|
|
|
#define RPCPIPE_DIR "/var/lib/nfs/rpc_pipefs"
|
|
-#define PID_FILE "/var/run/blkmapd.pid"
|
|
+#define PID_FILE "/run/blkmapd.pid"
|
|
|
|
#define CONF_SAVE(w, f) do { \
|
|
char *p = f; \
|
|
diff --git a/utils/exportd/exportd.man b/utils/exportd/exportd.man
|
|
index b238ff05..fae434b5 100644
|
|
--- a/utils/exportd/exportd.man
|
|
+++ b/utils/exportd/exportd.man
|
|
@@ -14,7 +14,7 @@ is used to manage NFSv4 exports.
|
|
The NFS server
|
|
.RI ( nfsd )
|
|
maintains a cache of authentication and authorization information which
|
|
-is used to identify the source of each requent, and then what access
|
|
+is used to identify the source of each request, and then what access
|
|
permissions that source has to any local filesystem. When required
|
|
information is not found in the cache, the server sends a request to
|
|
.B nfsv4.exportd
|
|
@@ -134,7 +134,7 @@ listing exports, export options, and access control lists
|
|
.BR exports (5),
|
|
.BR showmount (8),
|
|
.BR nfs.conf (5),
|
|
-.BR firwall-cmd (1),
|
|
+.BR firewall-cmd (1),
|
|
.sp
|
|
RFC 7530 - "Network File System (NFS) Version 4 Protocol"
|
|
.br
|
|
diff --git a/utils/mountd/mountd.man b/utils/mountd/mountd.man
|
|
index 1155cf94..77e6299a 100644
|
|
--- a/utils/mountd/mountd.man
|
|
+++ b/utils/mountd/mountd.man
|
|
@@ -19,7 +19,7 @@ clients and provides details of access permissions.
|
|
The NFS server
|
|
.RI ( nfsd )
|
|
maintains a cache of authentication and authorization information which
|
|
-is used to identify the source of each requent, and then what access
|
|
+is used to identify the source of each request, and then what access
|
|
permissions that source has to any local filesystem. When required
|
|
information is not found in the cache, the server sends a request to
|
|
.B mountd
|
|
diff --git a/utils/statd/sm-notify.c b/utils/statd/sm-notify.c
|
|
index 606b912d..ed82b8f2 100644
|
|
--- a/utils/statd/sm-notify.c
|
|
+++ b/utils/statd/sm-notify.c
|
|
@@ -901,7 +901,7 @@ find_host(uint32_t xid)
|
|
}
|
|
|
|
/*
|
|
- * Record pid in /var/run/sm-notify.pid
|
|
+ * Record pid in /run/sm-notify.pid
|
|
* This file should remain until a reboot, even if the
|
|
* program exits.
|
|
* If file already exists, fail.
|
|
@@ -913,7 +913,7 @@ static int record_pid(void)
|
|
int fd;
|
|
|
|
(void)snprintf(pid, sizeof(pid), "%d\n", (int)getpid());
|
|
- fd = open("/var/run/sm-notify.pid", O_CREAT|O_EXCL|O_WRONLY, 0600);
|
|
+ fd = open("/run/sm-notify.pid", O_CREAT|O_EXCL|O_WRONLY, 0600);
|
|
if (fd < 0)
|
|
return 0;
|
|
|
|
diff --git a/utils/statd/start-statd b/utils/statd/start-statd
|
|
index 54ced822..2baf73c3 100755
|
|
--- a/utils/statd/start-statd
|
|
+++ b/utils/statd/start-statd
|
|
@@ -1,18 +1,18 @@
|
|
#!/bin/sh
|
|
# nfsmount calls this script when mounting a filesystem with locking
|
|
# enabled, but when statd does not seem to be running (based on
|
|
-# /var/run/rpc.statd.pid).
|
|
+# /run/rpc.statd.pid).
|
|
# It should run statd with whatever flags are apropriate for this
|
|
# site.
|
|
PATH="/sbin:/usr/sbin:/bin:/usr/bin"
|
|
|
|
# Use flock to serialize the running of this script
|
|
-exec 9> /var/run/rpc.statd.lock
|
|
+exec 9> /run/rpc.statd.lock
|
|
flock -e 9
|
|
|
|
-if [ -s /var/run/rpc.statd.pid ] &&
|
|
- [ 1`cat /var/run/rpc.statd.pid` -gt 1 ] &&
|
|
- kill -0 `cat /var/run/rpc.statd.pid` > /dev/null 2>&1
|
|
+if [ -s /run/rpc.statd.pid ] &&
|
|
+ [ 1`cat /run/rpc.statd.pid` -gt 1 ] &&
|
|
+ kill -0 `cat /run/rpc.statd.pid` > /dev/null 2>&1
|
|
then
|
|
# statd already running - must have been slow to respond.
|
|
exit 0
|
|
diff --git a/utils/statd/statd.c b/utils/statd/statd.c
|
|
index 32169d47..a469a67a 100644
|
|
--- a/utils/statd/statd.c
|
|
+++ b/utils/statd/statd.c
|
|
@@ -161,7 +161,7 @@ usage(void)
|
|
fprintf(stderr," -H Specify a high-availability callout program.\n");
|
|
}
|
|
|
|
-static const char *pidfile = "/var/run/rpc.statd.pid";
|
|
+static const char *pidfile = "/run/rpc.statd.pid";
|
|
|
|
int pidfd = -1;
|
|
static void create_pidfile(void)
|
|
diff --git a/utils/statd/statd.man b/utils/statd/statd.man
|
|
index ecd3e889..7441ffde 100644
|
|
--- a/utils/statd/statd.man
|
|
+++ b/utils/statd/statd.man
|
|
@@ -440,7 +440,7 @@ directory containing notify list
|
|
.I /var/lib/nfs/state
|
|
NSM state number for this host
|
|
.TP 2.5i
|
|
-.I /var/run/run.statd.pid
|
|
+.I /run/run.statd.pid
|
|
pid file
|
|
.TP 2.5i
|
|
.I /etc/netconfig
|