]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
python:join: fix reused variable name in provision func
authorJohn Mulligan <jmulligan@redhat.com>
Fri, 24 Mar 2023 19:11:59 +0000 (15:11 -0400)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 5 Apr 2023 02:02:29 +0000 (02:02 +0000)
Recent updates to run adprep during the provision function re-used a
variable name that was already in use as a string. This reassignment
changed the type of the referenced object. This variable name is later
used to setup the mit krb5 kdc conf and expects the var to contain a
string. When executed with default cli options on a mit krb5 based build
samba tool fails with a traceback:
```
INFO 2023-03-23 21:22:50,399 pid:6
/usr/lib64/python3.10/site-packages/samba/provision/__init__.py #2021:
Fixing provision GUIDs
ERROR(<class 'AttributeError'>): uncaught exception - 'DomainUpdate'
object has no attribute 'upper'
  File "/usr/lib64/python3.10/site-packages/samba/netcmd/__init__.py",
line 230, in _run
    return self.run(*args, **kwargs)
  File "/usr/lib64/python3.10/site-packages/samba/netcmd/domain.py",
line 555, in run
    result = provision(self.logger,
  File
"/usr/lib64/python3.10/site-packages/samba/provision/__init__.py", line
2408, in provision
    create_kdc_conf(paths.kdcconf, realm, domain,
os.path.dirname(lp.get("log file")))
  File
"/usr/lib64/python3.10/site-packages/samba/provision/kerberos.py", line
43, in create_kdc_conf
    domain = domain.upper()
```

This change removes the re-use of the existing var name by chaining
the calls.

Fixes: 4bba26579d1
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Apr  5 02:02:29 UTC 2023 on atb-devel-224

python/samba/provision/__init__.py

index 6946eb42f38d76264edcfb05b4df845b2e5857c3..d557e09df5ac5377d900cdddf7dae9ba9448d15a 100644 (file)
@@ -2391,10 +2391,11 @@ def provision(logger, session_info, smbconf=None,
                 try:
                     from samba.domain_update import DomainUpdate
 
-                    domain = DomainUpdate(samdb, fix=True)
-                    domain.check_updates_functional_level(adprep_level,
-                                                          DS_DOMAIN_FUNCTION_2008,
-                                                          update_revision=True)
+                    DomainUpdate(samdb, fix=True).check_updates_functional_level(
+                        adprep_level,
+                        DS_DOMAIN_FUNCTION_2008,
+                        update_revision=True,
+                    )
 
                     samdb.transaction_commit()
                 except Exception as e: