static int exec_helper(struct libmnt_context *cxt)
{
- struct libmnt_optlist *ol;
struct libmnt_ns *ns_tgt = mnt_context_get_target_ns(cxt);
- const char *o = NULL;
char *namespace = NULL;
int rc;
pid_t pid;
DBG(CXT, ul_debugobj(cxt, "mount: executing helper %s", cxt->helper));
- ol = mnt_context_get_optlist(cxt);
- if (!ol)
- return -ENOMEM;
-
- rc = mnt_optlist_get_optstr(ol, &o, NULL, MNT_OL_FLTR_HELPERS);
- if (rc)
- return rc;
-
if (ns_tgt->fd != -1
&& asprintf(&namespace, "/proc/%i/fd/%i",
getpid(), ns_tgt->fd) == -1) {
case 0:
{
const char *args[14], *type;
+ struct libmnt_optlist *ol = mnt_context_get_optlist(cxt);
+ struct libmnt_opt *opt;
+ const char *o = NULL;
int i = 0;
+ if (!ol)
+ _exit(EXIT_FAILURE);
+
+ /* Call helper with original user=<name> (aka "saved user")
+ * or remove the username at all.
+ */
+ opt = mnt_optlist_get_opt(ol, MNT_MS_USER, cxt->map_userspace);
+ if (opt && !(cxt->flags & MNT_FL_SAVED_USER))
+ mnt_opt_set_value(opt, NULL);
+
+ if (mnt_optlist_get_optstr(ol, &o, NULL, MNT_OL_FLTR_HELPERS))
+ _exit(EXIT_FAILURE);
+
if (drop_permissions() != 0)
_exit(EXIT_FAILURE);