Skip to content

Commit

Permalink
Fix another case where incorrect passdb path used (#14159)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
anodos325 authored Aug 7, 2024
1 parent d77173e commit 9ddd0fc
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/middlewared/middlewared/plugins/smb_/passdb.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit 9ddd0fc

Please sign in to comment.