about summary refs log tree commit diff
path: root/nscd/connections.c
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright dates with scripts/update-copyrights.Joseph Myers2020-01-011-1/+1
|
* Prefer https to http for gnu.org and fsf.org URLsPaul Eggert2019-09-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also, change sources.redhat.com to sourceware.org. This patch was automatically generated by running the following shell script, which uses GNU sed, and which avoids modifying files imported from upstream: sed -ri ' s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g ' \ $(find $(git ls-files) -prune -type f \ ! -name '*.po' \ ! -name 'ChangeLog*' \ ! -path COPYING ! -path COPYING.LIB \ ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \ ! -path manual/texinfo.tex ! -path scripts/config.guess \ ! -path scripts/config.sub ! -path scripts/install-sh \ ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \ ! -path INSTALL ! -path locale/programs/charmap-kw.h \ ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \ ! '(' -name configure \ -execdir test -f configure.ac -o -f configure.in ';' ')' \ ! '(' -name preconfigure \ -execdir test -f preconfigure.ac ';' ')' \ -print) and then by running 'make dist-prepare' to regenerate files built from the altered files, and then executing the following to cleanup: chmod a+x sysdeps/unix/sysv/linux/riscv/configure # Omit irrelevant whitespace and comment-only changes, # perhaps from a slightly-different Autoconf version. git checkout -f \ sysdeps/csky/configure \ sysdeps/hppa/configure \ sysdeps/riscv/configure \ sysdeps/unix/sysv/linux/csky/configure # Omit changes that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines git checkout -f \ sysdeps/powerpc/powerpc64/ppc-mcount.S \ sysdeps/unix/sysv/linux/s390/s390-64/syscall.S # Omit change that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
* Remove duplicate initialization of field in nscd.Joseph Myers2019-02-041-1/+0
| | | | | | | | | | | | | | | | | | | I'm looking at the warnings from building glibc with -Wextra, to see if we could use -Wextra by default, possibly with a few of its warnings disabled, and so benefit from warnings in -Wextra but not in -Wall. (The vast bulk of the extra warnings so produced are from -Wunused-parameter -Wsign-compare -Wmissing-field-initializers -Wtype-limits, so I expect those would be disabled at least at first.) Various miscellaneous warnings show up with -Wextra that it clearly seems to make sense to fix independent of whether we add -Wextra to the normal options for building glibc. This patch fixes one: "initialized field overwritten [-Woverride-init]" in nscd. Tested for x86_64. * nscd/connections.c (reqinfo): Initialize SHUTDOWN element only once.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2019-01-011-1/+1
| | | | | | | * All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
* nscd: avoid assertion failure during persistent db checkAndreas Schwab2018-12-191-1/+2
| | | | nscd should not abort when it finds inconsistencies in the persistent db.
* nscd restart: Use malloc instead of extend_alloca [BZ #18023]Florian Weimer2018-06-251-38/+61
| | | | | This introduces a separate function, read_cmdline, which reads the contents of /proc/self/cmdline into a heap-allocated buffer.
* Fix concurrent changes on nscd aware files (BZ #23178)Adhemerval Zanella2018-05-161-52/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As indicated by BZ#23178, concurrent access on some files read by nscd may result non expected data send through service requisition. This is due 'sendfile' Linux implementation where for sockets with zero-copy support, callers must ensure the transferred portions of the the file reffered by input file descriptor remain unmodified until the reader on the other end of socket has consumed the transferred data. I could not find any explicit documentation stating this behaviour on Linux kernel documentation. However man-pages sendfile entry [1] states in NOTES the aforementioned remark. It was initially pushed on man-pages with an explicit testcase [2] that shows changing the file used in 'sendfile' call prior the socket input data consumption results in previous data being lost. From commit message it stated on tested Linux version (3.15) only TCP socket showed this issues, however on recent kernels (4.4) I noticed the same behaviour for local sockets as well. Since sendfile on HURD is a read/write operation and the underlying issue on Linux, the straightforward fix is just remove sendfile use altogether. I am really skeptical it is hitting some hotstop (there are indication over internet that sendfile is helpfull only for large files, more than 10kb) here to justify that extra code complexity or to pursuit other possible fix (through memory or file locks for instance, which I am not sure it is doable). Checked on x86_64-linux-gnu. [BZ #23178] * nscd/nscd-client.h (sendfileall): Remove prototype. * nscd/connections.c [HAVE_SENDFILE] (sendfileall): Remove function. (handle_request): Use writeall instead of sendfileall. * nscd/aicache.c (addhstaiX): Likewise. * nscd/grpcache.c (cache_addgr): Likewise. * nscd/hstcache.c (cache_addhst): Likewise. * nscd/initgrcache.c (addinitgroupsX): Likewise. * nscd/netgroupcache.c (addgetnetgrentX, addinnetgrX): Likewise. * nscd/pwdcache.c (cache_addpw): Likewise. * nscd/servicescache.c (cache_addserv): Likewise. * sysdeps/unix/sysv/linux/Makefile [$(subdir) == nscd] (sysdep-CFLAGS): Remove -DHAVE_SENDFILE. * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_SENDFILE): Remove define. [1] http://man7.org/linux/man-pages/man2/sendfile.2.html [2] https://github.com/mkerrisk/man-pages/commit/7b6a3299776b5c1c4f169a591434a855d50c68b4#diff-efd6af3a70f0f07c578e85b51e83b3c3
* nscd: don't unconditionally use ↵Samuel Thibault2018-02-111-5/+11
| | | | | | | | | | | | PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP is Linux-only. * nscd/connections.c (RWLOCK_INITIALIZER): Define to PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP or PTHREAD_RWLOCK_INITIALIZER if that is not available. (dbs): Use RWLOCK_INITIALIZER instead of PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2018-01-011-1/+1
| | | | | | | * All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
* Fix nscd readlink argument aliasing (bug 22446).Joseph Myers2017-12-181-2/+3
| | | | | | | | | | | | | | | | Current GCC mainline detects that nscd calls readlink with the same buffer for both input and output, which is not valid (those arguments are both restrict-qualified in POSIX). This patch makes it use a separate buffer for readlink's input (with a size that is sufficient to avoid truncation, so there should be no problems with warnings about possible truncation, though not strictly minimal, but much smaller than the buffer for output) to avoid this problem. Tested compilation for aarch64-linux-gnu with build-many-glibcs.py. [BZ #22446] * nscd/connections.c (handle_request) [SO_PEERCRED]: Use separate buffers for readlink input and output.
* Assume that accept4 is always available and worksFlorian Weimer2017-04-191-48/+2
| | | | | | | | | | Simplify the Linux accept4 implementation based on the assumption that it is available in some way. __ASSUME_ACCEPT4_SOCKETCALL was previously unused, so remove it. For ia64, the accept4 system call (and socket call) were backported in kernel version 3.2.18. Reflect this in the installation instructions.
* Assume that O_CLOEXEC is always defined and worksFlorian Weimer2017-04-181-31/+6
|
* Narrowing the visibility of libc-internal.h even further.Zack Weinberg2017-03-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | posix/wordexp-test.c used libc-internal.h for PTR_ALIGN_DOWN; similar to what was done with libc-diag.h, I have split the definitions of cast_to_integer, ALIGN_UP, ALIGN_DOWN, PTR_ALIGN_UP, and PTR_ALIGN_DOWN to a new header, libc-pointer-arith.h. It then occurred to me that the remaining declarations in libc-internal.h are mostly to do with early initialization, and probably most of the files including it, even in the core code, don't need it anymore. Indeed, only 19 files actually need what remains of libc-internal.h. 23 others need libc-diag.h instead, and 12 need libc-pointer-arith.h instead. No file needs more than one of them, and 16 don't need any of them! So, with this patch, libc-internal.h stops including libc-diag.h as well as losing the pointer arithmetic macros, and all including files are adjusted. * include/libc-pointer-arith.h: New file. Define cast_to_integer, ALIGN_UP, ALIGN_DOWN, PTR_ALIGN_UP, and PTR_ALIGN_DOWN here. * include/libc-internal.h: Definitions of above macros moved from here. Don't include libc-diag.h anymore either. * posix/wordexp-test.c: Include stdint.h and libc-pointer-arith.h. Don't include libc-internal.h. * debug/pcprofile.c, elf/dl-tunables.c, elf/soinit.c, io/openat.c * io/openat64.c, misc/ptrace.c, nptl/pthread_clock_gettime.c * nptl/pthread_clock_settime.c, nptl/pthread_cond_common.c * string/strcoll_l.c, sysdeps/nacl/brk.c * sysdeps/unix/clock_settime.c * sysdeps/unix/sysv/linux/i386/get_clockfreq.c * sysdeps/unix/sysv/linux/ia64/get_clockfreq.c * sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c * sysdeps/unix/sysv/linux/sparc/sparc64/get_clockfreq.c: Don't include libc-internal.h. * elf/get-dynamic-info.h, iconv/loop.c * iconvdata/iso-2022-cn-ext.c, locale/weight.h, locale/weightwc.h * misc/reboot.c, nis/nis_table.c, nptl_db/thread_dbP.h * nscd/connections.c, resolv/res_send.c, soft-fp/fmadf4.c * soft-fp/fmasf4.c, soft-fp/fmatf4.c, stdio-common/vfscanf.c * sysdeps/ieee754/dbl-64/e_lgamma_r.c * sysdeps/ieee754/dbl-64/k_rem_pio2.c * sysdeps/ieee754/flt-32/e_lgammaf_r.c * sysdeps/ieee754/flt-32/k_rem_pio2f.c * sysdeps/ieee754/ldbl-128/k_tanl.c * sysdeps/ieee754/ldbl-128ibm/k_tanl.c * sysdeps/ieee754/ldbl-96/e_lgammal_r.c * sysdeps/ieee754/ldbl-96/k_tanl.c, sysdeps/nptl/futex-internal.h: Include libc-diag.h instead of libc-internal.h. * elf/dl-load.c, elf/dl-reloc.c, locale/programs/locarchive.c * nptl/nptl-init.c, string/strcspn.c, string/strspn.c * malloc/malloc.c, sysdeps/i386/nptl/tls.h * sysdeps/nacl/dl-map-segments.h, sysdeps/x86_64/atomic-machine.h * sysdeps/unix/sysv/linux/spawni.c * sysdeps/x86_64/nptl/tls.h: Include libc-pointer-arith.h instead of libc-internal.h. * elf/get-dynamic-info.h, sysdeps/nacl/dl-map-segments.h * sysdeps/x86_64/atomic-machine.h: Add multiple include guard.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2017-01-011-1/+1
|
* Update copyright dates with scripts/update-copyrights.Joseph Myers2016-01-041-1/+1
|
* Assume that SOCK_CLOEXEC is available and worksFlorian Weimer2015-10-171-67/+1
| | | | | This fixes (harmless) data races when accessing the various __have_sock_cloexec variables.
* Enhance nscd's inotify support (Bug 14906).Carlos O'Donell2015-03-131-95/+263
| | | | | | | | | | | | | | | | | | | | | | In bug 14906 the user complains that the inotify support in nscd is not sufficient when it comes to detecting changes in the configurationfiles that should be watched for the various databases. The current nscd implementation uses inotify to watch for changes in the configuration files, but adds watches only for IN_DELETE_SELF and IN_MODIFY. These watches are insufficient to cover even the most basic uses by a system administrator. For example using emacs or vim to edit a configuration file should trigger a reload but it might not if the editors use move to atomically update the file. This atomic update changes the inode and thus removes the notification on the file (as inotify is based on inodes). Thus the inotify support in nscd for configuration files is insufficient to account for the average use cases of system administrators and users. The inotify support is significantly enhanced and described here: https://www.sourceware.org/ml/libc-alpha/2015-02/msg00504.html Tested on x86_64 with and without inotify support.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2015-01-021-1/+1
|
* Add missing include of libc-internal.h.Stefan Liebler2014-11-271-0/+1
|
* Avoid warnings for unused results in nscd/connections.c.Joseph Myers2014-11-261-5/+5
| | | | | | | | | | | | | This patch avoids warnings for unused results of setuid and setgid in nscd/connections.c using an ignore_value macro along the lines suggested by Paul in <https://sourceware.org/ml/libc-alpha/2014-11/msg00733.html>. Tested for x86_64. * include/libc-internal.h (ignore_value): New macro. * nscd/connections.c (restart): Wrap calls to setuid and setgid with ignore_value.
* Fix Wundef warning for SEPARATE_KEYSiddhesh Poyarekar2014-06-261-20/+1
| | | | | The SEPARATE_KEY macro is never defined in any condition or architecture. It is effectively dead code, so remove it.
* nscd: Improved support for tracking startup failure in nscd service (BZ #16639)Siddhesh Poyarekar2014-03-031-23/+25
| | | | | | | | | | | | | | | | | | | | | | Currently, the nscd parent process parses commandline options and configuration, forks on startup and immediately exits with a success. If the child process encounters some error after this, it goes undetected and any services started up after it may have to repeatedly check to make sure that the nscd service did actually start up and is serving requests. To make this process more reliable, I have added a pipe between the parent and child process, through which the child process sends a notification to the parent informing it of its status. The parent waits for this status and once it receives it, exits with the corresponding exit code. So if the child service sends a success status (0), the parent exits with a success status. Similarly for error conditions, the child sends the non-zero status code, which the parent passes on as the exit code. This, along with setting the nscd service type to forking in its systemd configuration file, allows systemd to be certain that the nscd service is ready and is accepting connections.
* Use glibc_likely instead __builtin_expect.Ondřej Bílka2014-02-101-10/+10
|
* Update copyright notices with scripts/update-copyrightsAllan McRae2014-01-011-1/+1
|
* Fix typo in commentSiddhesh Poyarekar2013-06-241-2/+2
|
* Fix handling of netgroup cache in nscdAndreas Schwab2013-06-111-1/+2
|
* Add #include <stdint.h> for uint[32|64]_t usage (except installed headers).Ryan S. Arnold2013-05-161-0/+1
|
* Refactor code out of nscd's two main poll loops.Carlos O'Donell2013-02-081-65/+83
| | | | | | | We refactor the inotify file checking code and the database clearing code out of the main_loop_poll and mail_loop_epoll functions. We document some the related functions with appropriate comments.
* Remove lots of inline keywords.Roland McGrath2013-02-071-1/+1
|
* Update copyright notices with scripts/update-copyrights.Joseph Myers2013-01-021-1/+1
|
* Hurd: #include <kernel-features.h>Thomas Schwinge2012-05-101-4/+3
|
* Replace FSF snail mail address with URLs.Paul Eggert2012-02-091-2/+1
|
* Use kernel headers for netlink definitionsUlrich Drepper2011-11-011-1/+2
|
* Cache network interface informationUlrich Drepper2011-10-311-0/+118
| | | | | | | | | | | | Whenever getaddrinfo needed network interface information it used the netlink interface to read the information every single time. The problem is that this information can change at any time. The patch implements monitoring of the network interfaces through nscd. If no change is detected the previously read information can be reused (which is the norm). This timestamp information is also made available to other processes using the shared memory segment between nscd and those processes.
* Implement caching of nscdUlrich Drepper2011-10-071-8/+38
|
* Don't unnecesarily use inotify in nscdUlrich Drepper2011-10-071-1/+1
|
* Generalize framework to register monitoring of files in nscdUlrich Drepper2011-07-111-83/+82
| | | | | | | | 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.
* Remove doubled words.Jim Meyering2011-04-221-1/+1
|
* Schedule nscd cache pruning more accurately fromr re-added values.Ulrich Drepper2011-02-051-5/+2
|
* Try harder to re-exec nscd in paranoia mode.Ulrich Drepper2009-11-221-4/+3
|
* * nscd/connections.c (send_ro_fd): Define temporary variable to avoidUlrich Drepper2009-04-261-1/+3
| | | | | | warning. * elf/sprof.c: Likewise.
* * nscd/connections.c (restart): Try to preserve the process nameUlrich Drepper2009-03-161-1/+16
| | | | | by reading the /proc/self/exe symlink and using the return name. Patch by Jeff Bastian <jbastian@redhat.com>.
* [BZ #5381]Ulrich Drepper2009-02-131-15/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* * nscd/connections.c (nscd_init): If database file access beUlrich Drepper2009-01-281-1/+4
| | | | | opened check whether this is due to permission problems and bail in that case.
* [BZ #7067]Ulrich Drepper2008-12-091-2/+12
| | | | | | | | | 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.
* * socket/sys/socket.h: Declare accept4.Ulrich Drepper2008-12-031-19/+36
| | | | | | | | | | | | | | | | | * 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.
* * elf/Makefile: Add rules to build and run tst-tls17. cvs/fedora-glibc-20081019T1815Ulrich Drepper2008-10-171-0/+2
| | | | | | * elf/tst-tls17.c: New test. * elf/tst-tlsmod17a.c: New file. * elf/tst-tlsmod17b.c: Likewise.
* * nscd/connections.c: Disable use of paccept for now.Ulrich Drepper2008-09-301-1/+1
|
* (main_loop_poll): Pass a buffer which is guaranteed to be large enough to ↵Ulrich Drepper2008-08-031-6/+13
| | | | read inotify event. Ignore EAGAIN error. Better error message. Add branch predicition. (main_loop_epoll): Likewise.
* * nscd/connections.c (nscd_init): Type if preprocessor directive.Ulrich Drepper2008-07-301-1/+1
| | | | | * sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_PACCEPT): Define.