summaryrefslogtreecommitdiffstats
path: root/src/resolv
Commit message (Collapse)AuthorAgeFilesLines
* Just return NULL if tevent_req_create() failsSumit Bose2016-02-111-2/+1
| | | | | | | | | In general we just return NULL if tevent_req_create() fails because there is nothing we can do with the request anyway. Especially tevent_req_error() should not be called because it tries to dereference req. Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* resolv: Use the same default timeout for SRV queries as previouslyJakub Hrozek2015-03-032-1/+7
| | | | | | | | | | | When we changed the resolver code to use the TTL values from the DNS queries instead of harcoded ones, we changed the default value by accident. Add a separate SRV TTL that is backwards-compatible with the old harcoded value. Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* resolv: Fix a typoJakub Hrozek2015-02-131-1/+1
| | | | Reviewed-by: Pavel Reichl <preichl@redhat.com>
* RESOLV: Remove obsolete in-tree implementation of SRV and TXT parsingJakub Hrozek2015-02-119-779/+0
| | | | | | | | | SSSD contained several backwards-compatible definitions of SRV and TXT APIs as well as structures that carry TTL data. These were intended for RHEL-5 and older releases. Since we don't support those upstream, it's better to remove the code -- it has drifted apart from upstream anyway. Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* RESOLV: Add an internal function to read TTL from a DNS packetJakub Hrozek2015-02-113-3/+123
| | | | | | | | | | | | Related: https://fedorahosted.org/sssd/ticket/1884 Adds an internal resolver function that reads the TTL for SRV records as specified by RFC-2181. Several internal c-ares definitions are used until c-ares contains a function that exposes all this information via a parsing function. Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* resolv: fix server sort by weightPavel Březina2014-07-141-6/+2
| | | | | | | | | | When the server list consist only from servers with zero weight the output list contained only one server. Resolves: https://fedorahosted.org/sssd/ticket/2357 Reviewed-by: Pavel Reichl <preichl@redhat.com>
* Unify usage of function gethostnameLukas Slebodnik2014-06-031-2/+2
| | | | | | | | | | | | man gethostanme says: NOTES SUSv2 guarantees that "Host names are limited to 255 bytes". POSIX.1-2001 guarantees that "Host names (not including the terminating null byte) are limited to HOST_NAME_MAX bytes". On Linux, HOST_NAME_MAX is defined with the value 64, which has been the limit since Linux 1.0 (earlier kernels imposed a limit of 8 bytes). Reviewed-by: Pavel Březina <pbrezina@redhat.com>
* resolv: Do not try to free addrinfo in case of errorLukas Slebodnik2014-05-201-1/+2
| | | | | | | | | | | We should call freeaddrinfo only in situation if getaddrinfo succeeds. It is not specified in RFC2553 the behaviour of calling freeaddrinfo with the NULL argument. It is more portable to do not rely on undocumented behaviour of glibc. http://www.ietf.org/rfc/rfc2553.txt [Page 28] Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
* Remove unused argument from resolv_gethostbyname_dns_parseLukas Slebodnik2014-04-071-5/+4
| | | | Reviewed-by: Pavel Reichl <preichl@redhat.com>
* resolv_gethostbyname_dns_parse(): remove tmp_ctxPavel Březina2014-02-171-7/+3
| | | | | | | Resolves: https://fedorahosted.org/sssd/ticket/2198 Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
* Update DEBUG* invocations to use new levelsNikolai Kondrashov2014-02-121-50/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use a script to update DEBUG* macro invocations, which use literal numbers for levels, to use bitmask macros instead: grep -rl --include '*.[hc]' DEBUG . | while read f; do mv "$f"{,.orig} perl -e 'use strict; use File::Slurp; my @map=qw" SSSDBG_FATAL_FAILURE SSSDBG_CRIT_FAILURE SSSDBG_OP_FAILURE SSSDBG_MINOR_FAILURE SSSDBG_CONF_SETTINGS SSSDBG_FUNC_DATA SSSDBG_TRACE_FUNC SSSDBG_TRACE_LIBS SSSDBG_TRACE_INTERNAL SSSDBG_TRACE_ALL "; my $text=read_file(\*STDIN); my $repl; $text=~s/ ^ ( .* \b (DEBUG|DEBUG_PAM_DATA|DEBUG_GR_MEM) \s* \(\s* )( [0-9] )( \s*, ) ( \s* ) ( .* ) $ / $repl = $1.$map[$3].$4.$5.$6, length($repl) <= 80 ? $repl : $1.$map[$3].$4."\n".(" " x length($1)).$6 /xmge; print $text; ' < "$f.orig" > "$f" rm "$f.orig" done Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Stephen Gallagher <sgallagh@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* Make DEBUG macro invocations variadicNikolai Kondrashov2014-02-122-80/+80
| | | | | | | | | | | | | | | | | | | | | | | | Use a script to update DEBUG macro invocations to use it as a variadic macro, supplying format string and its arguments directly, instead of wrapping them in parens. This script was used to update the code: grep -rwl --include '*.[hc]' DEBUG . | while read f; do mv "$f"{,.orig} perl -e \ 'use strict; use File::Slurp; my $text=read_file(\*STDIN); $text=~s#(\bDEBUG\s*\([^(]+)\((.*?)\)\s*\)\s*;#$1$2);#gs; print $text;' < "$f.orig" > "$f" rm "$f.orig" done Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Stephen Gallagher <sgallagh@redhat.com> Reviewed-by: Simo Sorce <simo@redhat.com>
* resolv_sort_srv_reply: remove unnecessary mem_ctxPavel Březina2013-09-052-8/+12
|
* Fix czech specific character in my namePavel Březina2013-09-021-1/+1
|
* Lower timeout to contact DNS serverMichal Zidek2013-07-241-1/+1
| | | | | | | | c-ares timeout to wait for response from DNS server before moving to next DNS server is lowered from 5s to 2s. Partially solves https://fedorahosted.org/sssd/ticket/1966
* Remove unused constant.Michal Zidek2013-07-231-2/+0
|
* Fixing critical format string issues.Lukas Slebodnik2013-05-201-2/+4
| | | | | | --missing arguments. --format '%s', but argument is integer. --wrong format string, examle: '%\n'
* Actually use the index parameter in resolv_get_sockaddr_address_indexJakub Hrozek2013-05-072-6/+10
|
* dyndns: New option dyndns_update_ptrJakub Hrozek2013-05-032-4/+7
| | | | | | | | | | | | | | | | https://fedorahosted.org/sssd/ticket/1832 While some servers, such as FreeIPA allow the PTR record to be synchronized when the forward record is updated, other servers, including Active Directory, require that the PTR record is synchronized manually. This patch adds a new option, dyndns_update_ptr that automatically generates appropriate DNS update message for updating the reverse zone. This option is off by default in the IPA provider. Also renames be_nsupdate_create_msg to be_nsupdate_create_fwd_msg
* resolver: Return PTR record as stringJakub Hrozek2013-05-032-0/+40
| | | | | This is a requirement to update the PTR records. Includes a unit test.
* resolv: add resolv_discover_srv request to resolv utilsPavel Březina2013-04-102-0/+194
|
* resolv: add resolv_get_domain request to resolv utilsPavel Březina2013-04-102-0/+168
|
* Centralize resolv_init, remove resolv context listJakub Hrozek2013-04-032-18/+3
|
* Init failover with be_res optionsJakub Hrozek2013-04-032-46/+0
|
* Check for correct variable nameJakub Hrozek2013-04-031-1/+1
| | | | https://fedorahosted.org/sssd/ticket/1864
* use talloc_zfree when freeing rhostent in resolverPavel Březina2012-12-191-1/+1
| | | | | We should use talloc_zfree() when freeing state variables, so we can later avoid undesirable access after free.
* RESOLV: Do not steal the resulting hostent on errorJakub Hrozek2012-12-181-2/+3
| | | | https://fedorahosted.org/sssd/ticket/1706
* RESOLV: return ENOENT if the address list is emptyJakub Hrozek2012-12-051-0/+8
|
* resolv_gethostbyname_send: strdup hostname to work properly when hostname is ↵Pavel Březina2012-07-161-5/+12
| | | | | | | | | allocated on stack If we provide a hostname that was allocated on stack, it may contain invalid data in the time when it is actually resolved. This patch fixes it.
* Return correct resolv_status on resolver timeoutJakub Hrozek2012-03-291-1/+6
| | | | https://fedorahosted.org/sssd/ticket/1274
* Resolver: Introduce a per-request timeoutJakub Hrozek2011-12-201-30/+199
|
* resolver: Free the whole hostent structureJakub Hrozek2011-10-311-1/+1
| | | | | We would only free the hostent structure itself, not its contents. Use a wrapper provided by c-ares to do so.
* Use ares_search instead of ares_query for hostname resolutionJakub Hrozek2011-07-131-1/+1
| | | | | | | ares_query does not take search or domain directives from /etc/resolv.conf into account https://fedorahosted.org/sssd/ticket/922
* Allow returning arbitrary address from resolv_hostent as stringJakub Hrozek2011-07-112-3/+10
|
* Split reading resolver family order into a separate functionJakub Hrozek2011-07-112-0/+49
|
* Do not hardcode default resolver timeoutJakub Hrozek2011-07-111-0/+2
|
* Add sockaddr_storage to sdap_serviceSumit Bose2011-06-302-0/+40
|
* Provide TTL structure names for c-ares < 1.7Jakub Hrozek2011-06-161-0/+8
| | | | | | | | | | | https://fedorahosted.org/sssd/ticket/898 In c-ares 1.7, the upstream renamed the addrttl/addr6ttl structures to ares_addrttl/ares_addr6ttl so they are in the ares_ namespace. Because they are committed to stable ABI, the contents are the same, just the name changed -- so it is safe to just #define the new name for older c-ares version in case the new one is not detected in configure time.
* Switch resolver to using resolv_hostent and honor TTLJakub Hrozek2011-06-152-205/+287
|
* Resolve hosts by name from DNS into resolv_hostentJakub Hrozek2011-06-151-0/+254
|
* Resolve hosts by name from files into resolv_hostentJakub Hrozek2011-06-151-0/+92
|
* Add new resolv_hostent data structure and utility functionsJakub Hrozek2011-06-152-0/+200
|
* Add utility function to return IP address as stringJakub Hrozek2011-06-022-0/+27
|
* Set c-ares to retry nameserversJakub Hrozek2011-05-121-1/+1
| | | | https://fedorahosted.org/sssd/ticket/867
* Use safe alignment macros for in-tree SRV record parsingJakub Hrozek2011-04-121-3/+3
| | | | | | The in-tree SRV record parsing is used with very old c-ares libraries that don't implement the parsing themselves (c-ares < 1.7, used in e.g. RHEL5)
* Reschedule the fd timeout for secondary lookupsStephen Gallagher2010-12-141-0/+4
| | | | | | | | | | | We were unscheduling the timeout handler after the first lookup (A or AAAA) returned, but not rescheduling it if we went on to check the secondary record type. This resulted in the resolver never returning a result for the secondary lookup, which can mean that logins/screen unlocks after VPN drop or suspend/resume might never complete. Fixes https://fedorahosted.org/sssd/ticket/729
* Fix timeouts for DNS resolverStephen Gallagher2010-12-141-1/+1
| | | | | | | options.tries specifies the number of retries. Setting this to zero means to try exactly once. Previously we were always trying twice (internally). We want to simply honor the SSSD configuration and fail over to the next server (or go offline) after one try.
* Internal DNS resolver should check /etc/hostsJakub Hrozek2010-11-241-0/+2
| | | | https://fedorahosted.org/sssd/ticket/686
* Add dns_resolver_timeout optionStephen Gallagher2010-04-301-1/+5
| | | | | | We had a hard-coded timeout of five seconds for DNS lookups in the async resolver. This patch adds an option 'dns_resolver_timeout' to specify this value (Default: 5)
* Support SRV servers in failoverJakub Hrozek2010-04-301-5/+5
| | | | | | | | | | | | | | | Adds a new failover API call fo_add_srv_server that allows the caller to specify a server that is later resolved into a list of specific servers using SRV requests. Also adds a new failover option that specifies how often should the servers resolved from SRV query considered valid until we need a refresh. The "real" servers to connect to are returned to the user as usual, using the fo_resolve_service_{send,recv} calls. Make SRV resolution work with c-ares 1.6