Commit Graph

11 Commits

Author SHA1 Message Date
cy
74d5e96baa Fix up two assertions following malloc(). vangyzen@ notified me of
the second one. The first one is fixed as well.

Reported by:	vangyzen@
MFC after:	1 week
2017-05-20 18:16:26 +00:00
cy
cb153abed0 Fix non-recoverable name resolution failures due to negative cache
entries never expiring. This patch honours the negative cache timeout.

To test/experience the failure do the following:

1. Edit /etc/ncd.conf to adjust the cache timeouts as follows:

	positive-time-to-live hosts 30
	negative-time-to-live hosts 1

2. Ensure that nsswitch.conf hosts line contains something like:

	hosts: files cache dns

	Note that cache must be specified before dns.

3. Start nscd.

4. Run the following command:

	while true; do nc -z -w 3 www.google.com 80; sleep 5; done

5. While running the command, remove or comment out all nameserver
   statements in /etc/resolv.conf. After a short while you will notice
   non-recoverable name rsolution failures.

6. Uncomment or replace all nameserver statements back into
   /etc/resolv.conf. Take note that name resolution never recovers.
   To recover nscd must be restarted. This patch fixes this.

PR:		207804
Submitted by:	Jov <amutu@amutu.com>
MFC after:	1 week
2017-05-20 16:58:48 +00:00
jhb
b7d50610ce Properly set the timeout in a query_state. The global query_timeout
configuration value is an integer count of seconds, it is not a timeval.
Using memcpy() to copy a timeval from it put garbage into the tv_usec
field.

PR:		194025
Submitted by:	David Shane Holden <dpejesh@yahoo.com>
MFC after:	1 week
2014-10-06 18:16:45 +00:00
des
feee7c0482 Remove casts from {c,m,re}alloc() and simplify sizeof().
MFC after:	1 week
2009-06-13 13:07:56 +00:00
des
3301650689 Explain to the compiler why the aliasing we're doing is OK.
MFC after:	1 week
2009-06-13 01:22:56 +00:00
des
4523b4f7c6 Fix a large number of signed - unsigned comparison warnings.
MFC after:	1 week
2009-06-13 00:56:17 +00:00
des
79af22e74c #include cleanup
MFC after:	1 week
2009-06-13 00:06:52 +00:00
delphij
43ddac3f1e Reduce code duplication: use calloc instead of allocing and memset
afterward.

Approved by:	bushman
2008-10-12 00:44:27 +00:00
bushman
134f3ad3d3 - Renaming repocopied cached to nscd
Approved by:	re (kensmith), brooks (mentor)
2007-08-09 13:06:12 +00:00
ume
90151bff3d Fix alignment problem on AMD64.
Reported by:	Pascal Hofstee <caelian__at__gmail.com>
Submitted by:	Michael Bushkov <bushman__at__rsu.ru>
Tested by:	Pascal Hofstee <caelian__at__gmail.com>
2006-05-02 23:02:32 +00:00
ume
e14f1c3b3b - Extend the nsswitch to support Services, Protocols and Rpc
databases.
- Make nsswitch support caching.

Submitted by:	Michael Bushkov <bushman__at__rsu.ru>
Sponsored by:	Google Summer of Code 2005
2006-04-28 12:03:38 +00:00