mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-01-16 06:02:45 +01:00
75 lines
2.3 KiB
Diff
75 lines
2.3 KiB
Diff
Patch-Source: https://github.com/util-linux/util-linux/commit/fe0b1e793c9017edba72768e2e0b4c769c204604
|
|
--
|
|
From fe0b1e793c9017edba72768e2e0b4c769c204604 Mon Sep 17 00:00:00 2001
|
|
From: Karel Zak <kzak@redhat.com>
|
|
Date: Mon, 22 May 2023 17:26:55 +0200
|
|
Subject: [PATCH] libmount: don't call mount.<type> helper with usernames
|
|
|
|
This is v2.39 regression. The "user" mount option is internally
|
|
converted to "user=<name>", but this should not be exported to
|
|
the mount helpers.
|
|
|
|
The mount helper accepts the <name> only if specified in mount options
|
|
(cifs uses user=). The real username as generated by libmount is not
|
|
relevant in this case.
|
|
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
---
|
|
libmount/src/context_mount.c | 26 ++++++++++++++++----------
|
|
1 file changed, 16 insertions(+), 10 deletions(-)
|
|
|
|
diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c
|
|
index d6504c4a40..cbb4f1fdfa 100644
|
|
--- a/libmount/src/context_mount.c
|
|
+++ b/libmount/src/context_mount.c
|
|
@@ -377,9 +377,7 @@ int mnt_context_mount_setopt(struct libmnt_context *cxt, int c, char *arg)
|
|
|
|
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;
|
|
@@ -391,14 +389,6 @@ static int exec_helper(struct libmnt_context *cxt)
|
|
|
|
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) {
|
|
@@ -412,8 +402,24 @@ static int exec_helper(struct libmnt_context *cxt)
|
|
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);
|
|
|