19.0 - #32
Open
JedMeister wants to merge 19 commits into
Open
Conversation
The segment length check used `len(bit) < 0`, which can never be true.
socket.inet_aton() accepted partial dotted forms such as "8" and "8.8" as valid, so a malformed --join_ns value could pass validation and be written into resolv.conf. Switch valid_ip() to ipaddress.IPv4Address, which requires a full dotted-quad, and drop the now-unused socket import.
'hostname -I' emits every address on the host, space separated and including IPv6, so on a multi-address host NET_IP was interpolated raw into samba's 'interfaces' option and the hosts file, producing malformed config. Take the first valid IPv4 instead.
Supplying --join_ns expresses intent to join an existing domain, but the interactive fallback branch set create = True, so a join request that fell back to interactive mode (e.g. missing hostname) would create a brand new domain instead. Set create = False, and clear an invalid join nameserver so the interactive flow actually re-prompts for it rather than skipping the prompt.
Replace the hardcoded Google DNS (8.8.8.8) forwarder with the host's existing upstream nameserver, detected from /etc/resolv.conf before update_resolvconf() repoints it at the local samba DNS. Skips loopback (and IPv6) entries and falls back to 8.8.8.8 if no usable upstream is found, so behaviour is safe on hosts with no external resolver configured.
update_resolvconf() used ping of the nameserver to check validity; now it checks by attempting a TCP connection to nameserver via port 53.
'domain join' wrapped the option value in literal single quotes and because run_command() execs samba-tool with shell=False the quotes are passed verbatim. Samba then stores a quote-mangled "custom" option rather than the intended "idmap_ldb:use rfc2307 = yes".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Still needs testing...