- add some upstream fixes for 5.1.4.

This commit is contained in:
Ian Kent 2018-07-03 13:01:57 +08:00
parent 6663c9103f
commit f53fbfd351
7 changed files with 816 additions and 2 deletions

View File

@ -0,0 +1,40 @@
autofs-5.1.4 - add-man page note about extra slashes in paths
From: Ian Kent <raven@themaw.net>
Make note of the effect unnecessary multiple slashes can have in map
paths in auto.master(5).
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
man/auto.master.5.in | 8 ++++++++
2 files changed, 9 insertions(+)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -25,6 +25,7 @@ xx/xx/2018 autofs-5.1.5
- use systemd sd_notify() at startup.
- fix NFS version mask usage.
- fix fd leak in rpc_do_create_client().
+- add-man page note about extra slashes in paths.
19/12/2017 autofs-5.1.4
- fix spec file url.
--- autofs-5.1.4.orig/man/auto.master.5.in
+++ autofs-5.1.4/man/auto.master.5.in
@@ -66,6 +66,14 @@ will process the map according to the sp
map entries. Indirect map entries must be unique in the master map so
second and subsequent entries for an indirect mount point are ignored by
.BR automount (8).
+.TP
+.B NOTE:
+autofs currently does not collapse multiple slashes in paths, so it is
+important to ensure paths used in maps are correct. If unnecessary multiple
+slashes are present in a path it can lead to unexpected failures such as
+an inability to expire automounts. An exception to this is a trailing slash
+at the end of the automount point path in the master map which will be
+removed if present.
.SH "FORMAT"
Master map entries have three fields separated by an arbitrary number
of spaces or tabs. Lines beginning with # are comments. The first field

View File

@ -0,0 +1,136 @@
autofs-5.1.4 - change expire type naming to better reflect usage
From: Ian Kent <raven@themaw.net>
Expires can request different types of expire, currently normal or
immediate (and later force).
Change the naming used in the expire functions to better indicate
usage.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/direct.c | 8 ++++----
daemon/indirect.c | 8 ++++----
daemon/state.c | 4 ++--
include/state.h | 2 +-
5 files changed, 12 insertions(+), 11 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -26,6 +26,7 @@ xx/xx/2018 autofs-5.1.5
- fix NFS version mask usage.
- fix fd leak in rpc_do_create_client().
- add-man page note about extra slashes in paths.
+- change expire type naming to better reflect usage.
19/12/2017 autofs-5.1.4
- fix spec file url.
--- autofs-5.1.4.orig/daemon/direct.c
+++ autofs-5.1.4/daemon/direct.c
@@ -841,7 +841,7 @@ void *expire_proc_direct(void *arg)
struct expire_args ec;
struct autofs_point *ap;
struct mapent *me = NULL;
- unsigned int now;
+ unsigned int how;
int ioctlfd, cur_state;
int status, ret, left;
@@ -852,7 +852,7 @@ void *expire_proc_direct(void *arg)
fatal(status);
ap = ec.ap = ea->ap;
- now = ea->when;
+ how = ea->how;
ec.status = -1;
ea->signaled = 1;
@@ -946,7 +946,7 @@ void *expire_proc_direct(void *arg)
ioctlfd = me->ioctlfd;
- ret = ops->expire(ap->logopt, ioctlfd, next->path, now);
+ ret = ops->expire(ap->logopt, ioctlfd, next->path, how);
if (ret) {
left++;
pthread_setcancelstate(cur_state, NULL);
@@ -972,7 +972,7 @@ void *expire_proc_direct(void *arg)
debug(ap->logopt, "send expire to trigger %s", next->path);
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state);
- ret = ops->expire(ap->logopt, ioctlfd, next->path, now);
+ ret = ops->expire(ap->logopt, ioctlfd, next->path, how);
if (ret)
left++;
pthread_setcancelstate(cur_state, NULL);
--- autofs-5.1.4.orig/daemon/indirect.c
+++ autofs-5.1.4/daemon/indirect.c
@@ -392,7 +392,7 @@ void *expire_proc_indirect(void *arg)
struct mnt_list *mnts = NULL, *next;
struct expire_args *ea;
struct expire_args ec;
- unsigned int now;
+ unsigned int how;
int offsets, submnts, count;
int retries;
int ioctlfd, cur_state;
@@ -405,7 +405,7 @@ void *expire_proc_indirect(void *arg)
fatal(status);
ap = ec.ap = ea->ap;
- now = ea->when;
+ how = ea->how;
ec.status = -1;
ea->signaled = 1;
@@ -530,7 +530,7 @@ void *expire_proc_indirect(void *arg)
debug(ap->logopt, "expire %s", next->path);
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state);
- ret = ops->expire(ap->logopt, ioctlfd, next->path, now);
+ ret = ops->expire(ap->logopt, ioctlfd, next->path, how);
if (ret)
left++;
pthread_setcancelstate(cur_state, NULL);
@@ -544,7 +544,7 @@ void *expire_proc_indirect(void *arg)
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state);
retries = (count_mounts(ap, ap->path, ap->dev) + 1);
while (retries--) {
- ret = ops->expire(ap->logopt, ap->ioctlfd, ap->path, now);
+ ret = ops->expire(ap->logopt, ap->ioctlfd, ap->path, how);
if (ret)
left++;
}
--- autofs-5.1.4.orig/daemon/state.c
+++ autofs-5.1.4/daemon/state.c
@@ -267,7 +267,7 @@ void expire_proc_cleanup(void *arg)
return;
}
-static enum expire expire_proc(struct autofs_point *ap, int now)
+static enum expire expire_proc(struct autofs_point *ap, int how)
{
pthread_t thid;
struct expire_args *ea;
@@ -295,7 +295,7 @@ static enum expire expire_proc(struct au
fatal(status);
ea->ap = ap;
- ea->when = now;
+ ea->how = how;
ea->status = 1;
if (ap->type == LKP_INDIRECT)
--- autofs-5.1.4.orig/include/state.h
+++ autofs-5.1.4/include/state.h
@@ -55,7 +55,7 @@ struct expire_args {
unsigned int signaled;
struct autofs_point *ap; /* autofs mount we are working on */
enum states state; /* State prune or expire */
- unsigned int when; /* Immediate expire ? */
+ unsigned int how; /* Normal, immediate expire ? */
int status; /* Return status */
};

View File

@ -0,0 +1,434 @@
autofs-5.1.4 - covarity fixes 1
From: Ian Kent <raven@themaw.net>
* remove conditional close of nullfd.
* fix memory leak of local_domain in lib/macros.c:macro_init().
* check for NULL prior to several assignments in lib/master_parse.y.
* fix memory leak in lib/mounts.c:add_std_amd_vars().
* add missing break in lib/rpc_subs.c:rpc_get_netid().
* fix variable scope problem in modules/amd_parse.c:make_selector().
* fix selector itself not freed in lib/parse_subs.c:free_selector().
* fix possible memory leak in modules/lookup_ldap.c:parse_ldap_config().
* fix possible memory leak in modules/lookup_ldap.c:decode_percent_hack().
* fix usage of decode_percent_hack() in modules/lookup_ldap.c.
* initialize enc_key1 and enc_key2 in modules/lookup_ldap.c:lookup_one().
* fix double alloc of map_type in modules/parse_amd.c:make_default_entry().
* fix double alloc of map_type in modules/parse_amd.c:get_defaults_entry().
* fix possible memory leak in modules/parse_sun.c:parse_reinit().
* initialize myoptions and ro_loc in modules/parse_sun.c:mount_subtree().
* initialize myoptions and loc in modules/parse_sun.c:parse_mount().
Signed-off-by: Ian Kent <raven@themaw.net>
---
lib/log.c | 3 +--
lib/macros.c | 1 +
lib/master_parse.y | 28 ++++++++++++++++++++++++++++
lib/mounts.c | 4 +++-
lib/parse_subs.c | 1 +
lib/rpc_subs.c | 1 +
modules/amd_parse.y | 4 ++--
modules/lookup_ldap.c | 27 ++++++++++++++++++++++-----
modules/parse_amd.c | 4 ++--
modules/parse_sun.c | 10 +++++++++-
10 files changed, 70 insertions(+), 13 deletions(-)
diff --git a/lib/log.c b/lib/log.c
index 1a0bc3fa..f6ab77c1 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -336,8 +336,7 @@ void log_to_syslog(void)
exit(1);
}
- if (nullfd > 2)
- close(nullfd);
+ close(nullfd);
return;
}
diff --git a/lib/macros.c b/lib/macros.c
index dfdca857..5def26da 100644
--- a/lib/macros.c
+++ b/lib/macros.c
@@ -137,6 +137,7 @@ void macro_init(void)
macro_init_done = 1;
macro_unlock();
+ free(local_domain);
return;
}
diff --git a/lib/master_parse.y b/lib/master_parse.y
index 761ade9b..5d687a70 100644
--- a/lib/master_parse.y
+++ b/lib/master_parse.y
@@ -157,6 +157,8 @@ line:
trim_maptype($2);
+ if (path)
+ free(path);
path = master_strdup($1);
if (!path) {
master_error("memory allocation error");
@@ -167,6 +169,8 @@ line:
if ((tmp = strchr($2, ',')))
*tmp++ = '\0';
+ if (type)
+ free(type);
type = master_strdup($2);
if (!type) {
master_error("memory allocation error");
@@ -174,6 +178,8 @@ line:
YYABORT;
}
if (tmp) {
+ if (format)
+ free(format);
format = master_strdup(tmp);
if (!format) {
master_error("memory allocation error");
@@ -204,6 +210,8 @@ line:
mapspec: map
{
+ if (local_argv)
+ free_argv(local_argc, (const char **) local_argv);
local_argc = tmp_argc;
local_argv = tmp_argv;
tmp_argc = 0;
@@ -211,6 +219,8 @@ mapspec: map
}
| map options
{
+ if (local_argv)
+ free_argv(local_argc, (const char **) local_argv);
local_argc = tmp_argc;
local_argv = tmp_argv;
tmp_argc = 0;
@@ -288,6 +298,8 @@ map: PATH
}
| MAPHOSTS
{
+ if (type)
+ free(type);
type = master_strdup($1 + 1);
if (!type) {
local_free_vars();
@@ -302,6 +314,8 @@ map: PATH
}
| MAPNULL
{
+ if (type)
+ free(type);
type = master_strdup($1 + 1);
if (!type) {
local_free_vars();
@@ -310,6 +324,8 @@ map: PATH
}
| dnattrs
{
+ if (type)
+ free(type);
type = master_strdup("ldap");
if (!type) {
local_free_vars();
@@ -332,6 +348,8 @@ map: PATH
if ((tmp = strchr($1, ',')))
*tmp++ = '\0';
+ if (type)
+ free(type);
if (strcmp($1, "exec"))
type = master_strdup($1);
else
@@ -342,6 +360,8 @@ map: PATH
YYABORT;
}
if (tmp) {
+ if (format)
+ free(format);
format = master_strdup(tmp);
if (!format) {
master_error("memory allocation error");
@@ -366,6 +386,8 @@ map: PATH
if ((tmp = strchr($1, ',')))
*tmp++ = '\0';
+ if (type)
+ free(type);
if (strcmp($1, "exec"))
type = master_strdup($1);
else
@@ -376,6 +398,8 @@ map: PATH
YYABORT;
}
if (tmp) {
+ if (format)
+ free(format);
format = master_strdup(tmp);
if (!format) {
master_error("memory allocation error");
@@ -400,6 +424,8 @@ map: PATH
if ((tmp = strchr($1, ',')))
*tmp++ = '\0';
+ if (type)
+ free(type);
if (strcmp($1, "exec"))
type = master_strdup($1);
else
@@ -410,6 +436,8 @@ map: PATH
YYABORT;
}
if (tmp) {
+ if (format)
+ free(format);
format = master_strdup(tmp);
if (!format) {
master_error("memory allocation error");
diff --git a/lib/mounts.c b/lib/mounts.c
index f46fab2b..a35503bf 100644
--- a/lib/mounts.c
+++ b/lib/mounts.c
@@ -489,8 +489,10 @@ void add_std_amd_vars(struct substvar *sv)
const struct substvar *v = macro_findvar(sv, "domain", 4);
if (v && *v->val) {
tmp = strdup(v->val);
- if (tmp)
+ if (tmp) {
macro_global_addvar("cluster", 7, tmp);
+ free(tmp);
+ }
}
}
diff --git a/lib/parse_subs.c b/lib/parse_subs.c
index 841e81fd..cdda2e1a 100644
--- a/lib/parse_subs.c
+++ b/lib/parse_subs.c
@@ -189,6 +189,7 @@ void free_selector(struct selector *selector)
free(s->func.arg2);
s = next;
}
+ free(selector);
return;
}
diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c
index 9451c455..8b23627a 100644
--- a/lib/rpc_subs.c
+++ b/lib/rpc_subs.c
@@ -389,6 +389,7 @@ static enum clnt_stat rpc_get_netid(const sa_family_t family,
}
*netid = nc_netid;
+ break;
}
endnetconfig(handle);
free(nc_proto);
diff --git a/modules/amd_parse.y b/modules/amd_parse.y
index 1d72f190..5bd688d9 100644
--- a/modules/amd_parse.y
+++ b/modules/amd_parse.y
@@ -822,13 +822,13 @@ static int make_selector(char *name,
if (!value1)
tmp = NULL;
else {
- char *tmp = amd_strdup(value1);
+ tmp = amd_strdup(value1);
if (!tmp)
goto error;
}
s->func.arg1 = tmp;
} else if (s->sel->flags & SEL_FLAG_FUNC2) {
- char *tmp = amd_strdup(value1);
+ tmp = amd_strdup(value1);
if (!tmp)
goto error;
s->func.arg1 = tmp;
diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
index 37810e1c..06c96973 100644
--- a/modules/lookup_ldap.c
+++ b/modules/lookup_ldap.c
@@ -1137,6 +1137,7 @@ int parse_ldap_config(unsigned logopt, struct lookup_context *ctxt)
error(logopt,
MODPREFIX "stat(2) failed with error %s.",
strerror(errno));
+ free(auth_conf);
return 0;
}
@@ -1148,6 +1149,7 @@ int parse_ldap_config(unsigned logopt, struct lookup_context *ctxt)
"Please make sure that it is owned by root, group "
"is root, and the mode is 0600.",
auth_conf);
+ free(auth_conf);
return -1;
}
@@ -1182,9 +1184,11 @@ int parse_ldap_config(unsigned logopt, struct lookup_context *ctxt)
goto out;
}
- if (!usetls || ctxt->port == LDAPS_PORT)
+ if (!usetls || ctxt->port == LDAPS_PORT) {
use_tls = LDAP_TLS_DONT_USE;
- else {
+ if (usetls)
+ free(usetls);
+ } else {
if (!strcasecmp(usetls, "yes"))
use_tls = LDAP_TLS_INIT;
else if (!strcasecmp(usetls, "no"))
@@ -1194,6 +1198,7 @@ int parse_ldap_config(unsigned logopt, struct lookup_context *ctxt)
MODPREFIX
"The usetls property must have value "
"\"yes\" or \"no\".");
+ free(usetls);
ret = -1;
goto out;
}
@@ -1221,6 +1226,7 @@ int parse_ldap_config(unsigned logopt, struct lookup_context *ctxt)
MODPREFIX
"The tlsrequired property must have value "
"\"yes\" or \"no\".");
+ free(tlsrequired);
ret = -1;
goto out;
}
@@ -1252,6 +1258,7 @@ int parse_ldap_config(unsigned logopt, struct lookup_context *ctxt)
MODPREFIX
"The authrequired property must have value "
"\"yes\", \"no\", \"autodetect\", or \"simple\".");
+ free(authrequired);
ret = -1;
goto out;
}
@@ -1338,6 +1345,7 @@ auth_fail:
(void)get_property(logopt, root, "credentialcache", &client_cc);
ctxt->auth_conf = auth_conf;
+ auth_conf = NULL;
ctxt->use_tls = use_tls;
ctxt->tls_required = tls_required;
ctxt->auth_required = auth_required;
@@ -1375,8 +1383,12 @@ auth_fail:
user, secret ? "specified" : "unspecified",
client_princ, client_cc);
}
+ if (authtype)
+ free(authtype);
out:
xmlFreeDoc(doc);
+ if (auth_conf)
+ free(auth_conf);
if (fallback)
return 0;
@@ -1986,7 +1998,7 @@ int lookup_read_master(struct master *master, time_t age, void *context)
}
} else if (count == 1) {
dec_len = decode_percent_hack(keyValue[0], &key);
- if (dec_len < 0) {
+ if (dec_len <= 0) {
error(logopt, MODPREFIX
"invalid map key %s - ignoring",
*keyValue);
@@ -1994,7 +2006,7 @@ int lookup_read_master(struct master *master, time_t age, void *context)
}
} else {
dec_len = decode_percent_hack(keyValue[0], &key);
- if (dec_len < 0) {
+ if (dec_len <= 0) {
error(logopt, MODPREFIX
"invalid map key %s - ignoring",
*keyValue);
@@ -2004,7 +2016,7 @@ int lookup_read_master(struct master *master, time_t age, void *context)
for (i = 1; i < count; i++) {
char *k;
dec_len = decode_percent_hack(keyValue[i], &k);
- if (dec_len < 0) {
+ if (dec_len <= 0) {
error(logopt, MODPREFIX
"invalid map key %s - ignoring",
*keyValue);
@@ -2159,6 +2171,8 @@ static int decode_percent_hack(const char *name, char **key)
*key = NULL;
len = get_percent_decoded_len(name);
+ if (!len)
+ return 0;
new = malloc(len + 1);
if (!new)
return -1;
@@ -2998,6 +3012,9 @@ static int lookup_one(struct autofs_point *ap, struct map_source *source,
attrs[1] = info;
attrs[2] = NULL;
+ enc_key1 = NULL;
+ enc_key2 = NULL;
+
if (*qKey == '*' && qKey_len == 1)
*qKey = '/';
else if (!strcasecmp(class, "nisObject")) {
diff --git a/modules/parse_amd.c b/modules/parse_amd.c
index 9543ced3..ea57270a 100644
--- a/modules/parse_amd.c
+++ b/modules/parse_amd.c
@@ -1879,7 +1879,7 @@ struct amd_entry *make_default_entry(struct autofs_point *ap,
*/
map_type = conf_amd_get_map_type(ap->path);
if (map_type)
- defaults_entry->map_type = strdup(map_type);
+ defaults_entry->map_type = map_type;
/* The list should now be empty .... */
free_amd_entry_list(&dflts);
return defaults_entry;
@@ -2006,7 +2006,7 @@ static struct amd_entry *get_defaults_entry(struct autofs_point *ap,
*/
char *map_type = conf_amd_get_map_type(ap->path);
if (map_type)
- entry->map_type = strdup(map_type);
+ entry->map_type = map_type;
}
free(expand);
}
diff --git a/modules/parse_sun.c b/modules/parse_sun.c
index 536a9bc1..88dde0b2 100644
--- a/modules/parse_sun.c
+++ b/modules/parse_sun.c
@@ -443,8 +443,10 @@ int parse_reinit(int argc, const char *const *argv, void **context)
*new = default_context;
- if (do_init(argc, argv, new))
+ if (do_init(argc, argv, new)) {
+ free(new);
return 1;
+ }
kill_context(ctxt);
@@ -1143,6 +1145,9 @@ static int mount_subtree(struct autofs_point *ap, struct mapent *me,
const char *root;
int ro_len;
+ myoptions = NULL;
+ ro_loc = NULL;
+
rv = parse_mapent(ro->mapent,
options, &myoptions, &ro_loc, ap->logopt);
if (!rv) {
@@ -1524,6 +1529,9 @@ dont_expand:
p += l;
p = skipspace(p);
+ myoptions = NULL;
+ loc = NULL;
+
l = parse_mapent(p, options, &myoptions, &loc, ap->logopt);
if (!l) {
cache_delete_offset_list(mc, name);

View File

@ -0,0 +1,42 @@
autofs-5.1.4 - fix age setting at startup
From: Ian Kent <raven@themaw.net>
Commit 2b567ace7d, which resets the master map list on startup
when before retrying a read, incorrectly sets age using time()
when it should use monotonic_time().
This causes lookup failures for submounts in cases where a master
map read retry was needed.
The failure happens becuase the mount entry age is greater than
the map entry age which is meant to indicate the map is no longer
valid which is not the case.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/automount.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -29,6 +29,7 @@ xx/xx/2018 autofs-5.1.5
- change expire type naming to better reflect usage.
- use defines for expire type.
- make umount_ent() recognise forced umount.
+- fix age setting at startup.
19/12/2017 autofs-5.1.4
- fix spec file url.
--- autofs-5.1.4.orig/daemon/automount.c
+++ autofs-5.1.4/daemon/automount.c
@@ -2606,7 +2606,7 @@ int main(int argc, char *argv[])
* we have anyway.
*/
do_master_list_reset(master_list);
- age = time(NULL);
+ age = monotonic_time(NULL);
master_read_master(master_list, age, 1);
}
}

View File

@ -0,0 +1,41 @@
autofs-5.1.4 - make umount_ent() recognise forced umount
From: Ian Kent <raven@themaw.net>
When doing a forced shutdown umount_ent() tries a normal expire
first resulting in a fair amount of unnecessary log noise.
Change umount_ent() to do a forced expire when a forced shutdown
has been requested to avoid the log noise.
Signed-off-by: Ian Kent <raven@themaw.net>
---
lib/mounts.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
--- autofs-5.1.4.orig/lib/mounts.c
+++ autofs-5.1.4/lib/mounts.c
@@ -2029,14 +2029,16 @@ int umount_ent(struct autofs_point *ap,
{
int rv;
- rv = spawn_umount(ap->logopt, path, NULL);
- /* We are doing a forced shutcwdown down so unlink busy mounts */
- if (rv && (ap->state == ST_SHUTDOWN_FORCE || ap->state == ST_SHUTDOWN)) {
- if (ap->state == ST_SHUTDOWN_FORCE) {
- info(ap->logopt, "forcing umount of %s", path);
- rv = spawn_umount(ap->logopt, "-l", path, NULL);
- }
+ if (ap->state != ST_SHUTDOWN_FORCE)
+ rv = spawn_umount(ap->logopt, path, NULL);
+ else {
+ /* We are doing a forced shutdown so unlink busy
+ * mounts */
+ info(ap->logopt, "forcing umount of %s", path);
+ rv = spawn_umount(ap->logopt, "-l", path, NULL);
+ }
+ if (rv && (ap->state == ST_SHUTDOWN_FORCE || ap->state == ST_SHUTDOWN)) {
/*
* Verify that we actually unmounted the thing. This is a
* belt and suspenders approach to not eating user data.

View File

@ -0,0 +1,100 @@
autofs-5.1.4 - use defines for expire type
From: Ian Kent <raven@themaw.net>
The kernel defines for expire type such as an immediate expire
shoule be used to clearify what is being requested.
AUTOFS_EXP_IMMEDIATE corresponds to a SIGUSR1 prune operation.
AUTOFS_EXP_FORCE corresponds to an expire type not yet implemented in
the kernel, a SIGUSR2 forced expire. Define it in our internal autofs
kernel include file, the kernel will ignore it if it doesn't support it.
AUTOFS_EXP_LEAVES is no longer used in autofs version 5.
Finally add a define AUTOFS_EXP_NORMAL to indicate we're perfoming a
normal expire.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/state.c | 8 ++++----
include/linux/auto_fs4.h | 6 ++++--
include/state.h | 2 +-
4 files changed, 10 insertions(+), 7 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -27,6 +27,7 @@ xx/xx/2018 autofs-5.1.5
- fix fd leak in rpc_do_create_client().
- add-man page note about extra slashes in paths.
- change expire type naming to better reflect usage.
+- use defines for expire type.
19/12/2017 autofs-5.1.4
- fix spec file url.
--- autofs-5.1.4.orig/daemon/state.c
+++ autofs-5.1.4/daemon/state.c
@@ -645,7 +645,7 @@ static unsigned int st_prepare_shutdown(
ap->state = ST_SHUTDOWN_PENDING;
/* Unmount everything */
- exp = expire_proc(ap, 1);
+ exp = expire_proc(ap, AUTOFS_EXP_IMMEDIATE);
switch (exp) {
case EXP_ERROR:
case EXP_PARTIAL:
@@ -671,7 +671,7 @@ static unsigned int st_force_shutdown(st
ap->state = ST_SHUTDOWN_FORCE;
/* Unmount everything */
- exp = expire_proc(ap, 1);
+ exp = expire_proc(ap, AUTOFS_EXP_FORCE | AUTOFS_EXP_IMMEDIATE);
switch (exp) {
case EXP_ERROR:
case EXP_PARTIAL:
@@ -706,7 +706,7 @@ static unsigned int st_prune(struct auto
assert(ap->state == ST_READY);
ap->state = ST_PRUNE;
- switch (expire_proc(ap, 1)) {
+ switch (expire_proc(ap, AUTOFS_EXP_IMMEDIATE)) {
case EXP_ERROR:
case EXP_PARTIAL:
if (!ap->submount)
@@ -727,7 +727,7 @@ static unsigned int st_expire(struct aut
assert(ap->state == ST_READY);
ap->state = ST_EXPIRE;
- switch (expire_proc(ap, 0)) {
+ switch (expire_proc(ap, AUTOFS_EXP_NORMAL)) {
case EXP_ERROR:
case EXP_PARTIAL:
if (!ap->submount)
--- autofs-5.1.4.orig/include/linux/auto_fs4.h
+++ autofs-5.1.4/include/linux/auto_fs4.h
@@ -27,8 +27,10 @@
#define AUTOFS_PROTO_SUBVERSION 2
/* Mask for expire behaviour */
-#define AUTOFS_EXP_IMMEDIATE 1
-#define AUTOFS_EXP_LEAVES 2
+#define AUTOFS_EXP_NORMAL 0x00
+#define AUTOFS_EXP_IMMEDIATE 0x01
+#define AUTOFS_EXP_LEAVES 0x02
+#define AUTOFS_EXP_FORCE 0x04
#define AUTOFS_TYPE_ANY 0U
#define AUTOFS_TYPE_INDIRECT 1U
--- autofs-5.1.4.orig/include/state.h
+++ autofs-5.1.4/include/state.h
@@ -55,7 +55,7 @@ struct expire_args {
unsigned int signaled;
struct autofs_point *ap; /* autofs mount we are working on */
enum states state; /* State prune or expire */
- unsigned int how; /* Normal, immediate expire ? */
+ unsigned int how; /* Normal, immediate, forced expire ? */
int status; /* Return status */
};

View File

@ -8,7 +8,7 @@
Summary: A tool for automatically mounting and unmounting filesystems
Name: autofs
Version: 5.1.4
Release: 17%{?dist}
Release: 18%{?dist}
Epoch: 1
License: GPLv2+
Group: System Environment/Daemons
@ -39,6 +39,12 @@ Patch23: autofs-5.1.4-add-units-After-line-to-include-statd-service.patch
Patch24: autofs-5.1.4-use-systemd-sd_notify-at-startup.patch
Patch25: autofs-5.1.4-fix-NFS-version-mask-usage.patch
Patch26: autofs-5.1.4-fix-fd-leak-in-rpc_do_create_client.patch
Patch27: autofs-5.1.4-add-man-page-note-about-extra-slashes-in-paths.patch
Patch28: autofs-5.1.4-covarity-fixes-1.patch
Patch29: autofs-5.1.4-change-expire-type-naming-to-better-reflect-usage.patch
Patch30: autofs-5.1.4-use-defines-for-expire-type.patch
Patch31: autofs-5.1.4-make-umount_ent-recognise-forced-umount.patch
Patch32: autofs-5.1.4-fix-age-setting-at-startup.patch
%if %{with_systemd}
BuildRequires: systemd-units
@ -125,10 +131,16 @@ echo %{version}-%{release} > .version
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%build
LDFLAGS=-Wl,-z,now
%configure --disable-mount-locking --enable-ignore-busy --with-libtirpc %{?systemd_configure_arg:}
%configure --disable-mount-locking --enable-ignore-busy --enable-forced-shutdown --with-libtirpc %{?systemd_configure_arg:}
make initdir=%{_initrddir} DONTSTRIP=1
%install
@ -219,6 +231,15 @@ fi
%dir /etc/auto.master.d
%changelog
* Tue Jul 03 2018 Ian Kent <ikent@redhat.com> - 1:5.1.4-18
- add man page note about extra slashes in paths.
- add a number of covarity identified fixes.
- change expire type naming to better reflect usage.
- use defines for expire type.
- make umount_ent() recognise forced umount.
- enable SIGUSR2 handling in rpm spec file.
- fix age setting at startup.
* Thu May 17 2018 Ian Kent <ikent@redhat.com> - 1:5.1.4-17
- fix fd leak in rpc_do_create_client().