[PATCH] Make colon mandatory after map type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

[This bug was found and fixed by Werner Fink <werner@xxxxxxx>, I'm just the
messenger.]

When the extension of the map file name is equal to the map type name,
the automounter will fail to parse the master map.

How to reproduce:

# cat /etc/auto.master
/media/autofs file:/etc/autofs.file --timeout=5 --ghost
# cat /etc/auto.file
test	server:/nfs

// start the daemon and check the logs:
Aug 24 13:13:43 lotus automount[9719]: ghosting enabled
Aug 24 13:13:43 lotus automount[9719]: master_do_mount: mounting /media/autofs
Aug 24 13:13:43 lotus automount[9719]: automount_path_to_fifo: fifo
name /run/autofs.fifo-media-autofs
Aug 24 13:13:43 lotus automount[9719]: lookup_nss_read_map: reading
map file /etc/autofs.sfil
Aug 24 13:13:43 lotus automount[9719]: lookup(file): file map
/etc/autofs.sfil missing or not readable
Aug 24 13:13:43 lotus automount[9719]: do_read_map: lookup module file failed
Aug 24 13:13:43 lotus automount[9719]: mount_autofs_indirect: failed
to read map for /media/autofs
Aug 24 13:13:43 lotus automount[9719]: handle_mounts: mount of
/media/autofs failed!
Aug 24 13:13:43 lotus automount[9719]: master_do_mount: failed to startup mount

To fix the problem we can make the colon after the map-type non-optional,
here's the patch:

From: Werner Fink <werner@xxxxxxx>

When the map file has the same extension as the used map type the
token parser should be able to handle this.  Therefore make the
colon as described in the manual page not optional if a map type
is specified.

Additionally, fix a redefinition warning in the 'min' macro.

Index: autofs-5.0.7/lib/master_tok.l
===================================================================
--- autofs-5.0.7.orig/lib/master_tok.l
+++ autofs-5.0.7/lib/master_tok.l
@@ -116,9 +116,9 @@ DNNAMESTR1	([[:alnum:]_.\- ]+)
 DNNAMESTR2	([[:alnum:]_.\-]+)

 INTMAP		(-hosts|-null)
-MULTI		((multi)(,(sun|hesiod))?(:{OPTWS}|{WS}))
+MULTI		((multi)(,(sun|hesiod))?(:{OPTWS}))
 MULTISEP	([\-]{2}[[:blank:]]+)
-MTYPE		((file|program|sss|yp|nis|nisplus|ldap|ldaps|hesiod|userdir)(,(sun|hesiod))?(:{OPTWS}|{WS}))
+MTYPE		((file|program|sss|yp|nis|nisplus|ldap|ldaps|hesiod|userdir)(,(sun|hesiod))?(:{OPTWS}))


 OPTTOUT		(-t{OPTWS}|-t{OPTWS}={OPTWS}|--timeout{OPTWS}|--timeout{OPTWS}={OPTWS})
@@ -431,7 +431,9 @@ void master_set_scan_buffer(const char *
 	line_lim = line + strlen(buffer) + 1;
 }

-#define min(a,b) (((a) < (b)) ? (a) : (b))
+#ifndef min
+# define min(a,b) (((a) < (b)) ? (a) : (b))
+#endif

 int my_yyinput(char *buffer, int max_size)
 {
--
To unsubscribe from this list: send the line "unsubscribe autofs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux Ext4]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux