From 1a4731ada406ea81a3427140630a1ecfda5ea9b2 Mon Sep 17 00:00:00 2001 From: Andrew Walker Date: Wed, 7 Aug 2024 08:09:41 -0700 Subject: [PATCH] Fix another case where incorrect passdb path used This uses new hard-coded passdb path in samba's cache dir. It removes some ability for users to override our compiled-in path options via auxiliary parameters, but such a configuration is unsupported. --- src/middlewared/middlewared/plugins/smb_/passdb.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/middlewared/middlewared/plugins/smb_/passdb.py b/src/middlewared/middlewared/plugins/smb_/passdb.py index 04cf740b28a87..d0d59e378bb89 100644 --- a/src/middlewared/middlewared/plugins/smb_/passdb.py +++ b/src/middlewared/middlewared/plugins/smb_/passdb.py @@ -1,7 +1,7 @@ from middlewared.service import Service, job, private from middlewared.service_exception import CallError from middlewared.utils import Popen, run -from middlewared.plugins.smb import SMBCmd +from middlewared.plugins.smb import SMBCmd, SMBPath import os import subprocess @@ -35,7 +35,7 @@ async def passdb_list(self, verbose=False): local users in an AD environment. Immediately return in ldap enviornment. """ pdbentries = [] - private_dir = await self.middleware.call('smb.getparm', 'privatedir', 'global') + private_dir = SMBPath.PASSDB_DIR.path if not os.path.exists(f'{private_dir}/passdb.tdb'): return pdbentries @@ -146,9 +146,7 @@ async def passdb_reinit(self, conf_users): `conf_users` contains results of `user.query`. Since users will receive new SID values, we will need to flush samba's cache to ensure consistency. """ - private_dir = await self.middleware.call('smb.getparm', - 'private dir', - 'global') + private_dir = SMBPath.PASSDB_DIR.path ts = int(time.time()) old_path = f'{private_dir}/passdb.tdb' new_path = f'{private_dir}/passdb.{ts}.corrupted'