Blob Blame History Raw
autofs-5.0.9 - amd lookup allow amd maps to use exec in master map

From: Ian Kent <raven@themaw.net>

Amd uses the keyword exec for program maps (as it has a program mount
type). Allow the use of the exec keyword to be used for executable
maps in amd format master map entries. So just allow the keyword exec
to be used as a synonym of program for both sun and amd format map
entries since exec isn't otherwise used in master map entries.
---
 lib/master_parse.y   |   15 ++++++++++++---
 lib/master_tok.l     |    2 +-
 man/auto.master.5.in |    2 ++
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/lib/master_parse.y b/lib/master_parse.y
index 03aedf7..e31023d 100644
--- a/lib/master_parse.y
+++ b/lib/master_parse.y
@@ -329,7 +329,10 @@ map:	PATH
 		if ((tmp = strchr($1, ',')))
 			*tmp++ = '\0';
 
-		type = master_strdup($1);
+		if (strcmp($1, "exec"))
+			type = master_strdup($1);
+		else
+			type = master_strdup("program");
 		if (!type) {
 			master_error("memory allocation error");
 			local_free_vars();
@@ -360,7 +363,10 @@ map:	PATH
 		if ((tmp = strchr($1, ',')))
 			*tmp++ = '\0';
 
-		type = master_strdup($1);
+		if (strcmp($1, "exec"))
+			type = master_strdup($1);
+		else
+			type = master_strdup("program");
 		if (!type) {
 			master_error("memory allocation error");
 			local_free_vars();
@@ -391,7 +397,10 @@ map:	PATH
 		if ((tmp = strchr($1, ',')))
 			*tmp++ = '\0';
 
-		type = master_strdup($1);
+		if (strcmp($1, "exec"))
+			type = master_strdup($1);
+		else
+			type = master_strdup("program");
 		if (!type) {
 			master_error("memory allocation error");
 			local_free_vars();
diff --git a/lib/master_tok.l b/lib/master_tok.l
index d43c1dd..9ba53f6 100644
--- a/lib/master_tok.l
+++ b/lib/master_tok.l
@@ -119,7 +119,7 @@ DNNAMESTR2	([[:alnum:]_.\-]+)
 INTMAP		(-hosts|-null)
 MULTI		((multi)(,(sun|hesiod))?(:{OPTWS}|{WS}))
 MULTISEP	([\-]{2}[[:blank:]]+)
-MTYPE		((file|program|sss|yp|nis|nisplus|ldap|ldaps|hesiod|userdir)(,(sun|hesiod|amd))?(:{OPTWS}|{WS}))
+MTYPE		((file|program|exec|sss|yp|nis|nisplus|ldap|ldaps|hesiod|userdir)(,(sun|hesiod|amd))?(:{OPTWS}|{WS}))
 
 
 OPTTOUT		(-t{OPTWS}|-t{OPTWS}={OPTWS}|--timeout{OPTWS}|--timeout{OPTWS}={OPTWS})
diff --git a/man/auto.master.5.in b/man/auto.master.5.in
index 2267550..83be83c 100644
--- a/man/auto.master.5.in
+++ b/man/auto.master.5.in
@@ -93,6 +93,8 @@ The map is a regular text file.
 .B program
 The map is an executable program, which is passed a key on the command
 line and returns an entry (everything besides the key) on stdout if successful.
+Optinally, the keyword exec may be used as a synonym for program to avoid
+confusion with amd formated maps mount type program.
 .TP
 .B yp
 The map is a NIS (YP) database.