final fix for smb mounting
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Fri, 30 Aug 2024 12:10:43 +0000 (14:10 +0200)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Fri, 30 Aug 2024 12:32:38 +0000 (14:32 +0200)
Dockerfile
music_assistant/server/providers/filesystem_smb/__init__.py

index b2c49dc33819f86d9121766affa144ae0839f22b..7dce44d2202df8cfde0f47c11d7de7dc72b3cb04 100644 (file)
@@ -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
index e8192b00113985d912171c43dc8c816844b9927e..1168f2f1415b1862bd97a52c8e7251865d791b29 100644 (file)
@@ -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: