From: Marcel van der Veldt Date: Fri, 30 Aug 2024 12:10:43 +0000 (+0200) Subject: final fix for smb mounting X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=31ec655a223f6f5b66b57755eaaa59c5e7d6deff;p=music-assistant-server.git final fix for smb mounting --- diff --git a/Dockerfile b/Dockerfile index b2c49dc3..7dce44d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ RUN set -x \ wget \ tzdata \ sox \ - samba \ + cifs-utils \ # install ffmpeg from community repo && apk add --no-cache ffmpeg --repository=https://dl-cdn.alpinelinux.org/alpine/v3.20/community \ # install snapcast from community repo diff --git a/music_assistant/server/providers/filesystem_smb/__init__.py b/music_assistant/server/providers/filesystem_smb/__init__.py index e8192b00..1168f2f1 100644 --- a/music_assistant/server/providers/filesystem_smb/__init__.py +++ b/music_assistant/server/providers/filesystem_smb/__init__.py @@ -186,11 +186,13 @@ class SMBFileSystemProvider(LocalFileSystemProvider): options = ["rw"] if mount_options := str(self.config.get_value(CONF_MOUNT_OPTIONS)): options += mount_options.split(",") - options.append(f"username={username}") options_str = ",".join(options) + # pass the username+password using (scoped) env variables + # to prevent leaking in the process list and special chars supported env_vars = { **os.environ, + "USER": username, } if password: env_vars["PASSWD"] = str(password) @@ -212,7 +214,7 @@ class SMBFileSystemProvider(LocalFileSystemProvider): self.logger.log( VERBOSE_LOG_LEVEL, "Using mount command: %s", - " ".join([m.replace(str(password), "########") if password else m for m in mount_cmd]), + " ".join(mount_cmd), ) returncode, output = await check_output(*mount_cmd, env=env_vars) if returncode != 0: