aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/autofs/automountd.c
diff options
context:
space:
mode:
authorEdward Tomasz Napierala <trasz@FreeBSD.org>2014-08-23 12:00:45 +0000
committerEdward Tomasz Napierala <trasz@FreeBSD.org>2014-08-23 12:00:45 +0000
commitf7ae83075ac308e01817a2ed7f11c32b27e31144 (patch)
treeb1e5a7b58efb9b8b04603286fe79c45339116116 /usr.sbin/autofs/automountd.c
parent30ae6e0076f9e6e4950ed6de8105a4f911004220 (diff)
downloadsrc-f7ae83075ac308e01817a2ed7f11c32b27e31144.tar.gz
src-f7ae83075ac308e01817a2ed7f11c32b27e31144.zip
Add "nobrowse" option. Previously automountd(8) always behaved as if
it was set, now it's conditional. PR: 192862 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation
Notes
Notes: svn path=/head/; revision=270406
Diffstat (limited to 'usr.sbin/autofs/automountd.c')
-rw-r--r--usr.sbin/autofs/automountd.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/usr.sbin/autofs/automountd.c b/usr.sbin/autofs/automountd.c
index 9eaf049d8639..b5111035fb6c 100644
--- a/usr.sbin/autofs/automountd.c
+++ b/usr.sbin/autofs/automountd.c
@@ -182,7 +182,7 @@ handle_request(const struct autofs_daemon_request *adr, char *cmdline_options,
const char *map;
struct node *root, *parent, *node;
FILE *f;
- char *options, *fstype, *retrycnt, *tmp;
+ char *options, *fstype, *nobrowse, *retrycnt, *tmp;
int error;
log_debugx("got request %d: from %s, path %s, prefix \"%s\", "
@@ -222,6 +222,28 @@ handle_request(const struct autofs_daemon_request *adr, char *cmdline_options,
log_debugx("found node defined at %s:%d; not a mountpoint",
node->n_config_file, node->n_config_line);
+ options = node_options(node);
+
+ /*
+ * Prepend options passed via automountd(8) command line.
+ */
+ if (cmdline_options != NULL) {
+ options =
+ separated_concat(cmdline_options, options, ',');
+ }
+
+ nobrowse = pick_option("nobrowse", &options);
+ if (nobrowse != NULL && adr->adr_key[0] == '\0') {
+ log_debugx("skipping map %s due to \"nobrowse\" "
+ "option; exiting", map);
+ done(0);
+
+ /*
+ * Exit without calling exit_callback().
+ */
+ quick_exit(0);
+ }
+
/*
* Not a mountpoint; create directories in the autofs mount
* and complete the request.
@@ -239,9 +261,9 @@ handle_request(const struct autofs_daemon_request *adr, char *cmdline_options,
if (node != NULL)
create_subtree(node, false);
}
- done(0);
log_debugx("nothing to mount; exiting");
+ done(0);
/*
* Exit without calling exit_callback().
@@ -274,6 +296,11 @@ handle_request(const struct autofs_daemon_request *adr, char *cmdline_options,
options = separated_concat(options, "automounted", ',');
/*
+ * Remove "nobrowse", mount(8) doesn't understand it.
+ */
+ pick_option("nobrowse", &options);
+
+ /*
* Figure out fstype.
*/
fstype = pick_option("fstype=", &options);
@@ -309,8 +336,8 @@ handle_request(const struct autofs_daemon_request *adr, char *cmdline_options,
if (error != 0)
log_errx(1, "mount failed");
- done(0);
log_debugx("mount done; exiting");
+ done(0);
/*
* Exit without calling exit_callback().