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