users: Remove timeout when creating Samba user

Fixes #2000

Tests performed:
- All the users module tests pass
- Create a user, add the user to the freedombox-share group,
check that the user can connect to the Samba Group share.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Veiko Aasa 2020-12-22 13:46:45 +02:00 committed by James Valleroy
parent 1101674cf3
commit 0255058656
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -365,13 +365,11 @@ def set_samba_user(username, password):
If a user already exists, update password.
"""
proc = subprocess.Popen(['smbpasswd', '-a', '-s', username],
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
_, stderr = proc.communicate(input='{0}\n{0}\n'.format(password).encode(),
timeout=10)
proc = subprocess.run(['smbpasswd', '-a', '-s', username],
input='{0}\n{0}\n'.format(password).encode(),
stderr=subprocess.PIPE)
if proc.returncode != 0:
raise RuntimeError('Unable to add Samba user: ', stderr)
raise RuntimeError('Unable to add Samba user: ', proc.stderr)
def subcommand_set_user_password(arguments):