Bug 13926 - samba-tool join --dns-backend=BIND9_DLZ doesn't generate correct dns-hostname for lower-case host names
Summary: samba-tool join --dns-backend=BIND9_DLZ doesn't generate correct dns-hostname...
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Tools (show other bugs)
Version: 4.9.6
Hardware: All All
: P5 minor (vote)
Target Milestone: ---
Assignee: Andrew Bartlett
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-05 19:56 UTC by Rick Lochner
Modified: 2019-05-06 08:36 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rick Lochner 2019-05-05 19:56:52 UTC
When joining an active directory domain with "samba-tool domain join --dns-backend=BIND9_DLZ...", if the host name of the joining computer is lower case, e.g. dc2, an account gets created for dns-DC2 (uppercase), not dns-dc2.

This appears to prevent dynamic dns updates from working.

A workaround is rather simple.  If an "samba_upgradedns --dns-backend=SAMBA_INTERNAL" is run followed by an "samba_upgradedns --dns-backend=BIND9_DLZ" the account gets recreated properly.

Creating a domain with "samba-tool domain provision" does correctly create a lower-case dns host name.
Comment 1 Louis 2019-05-06 08:36:17 UTC
Hai, 

I will add the following, because it directly related to this. 
Tested: Debian 9 with samba 4.10.2 bind9_dlz. 


If you run:  
samba-tool ldapcmp --filter="whenChanged,dc,DC,cn,CN"
Works fine and does not error. 

That part needes to have a look at also, i mean, 
the filter part, but the need a fix at the same point as the hostname. 


 samba-tool ldapcmp --filter="whenChanged"  .. results in .. 
* Comparing [DOMAIN] context...

* Objects to be compared: 828
ERROR(<class 'KeyError'>): uncaught exception - 'CN'
  File "/usr/lib/python3/dist-packages/samba/netcmd/__init__.py", line 185, in _run
    return self.run(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/samba/netcmd/ldapcmp.py", line 957, in run
    if b1.diff(b2):
  File "/usr/lib/python3/dist-packages/samba/netcmd/ldapcmp.py", line 781, in diff
    if object1 == object2:
  File "/usr/lib/python3/dist-packages/samba/netcmd/ldapcmp.py", line 549, in __eq__
    return self.cmp_attrs(other)
  File "/usr/lib/python3/dist-packages/samba/netcmd/ldapcmp.py", line 590, in cmp_attrs
    if isinstance(self.attributes[x], list) and isinstance(other.attributes[x], list):


 samba-tool ldapcmp --filter="dc,DC,cn,CN"  Results in ( mixed results) 
i've gotten one error in the first run just after :  Comparing [DNSFOREST] context...

but after 4-5x retrying this, i keep getting sucess. Result for [DNSFOREST]: SUCCESS

The other filter tests. 
 samba-tool ldapcmp --filter="cn,CN" 


* Comparing [DOMAIN] context...

* Objects to be compared: 828

* Result for [DOMAIN]: SUCCESS

* Comparing [CONFIGURATION] context...

* Objects to be compared: 1717

* Result for [CONFIGURATION]: SUCCESS

* Comparing [SCHEMA] context...

* Objects to be compared: 1632

* Result for [SCHEMA]: SUCCESS

* Comparing [DNSDOMAIN] context...

* Objects to be compared: 497
ERROR(<class 'KeyError'>): uncaught exception - 'dc'
  File "/usr/lib/python3/dist-packages/samba/netcmd/__init__.py", line 185, in _run
    return self.run(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/samba/netcmd/ldapcmp.py", line 957, in run
    if b1.diff(b2):
  File "/usr/lib/python3/dist-packages/samba/netcmd/ldapcmp.py", line 781, in diff
    if object1 == object2:
  File "/usr/lib/python3/dist-packages/samba/netcmd/ldapcmp.py", line 549, in __eq__
    return self.cmp_attrs(other)
  File "/usr/lib/python3/dist-packages/samba/netcmd/ldapcmp.py", line 590, in cmp_attrs
    if isinstance(self.attributes[x], list) and isinstance(other.attributes[x], list):


samba-tool ldapcmp --filter="dc,DC" 

* Comparing [DOMAIN] context...

* Objects to be compared: 828
ERROR(<class 'KeyError'>): uncaught exception - 'CN'
  File "/usr/lib/python3/dist-packages/samba/netcmd/__init__.py", line 185, in _run
    return self.run(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/samba/netcmd/ldapcmp.py", line 957, in run
    if b1.diff(b2):
  File "/usr/lib/python3/dist-packages/samba/netcmd/ldapcmp.py", line 781, in diff
    if object1 == object2:
  File "/usr/lib/python3/dist-packages/samba/netcmd/ldapcmp.py", line 549, in __eq__
    return self.cmp_attrs(other)
  File "/usr/lib/python3/dist-packages/samba/netcmd/ldapcmp.py", line 590, in cmp_attrs
    if isinstance(self.attributes[x], list) and isinstance(other.attributes[x], list):