** Description changed:

  [ Impact ]
  
  The samba-tool gpo commands crash because the python code is using a
  method that was removed the python version available in noble. This
  crash prevents the use and management of group policy objects in a samba
  active directory controller.
  
  [ Test Plan ]
  
- The test plan is as follows:
- - deploy samba active directory controller in noble. Here[1] is a how-to 
guide.
- - run the test command, using the default UUID for the Default Domain Policy
+ This SRU includes a new test case for this bug, part of the existing
+ d/t/samba-ad-dc-provisioning-internal-dns test.
  
-   sudo samba-tool gpo manage motd set
- {31B2F340-016D-11D2-945F-00C04FB984F9}  "Welcome" -U Administrator
+ For verification purposes, the samba-ad-dc-provisioning-internal-dns
+ test must pass. More specifically, the test server_motd_gpo_tests() must
+ pass. The start of the test is marked with the following text in the
+ test output:
  
- - without the fix, that will crash with a python backtrace:
- 
- WARNING: Using passwords on command line is insecure. Installing the 
setproctitle python module will hide these from shortly after program start.
- Password for [EXAMPLE\Administrator]:
- ERROR(<class 'AttributeError'>): uncaught exception - 'ConfigParser' object 
has no attribute 'readfp'
-   File "/usr/lib/python3/dist-packages/samba/netcmd/__init__.py", line 279, 
in _run
-     return self.run(*args, **kwargs)
-            ^^^^^^^^^^^^^^^^^^^^^^^^^
-   File "/usr/lib/python3/dist-packages/samba/netcmd/gpo.py", line 3838, in run
-     reg.increment_gpt_ini(machine_changed=True)
-   File "/usr/lib/python3/dist-packages/samba/policies.py", line 177, in 
increment_gpt_ini
-     parser.parse(data)
-   File "/usr/lib/python3/dist-packages/samba/gp_parse/gp_ini.py", line 112, 
in parse
-     super(GPTIniParser, self).parse(contents)
-   File "/usr/lib/python3/dist-packages/samba/gp_parse/gp_ini.py", line 41, in 
parse
-     self.ini_conf.readfp(StringIO(contents.decode(self.encoding)))
-     ^^^^^^^^^^^^^^^^^^^^
- 
- - with the fix, the command will not fail, and exit silently
- 
- - confirm that the motd gpo was set. The output should be "Welcome":
- 
-   sudo samba-tool gpo manage motd list
- {31B2F340-016D-11D2-945F-00C04FB984F9};echo
- 
- It is out of scope for this bug to test the actual group policy object.
- I believe that is fine, given the type of error. In fact, this simple
- exercise already uncovered another motd gpo bug, also being fixed in the
- same upload (LP: #2092308).
- 
- Furthermore, bug
- https://bugs.launchpad.net/ubuntu/+source/samba/+bug/2078854 which is
- also being fixed in this SRU will involve some GPO testing.
- 
- 1. https://documentation.ubuntu.com/server/how-to/samba/provision-samba-
- ad-controller/
+   ## MOTD GPO tests (server only)
  
  [ Where problems could occur ]
  
  What is somewhat likely to happen with this fix is that, by actually
  allowing the command to proceed, other bugs will be found. That has
  happened while preparing this SRU: see LP: #2092308.
- 
  
  [ Other Info ]
  
  I wouldn't be surprised if more bugs exist in this area of the code, but
  it shouldn't stop this update. It's already an improvement.
  
  [ Original Description ]
  
  Got this in noble's samba:
  
  # samba-tool gpo manage motd set {31B2F340-016D-11D2-945F-00C04FB984F9}  
"Welcome" -U Administrator
  WARNING: Using passwords on command line is insecure. Installing the 
setproctitle python module will hide these from shortly after program start.
  Password for [EXAMPLE\Administrator]:
  ERROR(<class 'AttributeError'>): uncaught exception - 'ConfigParser' object 
has no attribute 'readfp'
    File "/usr/lib/python3/dist-packages/samba/netcmd/__init__.py", line 279, 
in _run
      return self.run(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3/dist-packages/samba/netcmd/gpo.py", line 3838, in run
      reg.increment_gpt_ini(machine_changed=True)
    File "/usr/lib/python3/dist-packages/samba/policies.py", line 177, in 
increment_gpt_ini
      parser.parse(data)
    File "/usr/lib/python3/dist-packages/samba/gp_parse/gp_ini.py", line 112, 
in parse
      super(GPTIniParser, self).parse(contents)
    File "/usr/lib/python3/dist-packages/samba/gp_parse/gp_ini.py", line 41, in 
parse
      self.ini_conf.readfp(StringIO(contents.decode(self.encoding)))
      ^^^^^^^^^^^^^^^^^^^^
  
  This was fixed in[1]:
  
  commit 2b566979acfc89ad609eb7c0c87d720f1a35f30a
  Author: Jo Sutton <[email protected]>
  Date:   Tue Aug 29 16:30:08 2023 +1200
  
      gp: Use read_file() instead of readfp()
  
      readfp() is deprecated and could be removed in a future version of
      Python.
  
      Signed-off-by: Joseph Sutton <[email protected]>
      Reviewed-by: Andrew Bartlett <[email protected]>
  
  1. https://github.com/samba-
  team/samba/commit/2b566979acfc89ad609eb7c0c87d720f1a35f30a

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2088094

Title:
  ConfigParser has no attribute readfp

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/samba/+bug/2088094/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to