summaryrefslogtreecommitdiff
path: root/libcli/dns
AgeCommit message (Collapse)AuthorFilesLines
2025-01-02Minimal EDNS0 support for built-in DNS clientMichael Tokarev1-1/+10
Currently, samba built-in DNS client is UDP-only (it does support TCP mode, but not all components use it). In particular, when winbind queries list of AD DCs (SRV record) which can be quite large, it uses UDP-only query. And at the same time, samba DNS client does not support EDNS0 at all, so the reply is limited to standard DNS packet size which is 512 bytes. Add minimal EDNS0 OPT record to ADDITIONAL section when sending a DNS request out, indicating we can accept DNS packets up to 4Kb in size. Since DNSSEC is in wide use today and DNSSEC requires EDNS0, it is okay to assume ENDS0 is widely supported these days, so there should be no regressions when enabling EDNS0. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
2023-08-08libcli: Add missing newlines to logging messagesJoseph Sutton1-1/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-01-20libcli/dns: Fix TCP fallbackVolker Lendecke1-25/+31
A customer has come across a DNS server that really just cuts a SRV reply if it's too long. This makes the packet invalid according to ndr_pull and according to wireshark. DNS_FLAG_TRUNCATION is however set. As this seems to be legal according to the DNS RFCs, we need to hand-parse the first two uint16's and look whether DNS_FLAG_TRUNCATION is set. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Jan 20 18:01:41 UTC 2022 on sn-devel-184
2021-09-28libcli/dns: smb.conf dns forwarder port supportMatthew Grant1-4/+4
Call new tsocket_address_inet_from_hostport_strings() instead of tsocket_address_inet_from_strings() to implement setting a port to query for a DNS forwarder. Signed-off-by: Matthew Grant <grantma@mattgrant.net.nz> Reviewed-by: Uri Simchoni <uri@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-12-11libcli: Add required #includes to libcli/dns/dns.hVolker Lendecke1-0/+8
Also, make it safe against being included twice Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-11-22build: Do not build selftest binaries for builds without --enable-selftestAndrew Bartlett1-2/+2
Add new for_selftest option to SAMBA_BINARY() and SAMBA3_BINARY() This allows us to be much more consistent (at least in the core Samba) and documents clearly why the binary should not be installed. Not modified are - test_lp_load - notifyd-tests - gendrandperf - test* from examples/libsmbclient - dbwrap_torture - split_tokens - locktest2 - msgtest - msg_sink - msg_source - versiontest - rpc_open_tcp - test_headers As these are not tested in selftest so any change would also be untested. Of course they probably should be added in a different MR. Also not modified (because they are not tests, nor part of the build system) are: - smb2mount - notifydd - log2pacp - debug2html - smbfilter - destroy_netlogon_creds_cli - spotlight2* - tevent_glib_tracker These do however appear to be untested. For now, the source4 forked client tools are left unchanged: - smbclient4 - nmblookup4 Finally, the heimdal binaries are left as install=False as they are either part of the build system or end-user tools that we just don't want to install. These are however tested. The motivation is commit like c34ec003b7d45aa4196ff93a0ac29694b25e5309 and da87fa998ab71328f30bcdf5b41aee8675aee48a, which are both totally correct but are not needed if the selftest is not run on MacOS. There are likely other platforms or build environments where building our test binaries is more pain than valuable, see for example also https://lists.samba.org/archive/samba/2019-November/227137.html Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Isaac Boukris <iboukris@samba.org> Autobuild-User(master): Isaac Boukris <iboukris@samba.org> Autobuild-Date(master): Fri Nov 22 11:48:59 UTC 2019 on sn-devel-184
2019-05-25lib: Only compile resolvconftest if fmemopen existsVolker Lendecke1-0/+1
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13961 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Sat May 25 00:05:25 UTC 2019 on sn-devel-184
2019-04-09lib: Initialize variables in parse_resolvconf_fpVolker Lendecke1-3/+3
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-04-09lib: Initialize getline() argumentsVolker Lendecke1-1/+1
Keep "len" valid across the loop iterations for getline to consume Bug: https://bugzilla.samba.org/show_bug.cgi?id=13892 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2019-01-25Fix tests when building with selftest but without developerIsaac Boukris1-1/+1
Signed-off-by: Isaac Boukris <iboukris@gmail.com> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Fri Jan 25 21:57:57 CET 2019 on sn-devel-144
2019-01-22libcli: dns: Change internal DNS_REQUEST_TIMEOUT from 2 to 10 seconds.Jeremy Allison1-1/+1
Should make us more robust when dealing with slow DNS servers. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Jan 22 23:37:16 CET 2019 on sn-devel-144
2019-01-15libcli/dns: Add dns_res_rec_get_sockaddrVolker Lendecke2-0/+40
Pull the address from a res_rec if it's there Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-01-15libcli/dns: clidns must depend on ndr_standard, not on NDR_DNSVolker Lendecke1-1/+1
Otherwise we can't link this into other libraries Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-01-15libcli/dns: Make "clidns" a libraryVolker Lendecke1-2/+3
This will be linked into the SAMBA_LIBRARY "addns" in the next step. Because the other user, "dnsserver_common", is also a library, we can't link this as a subsystem anymore. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-01-15dns_lookup: Let make test override the resolv.conf locationVolker Lendecke1-1/+12
Make this a separate commit: That is the feature that libc unfortunately does not give us. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-01-15libcli/dns: Add dns_lookupVolker Lendecke4-0/+435
Wrapper function to parse resolv.conf and talk to multiple nameservers. This is the code where we might want to add a "working nameserver" cache. glibc always looks at the first configured nameserver. If that's dead, glibc runs into a timeout and only then asks the second one that might succeed. When more than one dns query is to be performed, these timeouts add up. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-01-15libcli/dns: Add resolv.conf parsingVolker Lendecke4-1/+248
Right now this only looks at the nameserver setting. It is initally made for asynchronous AD DC lookup routines, where we don't need the "search", "domain" and other settings. When we convert general "net", "smbclient" and others to use this, we might either add "domain" handling to this code or look at something like c-ares which already does it. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2018-04-24tevent: Fix callers of tevent_req_set_endtimeVolker Lendecke1-1/+0
tevent_req_set_endtime internally already calls tevent_req_nomem and thus sets the error status correctly. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2018-01-06dnscli: Make a few functions staticVolker Lendecke2-56/+18
We might want to use the tcp flavor in the future in the forwarder for a single, persistent TCP connection. Then we can easily re-publish it. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2018-01-04libdns: Add dns_cli_requestVolker Lendecke3-2/+209
First UDP, then TCP if truncation happened Signed-off-by: Volker Lendecke <vl@samba.org>
2018-01-04libdns: dns/tcp clientVolker Lendecke2-0/+229
Same signature as the UDP client in the same file. This opens and closes the socket per request. In the future, we might want to create a persistent TCP connection for our internal DNS server's forwarder. That will require proper handling of in-flight requests. Something for another day. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2018-01-04libdns: Fix a typoVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2017-01-11wscript: remove executable bits for all wscript* filesStefan Metzmacher1-0/+0
These files should not be executable. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Wed Jan 11 20:21:01 CET 2017 on sn-devel-144
2015-12-08libdns: Small cleanupVolker Lendecke1-2/+0
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2015-12-08libdns: Convert dns_udp_request to 0/errnoVolker Lendecke2-21/+20
Replaces 5 calls to unix_to_werror with just one Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2015-12-08libdns: Properly set ENOMEMVolker Lendecke1-0/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2015-12-08libdns: tsocket returns -1 and sets errnoVolker Lendecke1-3/+3
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2014-12-18libcli-dns: Remove obsolete dns_host_file subsystem.Andreas Schneider3-450/+0
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Thu Dec 18 09:09:38 CET 2014 on sn-devel-104
2014-09-28libcli: Remove unreachable code in dns_hosts_file.Andreas Schneider1-2/+0
The count is already checked for 0 above this line so it can never be 0 at this point. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
2014-08-26libcli/dns: ignore NS entries in dns_hosts_file.c at a higher log level for nowStefan Metzmacher1-0/+12
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-08-26libcli/dns: add AAAA support to dns_hosts_file.cStefan Metzmacher1-7/+16
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2012-10-16libcli/dns: Time out requests after a whileKai Blin1-0/+8
Time out UDP requests after DNS_REQUEST_TIMEOUT seconds. Currently set to 2 seconds. This should fix bug #8878. Signed-off-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Oct 16 12:58:32 CEST 2012 on sn-devel-104
2012-05-30libcli/dns: Rename UDP-based calls to reflect their useKai Blin1-6/+6
Autobuild-User: Kai Blin <kai@samba.org> Autobuild-Date: Wed May 30 02:35:27 CEST 2012 on sn-devel-104
2012-05-25dns_hosts_file: move to a separate subsystemAlexander Bokovoy1-5/+7
After discussion with Kai move dns_hosts_file to a separate subsystem and merge it into libaddns private library for s3/s4 client use. Also remove dependency in libcli/nbt, the code from libcli/dns subsystems is not used there at all. Autobuild-User: Alexander Bokovoy <ab@samba.org> Autobuild-Date: Fri May 25 22:22:44 CEST 2012 on sn-devel-104
2012-05-23libcli/dns: make 'clidns' private library out of DNS code in WAF buildAlexander Bokovoy1-7/+5
After consolidating DNS resolver code to lib/addns, there is one piece that still needs to be moved into a common DNS resolver library: DNS_HOSTS_FILE subsystem. Unfortunately, direct move would require lib/addns to depend on libcli/util/{ntstatus.h,werror.h} (provided by errors subsystem). In addition, moving libcli/dns/* code to lib/addns/ would make conflicting the dns_tkey_record struct. The conflict comes from source4/dns_server/ and is due to use of IDL to define the struct. lib/addns/ library also provides its own definition so we either need to keep them in sync (rewrite code in lib/addns/ a bit) or depend on generated IDL headers. Thus, making a private library and subsystem clidns is an intermediate step that allows to buy some time fore refactoring.
2012-05-23Move source3/libads/dns.c to lib/addnsSimo Sorce1-0/+4
2012-03-27s4 dns: Add a simple async client libraryKai Blin3-0/+230
2011-04-26libcli/dns Improve dns_hosts_file, using Samba3's struct dns_rr_srvAndrew Bartlett2-0/+483
By reworking the 'fake DNS' file to use struct dns_rr_srv it should be possible to emulate that resolver layer as well as the Samba4 sockaddr_storage* based layer. This will then give us a common DNS emulation for 'make test'. Andrew Bartlett