|
|
4d476f |
autofs-5.0.9 - amd lookup add handling of unhandled options
|
|
|
4d476f |
|
|
|
4d476f |
From: Ian Kent <raven@themaw.net>
|
|
|
4d476f |
|
|
|
4d476f |
There are a number of map options that are either not yet implemented
|
|
|
4d476f |
or aren't planned on being supported.
|
|
|
4d476f |
|
|
|
4d476f |
Add log message feedback for these.
|
|
|
4d476f |
---
|
|
|
4d476f |
modules/amd_parse.y | 84 +++++++++++++++++++++++++++++++++++++++++++++++++--
|
|
|
4d476f |
modules/amd_tok.l | 12 +++++--
|
|
|
4d476f |
2 files changed, 90 insertions(+), 6 deletions(-)
|
|
|
4d476f |
|
|
|
4d476f |
diff --git a/modules/amd_parse.y b/modules/amd_parse.y
|
|
|
4d476f |
index cd69c49..77adbe5 100644
|
|
|
4d476f |
--- a/modules/amd_parse.y
|
|
|
4d476f |
+++ b/modules/amd_parse.y
|
|
|
4d476f |
@@ -28,6 +28,7 @@
|
|
|
4d476f |
|
|
|
4d476f |
#include "automount.h"
|
|
|
4d476f |
#include "parse_amd.h"
|
|
|
4d476f |
+#include "log.h"
|
|
|
4d476f |
|
|
|
4d476f |
#define MAX_OPTS_LEN 1024
|
|
|
4d476f |
#define MAX_ERR_LEN 512
|
|
|
4d476f |
@@ -45,6 +46,7 @@ static void local_free_vars(void);
|
|
|
4d476f |
|
|
|
4d476f |
static int amd_error(const char *s);
|
|
|
4d476f |
static int amd_notify(const char *s);
|
|
|
4d476f |
+static int amd_info(const char *s);
|
|
|
4d476f |
static int amd_msg(const char *s);
|
|
|
4d476f |
|
|
|
4d476f |
static int add_location(void);
|
|
|
4d476f |
@@ -59,6 +61,7 @@ static struct autofs_point *pap;
|
|
|
4d476f |
struct substvar *psv;
|
|
|
4d476f |
static char opts[MAX_OPTS_LEN];
|
|
|
4d476f |
static void prepend_opt(char *, char *);
|
|
|
4d476f |
+static char msg_buf[MAX_ERR_LEN];
|
|
|
4d476f |
|
|
|
4d476f |
#define YYDEBUG 0
|
|
|
4d476f |
|
|
|
4d476f |
@@ -99,6 +102,7 @@ static int amd_fprintf(FILE *, char *, ...);
|
|
|
4d476f |
|
|
|
4d476f |
%token <strtype> MAP_OPTION
|
|
|
4d476f |
%token <strtype> MAP_TYPE
|
|
|
4d476f |
+%token <strtype> CACHE_OPTION
|
|
|
4d476f |
%token <strtype> FS_TYPE
|
|
|
4d476f |
%token <strtype> FS_OPTION
|
|
|
4d476f |
%token <strtype> FS_OPT_VALUE
|
|
|
4d476f |
@@ -259,6 +263,20 @@ option_assignment: MAP_OPTION OPTION_ASSIGN FS_TYPE
|
|
|
4d476f |
!strcmp($3, "ext4")) {
|
|
|
4d476f |
entry.flags |= AMD_MOUNT_TYPE_EXT;
|
|
|
4d476f |
entry.type = amd_strdup($3);
|
|
|
4d476f |
+ } else if (!strcmp($3, "jfs") ||
|
|
|
4d476f |
+ !strcmp($3, "linkx") ||
|
|
|
4d476f |
+ !strcmp($3, "nfsx") ||
|
|
|
4d476f |
+ !strcmp($3, "nfsl") ||
|
|
|
4d476f |
+ !strcmp($3, "program") ||
|
|
|
4d476f |
+ !strcmp($3, "lustre") ||
|
|
|
4d476f |
+ !strcmp($3, "direct")) {
|
|
|
4d476f |
+ sprintf(msg_buf, "file system type %s is "
|
|
|
4d476f |
+ "not yet implemented", $3);
|
|
|
4d476f |
+ amd_msg(msg_buf);
|
|
|
4d476f |
+ YYABORT;
|
|
|
4d476f |
+ } else if (!strcmp($3, "cachefs")) {
|
|
|
4d476f |
+ sprintf(msg_buf, "file syatem %s is not "
|
|
|
4d476f |
+ "supported by autofs, ignored", $3);
|
|
|
4d476f |
} else {
|
|
|
4d476f |
amd_notify($1);
|
|
|
4d476f |
YYABORT;
|
|
|
4d476f |
@@ -275,7 +293,18 @@ option_assignment: MAP_OPTION OPTION_ASSIGN FS_TYPE
|
|
|
4d476f |
else if (!strcmp($3, "exec"))
|
|
|
4d476f |
/* autofs uses "program" for "exec" map type */
|
|
|
4d476f |
entry.map_type = amd_strdup("program");
|
|
|
4d476f |
- else {
|
|
|
4d476f |
+ else if (!strcmp($3, "passwd")) {
|
|
|
4d476f |
+ sprintf(msg_buf, "map type %s is "
|
|
|
4d476f |
+ "not yet implemented", $3);
|
|
|
4d476f |
+ amd_msg(msg_buf);
|
|
|
4d476f |
+ YYABORT;
|
|
|
4d476f |
+ } else if (!strcmp($3, "ndbm") ||
|
|
|
4d476f |
+ !strcmp($3, "union")) {
|
|
|
4d476f |
+ sprintf(msg_buf, "map type %s is not "
|
|
|
4d476f |
+ "supported by autofs", $3);
|
|
|
4d476f |
+ amd_msg(msg_buf);
|
|
|
4d476f |
+ YYABORT;
|
|
|
4d476f |
+ } else {
|
|
|
4d476f |
amd_notify($1);
|
|
|
4d476f |
YYABORT;
|
|
|
4d476f |
}
|
|
|
4d476f |
@@ -304,7 +333,17 @@ option_assignment: MAP_OPTION OPTION_ASSIGN FS_TYPE
|
|
|
4d476f |
entry.rfs = amd_strdup($3);
|
|
|
4d476f |
else if (!strcmp($1, "dev"))
|
|
|
4d476f |
entry.dev = amd_strdup($3);
|
|
|
4d476f |
- else {
|
|
|
4d476f |
+ else if (!strcmp($1, "mount") ||
|
|
|
4d476f |
+ !strcmp($1, "unmount") ||
|
|
|
4d476f |
+ !strcmp($1, "umount")) {
|
|
|
4d476f |
+ amd_info("file system type program is not "
|
|
|
4d476f |
+ "yet implemented, option ignored");
|
|
|
4d476f |
+ YYABORT;
|
|
|
4d476f |
+ } else if (!strcmp($1, "delay") ||
|
|
|
4d476f |
+ !strcmp($1, "cachedir")) {
|
|
|
4d476f |
+ sprintf(msg_buf, "option %s is not used by autofs", $1);
|
|
|
4d476f |
+ amd_info(msg_buf);
|
|
|
4d476f |
+ } else {
|
|
|
4d476f |
amd_notify($1);
|
|
|
4d476f |
YYABORT;
|
|
|
4d476f |
}
|
|
|
4d476f |
@@ -326,11 +365,44 @@ option_assignment: MAP_OPTION OPTION_ASSIGN FS_TYPE
|
|
|
4d476f |
YYABORT;
|
|
|
4d476f |
}
|
|
|
4d476f |
}
|
|
|
4d476f |
+ | MAP_OPTION OPTION_ASSIGN CACHE_OPTION
|
|
|
4d476f |
+ {
|
|
|
4d476f |
+ sprintf(msg_buf, "option %s is not used, autofs "
|
|
|
4d476f |
+ "default caching is always used", $1);
|
|
|
4d476f |
+ amd_info(msg_buf);
|
|
|
4d476f |
+ }
|
|
|
4d476f |
;
|
|
|
4d476f |
|
|
|
4d476f |
options: OPTION
|
|
|
4d476f |
{
|
|
|
4d476f |
- prepend_opt(opts, $1);
|
|
|
4d476f |
+ if (!strcmp($1, "browsable") ||
|
|
|
4d476f |
+ !strcmp($1, "fullybrowsable") ||
|
|
|
4d476f |
+ !strcmp($1, "nounmount") ||
|
|
|
4d476f |
+ !strcmp($1, "unmount")) {
|
|
|
4d476f |
+ sprintf(msg_buf, "option %s is not currently "
|
|
|
4d476f |
+ "implemented, ignored", $1);
|
|
|
4d476f |
+ amd_info(msg_buf);
|
|
|
4d476f |
+ } else if (!strncmp($1, "ping=", 5) ||
|
|
|
4d476f |
+ !strncmp($1, "retry=", 6) ||
|
|
|
4d476f |
+ !strcmp($1, "public") ||
|
|
|
4d476f |
+ !strcmp($1, "softlookup") ||
|
|
|
4d476f |
+ !strcmp($1, "xlatecookie")) {
|
|
|
4d476f |
+ sprintf(msg_buf, "option %s is not used by "
|
|
|
4d476f |
+ "autofs, ignored", $1);
|
|
|
4d476f |
+ amd_info(msg_buf);
|
|
|
4d476f |
+ } else if (!strncmp($1, "utimeout=", 9)) {
|
|
|
4d476f |
+ if (entry.flags & AMD_MOUNT_TYPE_AUTO) {
|
|
|
4d476f |
+ char *opt = $1;
|
|
|
4d476f |
+ prepend_opt(opts, ++opt);
|
|
|
4d476f |
+ } else {
|
|
|
4d476f |
+ sprintf(msg_buf, "umount timeout can't be "
|
|
|
4d476f |
+ "used for other than type "
|
|
|
4d476f |
+ "\"auto\" with autofs, "
|
|
|
4d476f |
+ "ignored");
|
|
|
4d476f |
+ amd_info(msg_buf);
|
|
|
4d476f |
+ }
|
|
|
4d476f |
+ } else
|
|
|
4d476f |
+ prepend_opt(opts, $1);
|
|
|
4d476f |
}
|
|
|
4d476f |
| OPTION COMMA options
|
|
|
4d476f |
{
|
|
|
4d476f |
@@ -387,6 +459,12 @@ static int amd_notify(const char *s)
|
|
|
4d476f |
return(0);
|
|
|
4d476f |
}
|
|
|
4d476f |
|
|
|
4d476f |
+static int amd_info(const char *s)
|
|
|
4d476f |
+{
|
|
|
4d476f |
+ info(pap->logopt, "%s\n", s);
|
|
|
4d476f |
+ return 0;
|
|
|
4d476f |
+}
|
|
|
4d476f |
+
|
|
|
4d476f |
static int amd_msg(const char *s)
|
|
|
4d476f |
{
|
|
|
4d476f |
logmsg("%s\n", s);
|
|
|
4d476f |
diff --git a/modules/amd_tok.l b/modules/amd_tok.l
|
|
|
4d476f |
index fdc8899..8a6d40c 100644
|
|
|
4d476f |
--- a/modules/amd_tok.l
|
|
|
4d476f |
+++ b/modules/amd_tok.l
|
|
|
4d476f |
@@ -94,13 +94,14 @@ OPTS ({OSTR}(=({VSTR}|{QSTR}|{MACRO})+)?)
|
|
|
4d476f |
SOPT (({SSTR}|{QSTR}|{MACRO})+)
|
|
|
4d476f |
NOPT ({SSTR}|(({IP4ADDR}(\/{V4MASK})?)|({IP6ADDR}(\/{V6MASK})?)))
|
|
|
4d476f |
|
|
|
4d476f |
-MAPOPT (fs|type|maptype|pref|sublink|delay)
|
|
|
4d476f |
+MAPOPT (fs|type|maptype|pref|sublink|cache)
|
|
|
4d476f |
MNTOPT (opts|addopts|remopts)
|
|
|
4d476f |
-FSOPTS (rhost|rfs|dev|cachedir)
|
|
|
4d476f |
+FSOPTS (rhost|rfs|dev|cachedir|mount|unmount|umount|delay)
|
|
|
4d476f |
+CHEOPT (mapdefault|none|inc|re|regexp|all)
|
|
|
4d476f |
MAPTYPE (file|nis|nisplus|ldap|hesiod|exec|ndbm|passwd|union)
|
|
|
4d476f |
FSTYPE_LOCAL (link|linkx|lofs|ext2|ext3|ext4|xfs|jfs|cachefs)
|
|
|
4d476f |
FSTYPE_NET (nfs|nfsx|nfsl|host)
|
|
|
4d476f |
-FSTYPE (auto|program|direct|{FSTYPE_LOCAL}|{FSTYPE_NET})
|
|
|
4d476f |
+FSTYPE (auto|program|direct|lustre|{FSTYPE_LOCAL}|{FSTYPE_NET})
|
|
|
4d476f |
|
|
|
4d476f |
OSSEL (arch|karch|os|osver|full_os|vendor)
|
|
|
4d476f |
HSTSEL (host|hostd|domain|byte|cluster)
|
|
|
4d476f |
@@ -204,6 +205,11 @@ CUTSEP (\|\||\/)
|
|
|
4d476f |
return MAP_TYPE;
|
|
|
4d476f |
}
|
|
|
4d476f |
|
|
|
4d476f |
+ {CHEOPT} {
|
|
|
4d476f |
+ strcpy(amd_lval.strtype, amd_text);
|
|
|
4d476f |
+ return CACHE_OPTION;
|
|
|
4d476f |
+ }
|
|
|
4d476f |
+
|
|
|
4d476f |
{FOPT} {
|
|
|
4d476f |
strcpy(amd_lval.strtype, amd_text);
|
|
|
4d476f |
return FS_OPT_VALUE;
|