summaryrefslogtreecommitdiff
path: root/libdiskfs/opts-std-runtime.c
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1997-09-16 19:18:27 +0000
committerThomas Bushnell <thomas@gnu.org>1997-09-16 19:18:27 +0000
commitebec7389d6965d2ac1d940cf59f03fa5c3c3ca6e (patch)
tree878e74b3c9f0cff6000ac65332ae7ecfdf5fe031 /libdiskfs/opts-std-runtime.c
parent2e3dfbb0f86717b4111e81e3f2f0422926d5a29f (diff)
Tue Sep 16 14:37:51 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
* priv.h (nosuid, noexec): New variables. * init-init.c (nosuid, noexec): New variables, initialized to zero. * file-exec.c (diskfs_S_file_exec): If noexec is on, then prohibit all execution with EACCES. If nosuid is on, then prohibit setuid or setgid execution by silently omitting the uid substitution. * opts-std-startup.c (parse_startup_opt): Implement --no-suid and --no-exec. * opts-common.c (diskfs_common_options): Add --no-suid and --no-exec. * opts-std-runtime.c (struct parse_hook): Add nosuid and noexec. (parse_opt) [cases 'S', 'E', OPT_SUID_OK, OPT_EXEC_OK] Understand --no-suid, --no-exec, --suid-ok, and --exec-ok. (parse_opt) [case ARGP_KEY_INIT]: Initialize H->nosuid and H->noexec. (OPT_SUID_OK, OPT_EXEC_OK): New macros. (std_runtime_options): Add --suid-ok and --exec-ok. (set_opts): Set nosuid and noexec from H->nosuid and H->noexec. * opts-common.c (diskfs_common_options): Rename --nosync to --no-sync; leave --nosync as an alias.
Diffstat (limited to 'libdiskfs/opts-std-runtime.c')
-rw-r--r--libdiskfs/opts-std-runtime.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/libdiskfs/opts-std-runtime.c b/libdiskfs/opts-std-runtime.c
index 41df2111..9892d1a2 100644
--- a/libdiskfs/opts-std-runtime.c
+++ b/libdiskfs/opts-std-runtime.c
@@ -22,17 +22,22 @@
#include "priv.h"
+#define SUID_OK_OPT 600
+#define EXEC_OK_OPT 601
+
static const struct argp_option
std_runtime_options[] =
{
{"update", 'u', 0, 0, "Flush any meta-data cached in core"},
{"remount", 0, 0, OPTION_HIDDEN | OPTION_ALIAS}, /* deprecated */
+ {"suid-ok", OPT_SUID_OK, 0, 0, "Enable set-uid execution"},
+ {"exec-ok", OPT_EXEC_OK, 0, 0, "Enable execution of files"},
{0, 0}
};
struct parse_hook
{
- int readonly, sync, sync_interval, remount;
+ int readonly, sync, sync_interval, remount, nosuid, noexec;
};
/* Implement the options in H, and free H. */
@@ -71,6 +76,11 @@ set_opts (struct parse_hook *h)
diskfs_set_sync_interval (h->sync_interval);
}
+ if (h->nosuid != -1)
+ nosuid = h->nosuid;
+ if (h->noexec != -1)
+ noexec = h->noexec;
+
free (h);
return err;
@@ -86,6 +96,10 @@ parse_opt (int opt, char *arg, struct argp_state *state)
case 'r': h->readonly = 1; break;
case 'w': h->readonly = 0; break;
case 'u': h->remount = 1; break;
+ case 'S': h->nosuid = 1; break;
+ case 'E': h->noexec = 1; break;
+ case OPT_SUID_OK: h->nosuid = 0; break;
+ case OPT_EXEC_OK: h->noexec = 0; break;
case 'n': h->sync_interval = 0; h->sync = 0; break;
case 's':
if (arg)
@@ -97,6 +111,7 @@ parse_opt (int opt, char *arg, struct argp_state *state)
h->sync = 1;
break;
+
case ARGP_KEY_INIT:
if (state->input)
state->hook = state->input; /* Share hook with parent. */
@@ -109,6 +124,7 @@ parse_opt (int opt, char *arg, struct argp_state *state)
h->sync = diskfs_synchronous;
h->sync_interval = -1;
h->remount = 0;
+ h->nosuid = h->noexec = -1;
/* We know that we have one child, with which we share our hook. */
state->child_inputs[0] = h;