Commit Graph

435 Commits

Author SHA1 Message Date
Marek Polacek
b902330ca8 Avoid warning in nscd config file parsing code 2011-07-19 20:13:31 -04:00
Ulrich Drepper
feb1eb0be7 Avoid possible crashes in anormal nscd exits 2011-07-19 13:59:57 -04:00
Ulrich Drepper
319b9ad4bc Generalize framework to register monitoring of files in nscd
nscd can clear caches when certain files change.  The list of files
was hardcoded so far and worked for nss_files and nss_dns and those
modules which need no monitoring.  nss_db, for instance, has its
own set of files to monitor.  Now the NSS modules themselves can
request that certain files are monitored.
2011-07-11 14:50:24 -04:00
Ulrich Drepper
f15f1e45ba Avoid warning. 2011-07-05 06:56:12 -04:00
Ulrich Drepper
99231d9abe nscd cleanups
Cleanup and optimize last patch.  Add timeout fixes also to the
services cache.
2011-07-01 23:02:09 -04:00
Thorsten Kukuk
445b4a53ea Handle nscd negtimeout==0 2011-07-01 22:53:01 -04:00
Ulrich Drepper
cf3b23ffcd Avoid write to invalid file descriptor in nscd
When readding entries to the group and services cache and the lookup
is unsuccesful, we tried to write the notfound record.  Just don't
do it in this case.
2011-06-29 23:33:38 -04:00
Ulrich Drepper
034807a9cb Fix handling of RES_USE_INET6 big in nscd
This fixes BZ #12350 also for nscd.
2011-06-27 13:10:44 -04:00
Roland McGrath
5615eaf264 Quash some new warnings from GCC 4.6. 2011-06-10 22:44:20 -07:00
Ulrich Drepper
c8fc0c9169 Don't free non-malloced memory and fix memory leak 2011-05-31 08:45:44 -04:00
Ulrich Drepper
f2962a7195 Add a few more alloca size checks 2011-05-22 23:04:16 -04:00
Andreas Schwab
da62f81bdd Add support for generated PIE link rules 2011-05-13 23:31:43 -04:00
Jim Meyering
ded5b9b7c7 Remove doubled words. 2011-04-22 21:34:32 -04:00
Justin P. Mattock
795934a60e Fix a comment. 2011-04-17 20:55:16 -04:00
Ulrich Drepper
a4c7ea7bb8 Schedule nscd cache pruning more accurately fromr re-added values. 2011-02-05 20:07:27 -05:00
Ulrich Drepper
c0dafcf176 Update copyright year. 2011-01-17 15:08:10 -05:00
Ulrich Drepper
bc425b339b Signal temporary host lookup errors in nscd as such to the requester. 2011-01-15 11:10:11 -05:00
Ulrich Drepper
ea42a20cae Fix crash on reloading of gai data in nscd. 2010-04-09 21:38:20 -07:00
Ulrich Drepper
d55d558b4e Print reload count in nscd statistics. 2010-04-08 19:58:29 -07:00
Ulrich Drepper
561470e061 Update copyright year. 2010-03-15 11:50:59 -07:00
Ulrich Drepper
351fe94770 Try harder to re-exec nscd in paranoia mode. 2009-11-22 19:07:52 -08:00
Anders Johansson
ea547a1a6e Fix a few asserts and IO calls in nscd.
The nscd/*cache.c files contain assert()s, writeall() and sendfileall() calls
that invalidly use together &dataset->resp and total where either dataset or
dataset->head.recsize should be used instead one of the components. In the
writeall() and sendfileall() cases, it is unlikely to matter in practice, but
the assertions can fail sometimes without a proper reason.
2009-10-29 22:18:26 -07:00
Ulrich Drepper
e0f471a118 Print timestamp in nscd debug messages. 2009-10-29 13:45:10 -07:00
Ulrich Drepper
00ebd7ed58 Revert "Fix lock handling in memory hander of nscd."
This reverts commit 137028b4d7.

Conflicts:

	ChangeLog
2009-07-17 07:49:16 -07:00
Petr Baudis
137028b4d7 Fix lock handling in memory hander of nscd.
The commit 20e498bd removes the pthread_mutex_rdlock() calls, but not the
corresponding pthread_mutex_unlock() calls. Also, the database lock is never
unlocked in one branch of the mempool_alloc() if.

I think unreproducible random assert(dh->usable) crashes in prune_cache() were
caused by this. But an easy way to make nscd threads hang with the broken
locking was.
2009-07-16 10:10:10 -07:00
Andreas Schwab
50158f9552 Use correct release semantic in list update.
nscd uses lockfree lists and we need to ensure the correct release
semantics is used when adding to the list.
2009-07-16 09:57:32 -07:00
H.J. Lu
435aa54b3b Consolidate PIE linking Makefile rules. 2009-06-16 09:19:59 -07:00
Jakub Jelinek
5078fff6c4 Fix forced loop termination in nscd database lookup.
There are two issues with the forced loop exit in the nscd lookup:
1. the estimate of the entry size isn't pessimistic enough for all
   databases, resulting potentially is too early exits
2. the combination of 64-bit process and 32-bit nscd would lead to
   rejecting valid records in the database.
2009-05-18 10:19:50 -07:00
Ulrich Drepper
fa546abe9d Move BLOCK_ALIGN* macros back.
The move to nscd-client.h was only needed for some interim version
of the patch.  The final version doesn't need it.  Undo the change.
2009-05-16 10:29:43 -07:00
Ulrich Drepper
95410b7ba2 Fix exit condition.
The patch to bound the search in the nscd caches used a wrong exit
condition.  Fixed now.
2009-05-16 10:10:32 -07:00
Ulrich Drepper
831a40494d Further robustify nscd database lookup.
We can compute an absolute maximum for the number of elements which
can fit into the currently mapped database.  Stop after that many
iterations.
2009-05-15 21:33:43 -07:00
Jakub Jelinek
cfe1fc1013 Robustify libc-side nscd database reader.
The nscd database mapped in processes can change at any time.  We
have to be more vigilant when it comes to using that memory.  Test
the data entries are valid in their entire size, don't read data
again from memory once we verified it, and make sure the trailing
pointer is not going off the deep end.
2009-05-15 21:17:08 -07:00
Jakub Jelinek
9e471dad8e Don't try to cleanup libselinux and libaudit.
Because we are not shutting down the other threads first another
thread might work on a query before the process shuts down.  In this
case the now uninitialized libselinux and libaudit might be used.
Just don't free the resources.  It's not necessary anyway because
the process is about to terminate.
2009-05-15 20:48:08 -07:00
Ulrich Drepper
1ac03a1e44 * nscd/connections.c (send_ro_fd): Define temporary variable to avoid
warning.

	* elf/sprof.c: Likewise.
2009-04-26 22:31:19 +00:00
Ulrich Drepper
6cc8844f1d * sysdeps/unix/sysv/linux/dl-osinfo.h (dl_fatal): Remove inline
from definition.

	* sysdeps/x86_64/dl-machine.h (elf_machine_rela): Don't define
	label if it is not used.

	* elf/dl-profile.c (_dl_start_profile): Define real-type variant
	of gmon_hist_hdr and gmon_hdr structures and use them.

	* elf/dl-load.c (open_verify): Add temporary variable to avoid
	warning.

	* nscd/nscd_helper.c (get_mapping): Avoid casts to avoid warnings.

	* sunrpc/clnt_raw.c (clntraw_private_s): Use union in definition
	to avoid cast.

	* inet/rexec.c (rexec_af): Make sa2 a union to avoid warnings.
	* inet/rcmd.c (rcmd_af): Make from a union of the various needed types
	to avoid warnings.
	(iruserok_af): Use ss_family instead of casts.

	* gmon/gmon.c (write_hist): Define real-type variant of
	gmon_hist_hdr structure and use it.
	(write_gmon): Likewise for gmon_hdr.

	* sysdeps/unix/sysv/linux/readv.c: Avoid declaration of replacement
	function if we are not going to define it.
	* sysdeps/unix/sysv/linux/writev.c: Likewise.

	* inet/inet6_option.c (optin_alloc): Add temporary variable to
	avoid warning.

	* libio/strfile.h (struct _IO_streambuf): Use correct type and
	name of VTable element.
	* libio/iovsprintf.c: Avoid casts to avoid warnings.
	* libio/iovsscanf.c: Likewise.
	* libio/vasprintf.c: Likewise.
	* libio/vsnprintf.c: Likewise.
	* stdio-common/isoc99_vsscanf.c: Likewise.
	* stdlib/strfmon_l.c: Likewise.
	* debug/vasprintf_chk.c: Likewise.
	* debug/vsnprintf_chk.c: Likewise.
	* debug/vsprintf_chk.c: Likewise.
2009-04-26 20:12:37 +00:00
Ulrich Drepper
d9822dbe66 * nscd/connections.c (restart): Try to preserve the process name
by reading the /proc/self/exe symlink and using the return name.
	Patch by Jeff Bastian <jbastian@redhat.com>.
2009-03-16 22:33:01 +00:00
Ulrich Drepper
20e498bdb0 [BZ #5381]
2009-02-13  Ulrich Drepper  <drepper@redhat.com>
	[BZ #5381]
	* nscd/nscd.h: Remove definitions and declarations for mem_in_flight.
	Change mempool_alloc prototype.
	* nscd/mem.c (gc): Don't handle mem_in_flight.
	(mempool_alloc): Third parameter now only indicates whether this is the
	first call (to allocate data) or not.  If it is, get db rdlock.
	Release it on error.  Don't handle mem_in_flight.
	* nscd/aicache.c (addhstaiX): Mark he parameter as const.
	Adjust third parameter of mempool_alloc calls.
	Nothing to do here in case mempool_alloc fails.
	Avoid local variable shadowing parameter.  No need to get db rdlock
	before calling cache_add.
	* nscd/cache.c (cache_add): Adjust call to mempool_alloc.  There is
	no mem_in_flight array anymore.
	* nscd/connections.c: Remove definition and handling of mem_in_flight.
	* nscd/grpcache.c (cache_addgr): Adjust third parameter of
	mempool_alloc calls.  Mark he parameter as const.  Nothing to do here
	in case mempool_alloc fails. No need to get db rdlock before calling
	cache_add.
	* nscd/hstcache.c (cache_addhst): Likewise.
	* nscd/initgrcache.c (addinitgroupsX): Likewise.
	* nscd/servicescache.c (cache_addserv): Likewise.
	* nscd/pwdcache.c (cache_addpw): Likewise.  Remove some debugging code.
2009-02-13 20:36:37 +00:00
Ulrich Drepper
cbbcaf2369 * debug/xtrace.sh: Unify translatable messages.
* elf/ldd.bash.in: Likewise.
	* elf/sprof.c: Likewise.
	* locale/programs/locale.c: Likewise.
	* malloc/memusage.sh: Likewise.
	* nss/getent.c: Likewise.

2009-02-06  Joseph Myers  <joseph@codesourcery.com>

	* debug/pcprofiledump.c (print_version,
	argp_program_version_hook): New function.
	* elf/ldconfig.c (more_help): New function.
	(argp): Use it.
	* elf/sln.c (usage): New function.
	(main): Support --help and --version.
	* malloc/memusagestat.c (print_version): New function.
	(argp_program_version_hook): New variable.
	* nscd/nscd.c (more_help): New function.
	(argp): Use it.
	* posix/getconf.c (main): Send --version output to stdout.
	Support --help.
	* sunrpc/rpc_main.c (usage, options_usage): Take STREAM and STATUS
	arguments.  All callers changed.
	(print_version): New function.
	(parseargs): Support --help and --version.
	* sunrpc/rpcinfo.c (usage): Take STREAM argument.  All callers
	changed.
	(print_version): New function.
	(main): Use getopt_long.  Support --help and --version.
	* sysdeps/unix/sysv/linux/lddlibc4.c (main): Support --help and
	--version.

2009-02-06  Ulrich Drepper  <drepper@redhat.com>
2009-02-06 20:13:07 +00:00
Ulrich Drepper
fd537e535f [BZ #9750]
* nscd/mem.c (gc): Use alloca_count to get the real stack usage.
	* include/alloca.h (alloca_account): Define.
	* sysdeps/x86_64/stackinfo.h (stackinfo_get_sp): Define.
	(stackinfo_sub_sp): Define.
2009-01-29 00:17:57 +00:00
Ulrich Drepper
31d322a214 * nscd/connections.c (nscd_init): If database file access be
opened check whether this is due to permission problems and bail
	in that case.
2009-01-28 21:00:13 +00:00
Ulrich Drepper
5627534a81 [BZ #9741]
2009-01-28  Ulrich Drepper  <drepper@redhat.com>
	[BZ #9741]
	* nscd/mem.c (gc): Fix assignment of he_data in case malloc is used.
	Reported by Jun'ichi Nomura <j-nomura@ce.jp.nec.com>.
2009-01-28 20:04:49 +00:00
Roland McGrath
251fe50c6d 2009-01-10 Roland McGrath <roland@redhat.com>
* nscd/nscd.c (parse_opt): Use argp_error for bad -i argument.
2009-01-11 04:32:05 +00:00
Ulrich Drepper
d36ad87147 * posix/getconf.c: Update copyright year.
* nss/getent.c: Likewise.
	* iconv/iconvconfig.c: Likewise.
	* iconv/iconv_prog.c: Likewise.
	* elf/ldconfig.c: Likewise.
	* catgets/gencat.c: Likewise.
	* csu/version.c: Likewise.
	* elf/ldd.bash.in: Likewise.
	* elf/sprof.c (print_version): Likewise.
	* locale/programs/locale.c: Likewise.
	* locale/programs/localedef.c: Likewise.
	* nscd/nscd.c (print_version): Likewise.
	* debug/xtrace.sh: Likewise.
	* malloc/memusage.sh: Likewise.
	* malloc/mtrace.pl: Likewise.
	* debug/catchsegv.sh: Likewise.
2009-01-02 08:47:18 +00:00
Ulrich Drepper
50e481ceeb * nscd/nscd_gethst_r.c (nscd_gethst_r): Don't use nscd if
LOCALDOMAIN is defined.
	* nscd/nscd_getai.c (__nscd_getai): Likewise.
2008-12-29 20:56:13 +00:00
Ulrich Drepper
cd72adebda [BZ #7067]
2008-12-03  Petr Baudis  <pasky@suse.cz>
	[BZ #7067]
	* nscd/connections.c (invalidate_cache): Use prune_run_lock
	instead of prune_lock.
	(nscd_run_prune): Before calling prune_cache, take prune_run_lock.
	* nscd/nscd.h (database_dyn): Add prune_run_cache.
2008-12-09 05:24:37 +00:00
Ulrich Drepper
f93fc0b75a * socket/sys/socket.h: Declare accept4.
* socket/accept4.c: New file.
	* sysdeps/unix/sysv/linux/accept4.c: New file.
	* sysdeps/unix/sysv/linux/i386/accept4.S: New file.
	* socket/Makefile (routines): Add accept4.
	* socket/Versions: Export accept4 with version GLIBC_2.10.
	* socket/paccept.c: Removed.
	* sysdeps/unix/sysv/linux/paccept.c: Removed.
	* sysdeps/unix/sysv/linux/i386/paccept.S: Removed.
	* Versions.def: Define GLIBC_2.10 for libc.
	* sysdeps/unix/sysv/linux/kernel-features.h: Define __ASSUME_ACCEPT4.

	* nscd/connections.c: Use accept4.

	* sysdeps/unix/sysv/linux/i386/socket.S: Fix comment.
2008-12-03 04:23:18 +00:00
Ulrich Drepper
60a23f5a72 * elf/Makefile: Add rules to build and run tst-tls17.
* elf/tst-tls17.c: New test.
	* elf/tst-tlsmod17a.c: New file.
	* elf/tst-tlsmod17b.c: Likewise.
2008-10-17 15:24:10 +00:00
Ulrich Drepper
3452ded520 * nscd/connections.c: Disable use of paccept for now. 2008-09-30 14:17:12 +00:00
Ulrich Drepper
39e175bb3a (main_loop_poll): Pass a buffer which is guaranteed to be large enough to read inotify event. Ignore EAGAIN error. Better error message. Add branch predicition. (main_loop_epoll): Likewise. 2008-08-03 15:46:46 +00:00
Ulrich Drepper
bd7f48571d * nscd/connections.c (nscd_init): Type if preprocessor directive.
* sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_PACCEPT):
	Define.
2008-07-30 16:33:19 +00:00