Bug 15756 - Replace `crypt` module in python/samba/netcmd/user/readpasswords/common.py
Summary: Replace `crypt` module in python/samba/netcmd/user/readpasswords/common.py
Status: ASSIGNED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Python (show other bugs)
Version: 4.20.1
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Douglas Bagnall
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-26 13:49 UTC by Andreas Schneider
Modified: 2024-11-26 20:24 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Schneider 2024-11-26 13:49:51 UTC
In python/samba/netcmd/user/readpasswords/common.py we use the `crypt` module, which has been removed in Python 3.13. See

https://docs.python.org/3/library/crypt.html
Comment 1 Andreas Schneider 2024-11-26 13:54:17 UTC
[57(443)/57 at 5m45s] samba.tests.samba_tool.user_virtualCryptSHA_userPassword(ad_dc:local)
/usr/lib64/python3.13/unittest/case.py:597: RuntimeWarning: TestResult has no addDuration method
  warnings.warn("TestResult has no addDuration method",
UNEXPECTED(failure): samba.tests.samba_tool.user_virtualCryptSHA_userPassword.samba.tests.samba_tool.user_virtualCryptSHA_userPassword.UserCmdCryptShaTestCaseUserPassword.test_no_gpg_both_hashes_no_rounds(ad_dc:local)
REASON: Exception: Exception: Traceback (most recent call last):
  File "/tmp/samba-testbase/b1/samba-o3/bin/python/samba/tests/samba_tool/user_virtualCryptSHA_userPassword.py", line 29, in test_no_gpg_both_hashes_no_rounds
    out = self._get_password("virtualCryptSHA256,virtualCryptSHA512")
  File "/tmp/samba-testbase/b1/samba-o3/bin/python/samba/tests/samba_tool/user_virtualCryptSHA_base.py", line 78, in _get_password
    self.assertCmdSuccess(result,
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
                          out,
                          ^^^^
                          err,
                          ^^^^
                          "Ensure getpassword runs")
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/samba-testbase/b1/samba-o3/bin/python/samba/tests/samba_tool/base.py", line 103, in assertCmdSuccess
    self.assertIsNone(exit, msg=msg.replace("\n]\n", "\n] \n"))
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: -1 is not None : exit[-1] stdout[] stderr[ERROR: Virtual attribute 'virtualCryptSHA256' not supported: crypt required
]: Ensure getpassword runs