autofs-5.1.9 - fix incorrect flags update in update_with_defaults()

From: Ian Kent <raven@themaw.net>

After adding support for some additional am-utils map entry options at
least one of them, "nounmount", and probably others don't work in some
cases.

This is because some of them are is implemented using a flag in the map
entry which was incorrectly being cleared during updating the entry with
current defaults.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG           |    1 +
 modules/parse_amd.c |    4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG b/CHANGELOG
index e28a991b4..c52f91123 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -80,6 +80,7 @@
 - fix stale direct mount trigger not umounted on expire.
 - add function table_lookup_ino().
 - improve handling of missing map entry for mount request.
+- fix incorrect flags update in update_with_defaults().
 
 02/11/2023 autofs-5.1.9
 - fix kernel mount status notification.
diff --git a/modules/parse_amd.c b/modules/parse_amd.c
index 6ef1729e9..9ecd33eae 100644
--- a/modules/parse_amd.c
+++ b/modules/parse_amd.c
@@ -661,7 +661,9 @@ static void update_with_defaults(struct amd_entry *defaults,
 		if (deftype != AMD_MOUNT_TYPE_NONE)
 			entry->flags |= (defaults->flags & AMD_MOUNT_TYPE_MASK);
 		else {
-			entry->flags = AMD_MOUNT_TYPE_NFS;
+			unsigned long per_mnt_flags = entry->flags & AMD_MOUNT_OPT_MASK;
+
+			entry->flags = AMD_MOUNT_TYPE_NFS | per_mnt_flags;
 			tmp = strdup("nfs");
 			if (tmp)
 				entry->type = tmp;
