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>
This commit is contained in:
parent
6fa034d0a9
commit
230459358a
1 changed files with 16 additions and 10 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue