summaryrefslogtreecommitdiff
path: root/lib/libc/yp
Commit message (Collapse)AuthorAgeFilesLines
* Increase the size of the send and receive buffers for YP client rpcKonstantin Belousov2019-09-161-1/+1
| | | | | | | | | | | | | | | | | | | calls to max allowed UDP datagram size. Since max allowed size both for keys and values where increased, the old sizes of around 1K cause ypmatch(3) failures, while plain maps fetches work. The buffers were reduced in r34146 from default UDP rpcclient values to 1024/2304 due to the key and value size being 1K. Reviewed by: slavash Sponsored by: Mellanox Technologies MFC after: 1 week Differential revision: https://reviews.freebsd.org/D21586 Notes: svn path=/head/; revision=352384
* libc: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-252-2/+6
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using mis-identified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326193
* Use on crypto.x and rpc.x from the source tree.Bryan Drewery2016-06-281-1/+1
| | | | | | | | | | | | This fixes the build when DESTDIR may be blank or not yet populated. It also fixes reproducibility. Submitted by: brooks Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D6455 Notes: svn path=/head/; revision=302255
* libc: do not include <sys/types.h> where <sys/param.h> was already includedAndriy Voskoboinyk2016-04-181-1/+0
| | | | | | | | | According to style(9): > normally, include <sys/types.h> OR <sys/param.h>, but not both. (<sys/param.h> already includes <sys/types.h> when LOCORE is not defined). Notes: svn path=/head/; revision=298226
* If a NIS server has long entries on its database that is bigger thanMarcelo Araujo2015-11-191-5/+28
| | | | | | | | | | | | | | | | | | | | | | | | 1024 specified on YPMAXRECORD the ypmatch can get in an infinite retry loop when is requesting the information from the NIS server. The ypmatch(1) will return an error until the command receives an kill(1). To avoid this problem, we check the MAX_RETRIES that is by default set to 20 and avoid get in infinet loop at the client side. NOTE: FreeBSD nis(8) server doesn't present this issue. Submitted by: Ravi Pokala <rpokala@panasas.com>, Lakshmi N. Sundararajan <lakshmi.n@msystechnologies.com>, Lewis, Fred <flewis@panasas.com>, Pushkar Kothavade <pushkar.kothavade@msystechnologies.com> Approved by: bapt (mentor) MFC after: 1 month Differential Revision: D4095 Notes: svn path=/head/; revision=291073
* Replace use of ${.CURDIR} by ${LIBC_SRCTOP} and define ${LIBC_SRCTOP}Marcel Moolenaar2014-03-041-2/+2
| | | | | | | | | | | | | | if not already defined. This allows building libc from outside of lib/libc using a reach-over makefile. A typical use-case is to build a standard ILP32 version and a COMPAT32 version in a single iteration by building the COMPAT32 version using a reach-over makefile. Obtained from: Juniper Networks, Inc. Notes: svn path=/head/; revision=262722
* libc: Use O_CLOEXEC for various internal file descriptors.Jilles Tjoelker2012-09-291-1/+1
| | | | | | | | | | | | This fixes a race condition where another thread may fork() before CLOEXEC is set, unintentionally passing the descriptor to the child process. This commit only adds O_CLOEXEC flags to open() or openat() calls where no fcntl(fd, F_SETFD, FD_CLOEXEC) follows. The separate fcntl() call still leaves a race window so it should be fixed later. Notes: svn path=/head/; revision=241046
* Consistently set RPCGEN_CPP when running rpcgen, so the C preprocessorDimitry Andric2012-02-071-1/+1
| | | | | | | | | set via ${CPP} is used, instead of always using hardcoded /usr/bin/cpp. MFC after: 1 week Notes: svn path=/head/; revision=231118
* Handle malloc failures in yplib.c.Guy Helmer2011-12-231-0/+46
| | | | | | | PR: bin/83349 Notes: svn path=/head/; revision=228828
* Handle failures to malloc memory to hold key or val copies.Guy Helmer2011-12-231-0/+11
| | | | | | | PR: bin/83348 Notes: svn path=/head/; revision=228826
* Remove duplicate "in".Rebecca Cran2011-03-011-1/+1
| | | | | | | | Suggested by: Rob Farmer <rfarmer at predatorlabs.net> MFC after: 3 days Notes: svn path=/head/; revision=219126
* Revert some of r177626. "in in" is valid in certain sentences.Rebecca Cran2011-02-281-1/+1
| | | | | | | | PR: 121490 MFC after: 3 days Notes: svn path=/head/; revision=219096
* Eliminate more dead stores.Garrett Wollman2009-11-251-1/+1
| | | | | | | | Found by: Clang static analyzer MFC after: 7 days Notes: svn path=/head/; revision=199784
* Fix some "in in" typos in comments.Christian Brueffer2008-03-261-1/+1
| | | | | | | | | | PR: 121490 Submitted by: Anatoly Borodin <anatoly.borodin@gmail.com> Approved by: rwatson (mentor), jkoshy MFC after: 3 days Notes: svn path=/head/; revision=177626
* Set timeout for all NIS RPC requests to 1 second and not just forSimon L. B. Nielsen2007-07-241-8/+8
| | | | | | | | | | | | | | | yp_next as revision 1.50 did. This should fix, or at least very much reduce the risk of, NIS timing out due to UDP packet loss for NIS functions. See also revision 1.50 for more details about the general problem. Tested by: nosedive, freefall, hub, mx1, brooks MFC after: 1 week Approved by: re (mux) Notes: svn path=/head/; revision=171563
* Use C comments since we now preprocess these files with CPP.Daniel Eischen2007-04-291-1/+3
| | | | Notes: svn path=/head/; revision=169092
* - Bump _yplib_timeout limit from 10 to 20 seconds to better handleSimon L. B. Nielsen2007-03-041-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | packet loss when talking to a NIS server. - Set 1 second retry timeout to further realistically handle UDP packet loss for yp_next packet bursts. If the packet hasn't come back within 1 second its rather unlikely to come back at all. There is still back-off mechanism in RPC so if there is another reason than packet loss for the lack of response within 1 second, the NIS server will not be totally bombarded with requests. This reduces the risk of NIS failing with: yp_next: clnt_call: RPC: Timed out considerably. This is mainly a problem if you have larger NIS maps (like at FreeBSD.org) since enumerations of the lists will cause a UDP packet bursts where a few packets being lost once in a while do happen. MFC after: 1 week Discussed with: peter Problem mainly diagnosed by: peter Notes: svn path=/head/; revision=167197
* Add each directory's symbol map file to SYM_MAPS.Daniel Eischen2006-03-131-0/+2
| | | | Notes: svn path=/head/; revision=156613
* Add symbol maps and initial symbol version definitions to libc.Daniel Eischen2006-03-131-0/+23
| | | | | | | Reviewed by: davidxu Notes: svn path=/head/; revision=156608
* do mutex lock for each yp calls. with this,Hajimu UMEMOTO2005-05-031-13/+65
| | | | | | | | http://cvsweb.netbsd.org/bsdweb.cgi/src/regress/lib/libpthread/resolv/ is working. Notes: svn path=/head/; revision=145849
* MUTEX_INITIALIZER should be used instead ofHajimu UMEMOTO2005-04-061-1/+1
| | | | | | | PTHREAD_MUTEX_INITIALIZER, here. Notes: svn path=/head/; revision=144714
* protect _yp_domain with mutex lock.Hajimu UMEMOTO2005-04-051-3/+24
| | | | | | | Inspired by: NetBSD Notes: svn path=/head/; revision=144678
* Use socklen_t where appropriate.Stefan Farfeleder2005-03-111-2/+2
| | | | Notes: svn path=/head/; revision=143415
* Back out the `hiding' of strlcpy and strlcat. Several peopleJacques Vidrine2003-05-011-1/+1
| | | | | | | vocally objected to this safety belt. Notes: svn path=/head/; revision=114443
* `Hide' strlcpy and strlcat (using the namespace.h / __weak_referenceJacques Vidrine2003-04-291-1/+1
| | | | | | | | | | technique) so that we don't wind up calling into an application's version if the application defines them. Inspired by: qpopper's interfering and buggy version of strlcpy Notes: svn path=/head/; revision=114256
* libc_r wasn't so tied to libc for 22 months.Ruslan Ermilov2002-11-181-1/+1
| | | | Notes: svn path=/head/; revision=107052
* Spell void * as void * rather than caddr_t. This is complicated by theDag-Erling Smørgrav2002-04-282-23/+30
| | | | | | | | | fact that caddr_t is often misspelled as char *. Sponsored by: DARPA, NAI Labs Notes: svn path=/head/; revision=95658
* Fix the style of the SCM ID's.David E. O'Brien2002-03-222-6/+4
| | | | | | | I believe have made all of libc .c's as consistent as possible. Notes: svn path=/head/; revision=92986
* o Move NTOHL() and associated macros into <sys/param.h>. These areMike Barcroft2002-02-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | deprecated in favor of the POSIX-defined lowercase variants. o Change all occurrences of NTOHL() and associated marcros in the source tree to use the lowercase function variants. o Add missing license bits to sparc64's <machine/endian.h>. Approved by: jake o Clean up <machine/endian.h> files. o Remove unused __uint16_swap_uint32() from i386's <machine/endian.h>. o Remove prototypes for non-existent bswapXX() functions. o Include <machine/endian.h> in <arpa/inet.h> to define the POSIX-required ntohl() family of functions. o Do similar things to expose the ntohl() family in libstand, <netinet/in.h>, and <sys/param.h>. o Prepend underscores to the ntohl() family to help deal with complexities associated with having MD (asm and inline) versions, and having to prevent exposure of these functions in other headers that happen to make use of endian-specific defines. o Create weak aliases to the canonical function name to help deal with third-party software forgetting to include an appropriate header. o Remove some now unneeded pollution from <sys/types.h>. o Add missing <arpa/inet.h> includes in userland. Tested on: alpha, i386 Reviewed by: bde, jake, tmm Notes: svn path=/head/; revision=90868
* ANSIfy and remove some dead code.Dag-Erling Smørgrav2002-02-062-81/+35
| | | | | | | Sponsored by: DARPA, NAI Labs Notes: svn path=/head/; revision=90298
* Apply the following mechanical transformations in preparation forDag-Erling Smørgrav2002-02-062-133/+133
| | | | | | | | | | | | | | | | | | | | ansification and constification: s{\s+__P\((\(.*?\))\)}{$1}g; s{\(\s+}{\(}g; s{\s+\)}{\)}g; s{\s+,}{,}g; s{(\s+)(for|if|switch|while)\(}{$1$2 \(}g; s{return ([^\(].*?);}{return ($1);}g; s{([\w\)])([!=+/\*-]?=)([\w\(+-])}{$1 $2 $3}g; s{\s+$}{\n};g Also add $FreeBSD$ where needed. MFC after: 1 week Notes: svn path=/head/; revision=90297
* Fix cc -Wall, fix rcsid warnings, add missing prototypes,Alfred Perlstein2002-02-052-2/+2
| | | | | | | | | | | | change prototypes to be the same as in the original sun tirpc code. Remove ()P macro in a file where the mayority had ()P already removed. Add them if the mayority use ()P macros. Submitted by: mbr Requested by: bde Notes: svn path=/head/; revision=90271
* Fix some 32/64-bit bugs. IPv4 addresses are 32-bits, not longs. On theJohn Baldwin2002-01-081-8/+12
| | | | | | | | | | | alpha these bugs didn't cause any problems because it was little endian, but on sparc64, we ended up with garbage for the IP address when we tried to contact the server. (Usually 3.253.0.0) Not objected to by: wpaul Notes: svn path=/head/; revision=89084
* Changed the clnt_perror string in yp_all because it was saying theJim Pirzyk2001-05-231-1/+1
| | | | | | | | | | | | error came from yp_next PR: bin/13254 Submitted by: Jim Pirzyk Reviewed by: jkh MFC after: 1 week Notes: svn path=/head/; revision=77044
* Remove _THREAD_SAFE and make libc thread-safe by default byDaniel Eischen2001-01-241-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | adding (weak definitions to) stubs for some of the pthread functions. If the threads library is linked in, the real pthread functions will pulled in. Use the following convention for system calls wrapped by the threads library: __sys_foo - actual system call _foo - weak definition to __sys_foo foo - weak definition to __sys_foo Change all libc uses of system calls wrapped by the threads library from foo to _foo. In order to define the prototypes for _foo(), we introduce namespace.h and un-namespace.h (suggested by bde). All files that need to reference these system calls, should include namespace.h before any standard includes, then include un-namespace.h after the standard includes and before any local includes. <db.h> is an exception and shouldn't be included in between namespace.h and un-namespace.h namespace.h will define foo to _foo, and un-namespace.h will undefine foo. Try to eliminate some of the recursive calls to MT-safe functions in libc/stdio in preparation for adding a mutex to FILE. We have recursive mutexes, but would like to avoid using them if possible. Remove uneeded includes of <errno.h> from a few files. Add $FreeBSD$ to a few files in order to pass commitprep. Approved by: -arch Notes: svn path=/head/; revision=71579
* Simplify sytem call renaming. Instead of _foo() <-- _libc_foo <-- foo(),Jason Evans2000-01-271-9/+15
| | | | | | | | | | | | | | | | | | | | just use _foo() <-- foo(). In the case of a libpthread that doesn't do call conversion (such as linuxthreads and our upcoming libpthread), this is adequate. In the case of libc_r, we still need three names, which are now _thread_sys_foo() <-- _foo() <-- foo(). Convert all internal libc usage of: aio_suspend(), close(), fsync(), msync(), nanosleep(), open(), fcntl(), read(), and write() to _foo() instead of foo(). Remove all internal libc usage of: creat(), pause(), sleep(), system(), tcdrain(), wait(), and waitpid(). Make thread cancellation fully POSIX-compliant. Suggested by: deischen Notes: svn path=/head/; revision=56698
* Add three-tier symbol naming in support of POSIX thread cancellationJason Evans2000-01-121-9/+9
| | | | | | | | | points. For library functions, the pattern is __sleep() <-- _libc_sleep() <-- sleep(). The arrows represent weak aliases. For system calls, the pattern is _read() <-- _libc_read() <-- read(). Notes: svn path=/head/; revision=55837
* Fix buffer overflows.Kris Kennaway1999-12-051-2/+2
| | | | | | | Reviewed by: imp, audit@freebsd.org Notes: svn path=/head/; revision=54167
* $Id$ -> $FreeBSD$Peter Wemm1999-08-283-3/+3
| | | | Notes: svn path=/head/; revision=50476
* Fixed the usual missing dependencies on headers generated by rpcgen.Bruce Evans1998-05-091-6/+6
| | | | | | | | | | | | Use rpcgen's -C option, although using it for non-headers breaks K&R support. A local copy of yp.h is built to avoid adding -I/usr/include/rpcsvc to CFLAGS. This version of yp.h differed from <rpcsvc/yp.h> only in not declaring prototypes. Fixed style bugs. Notes: svn path=/head/; revision=35898
* Fix resource allocation problems:Bill Paul1998-03-071-94/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Completely recoded the ypmatch cache code. The old code could leak memory: it would allow the cache to grow, but never shrink. The new code imposes the following limits: o The cache is capped at a limit of 5 entries. o Each entry expires after five seconds, at which point its slot is freed. o If an insertion is to be done and all five slots are filled, the oldest entry is forcibly expired to release its slot. Also, the cache is implemented on a per-binding basis rather than having a global cache covering all bindings. This means that each bound domain has its own 5 slot cache. - Changed clntudp_create() to clntudp_bufcreate() so that the xmit/recv message buffer sizes can be set explicitly. NIS transactions are rarely much larger than 1024 bytes since YPMAXRECORD is 1024. The defaults chosen by clntudb_create() are actually much larger than needed. I set the xmit buffer to a little over 1024 and the recv buffer to a little over 2048. This saves a few Kbytes for each NIS binding. - Add my name to the copyright. I think I've made enough changes to this file to merit it. :) Note: these changes should go into the 2.2.x branch, but I'm waiting on feedback from a tester to see if the cache fixes solve the reported memory leak problem. Notes: svn path=/head/; revision=34146
* Use ${DESTDIR} correctly in front of absolute paths.Satoshi Asami1997-05-231-2/+2
| | | | Notes: svn path=/head/; revision=26047
* Changed all paths to be relative to src/lib instead of src/lib/libcJohn Birrell1997-05-031-2/+2
| | | | | | | | | | | | | so that all these makefiles can be used to build libc_r too. Added .if ${LIB} == "c" tests to restrict man page builds to libc to avoid needlessly building them with libc_r too. Split libc Makefile into Makefile and Makefile.inc to allow the libc_r Makefile to include Makefile.inc too. Notes: svn path=/head/; revision=25401
* Don't even think about processing bogus domain names here.Bill Paul1997-04-101-1/+5
| | | | Notes: svn path=/head/; revision=24797
* Revert $FreeBSD$ to $Id$Peter Wemm1997-02-223-3/+3
| | | | Notes: svn path=/head/; revision=22993
* Make the long-awaited change from $Id$ to $FreeBSD$Jordan K. Hubbard1997-01-143-3/+3
| | | | | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise. Notes: svn path=/head/; revision=21673
* Fix for bug noticed by Christoph Kukulies.Bill Paul1996-12-201-2/+3
| | | | | | | | | | | | | | | | | | | _yp_dobind() checks to see if a fork() happens (by checking PIDs) and invalidates all bindings if it finds itself in a newly created child process. (This avoids sharing RPC client handles and socket descriptors with the parent, which would be bad.) Unfortunately, it summarily calls clnt_destroy() on the handles, which may result in the destruction of a descriptor that isn't really a socket. This is fixed by replacing the explicit call to clnt_destroy() with a call to _yp_unbind(), which deals with potentially hosed socket descriptors an a safe manner. This is basically a one-liner. Once I confirm that it fixes Christoph's problem, I'd like permission to put it in the 2.2-RELENG branch. Notes: svn path=/head/; revision=20716
* - Avoid possible SEGVs: never call clnt_destroy() without checkingBill Paul1996-11-081-8/+36
| | | | | | | | | | | | | | | for NULL RPC client handles. This should hopefully fix the problems Satoshi reported on -current. - Add socket descriptor sanity checks to _yp_unbind(). - Fix yp_order() so that it handles the RPC_PROCUNAVAIL error gracefully. NIS+ in YP compat mode doesn't support the YPPROC_ORDER procedure. This is a 2.2 candidate with bells on. Notes: svn path=/head/; revision=19520
* In _yp_dobind(), if we find ourselves required to contact the local ypbindBill Paul1996-07-131-0/+18
| | | | | | | | | | | | | | | | | | directly in order to obtain binding information, check that the local ypbind is using a reserved port and return YPERR_YPBIND if it isn't. We should not trust any ypbind running on a port >= IPPORT_RESERVED; it may have been started by a malicious user hoping to trick us into talking to a bogus ypserv. Note that we do not check the ypserv port returned to us from ypbind. It is assumed that ypbind has already done a reserved port test (or not, depending on whether or not it was started with -s); if we trust the authenticity of the local ypbind, we should also trust its judgement. Obtained from: OpenBSD Notes: svn path=/head/; revision=17162
* General -Wall warning cleanup, part I.Jordan K. Hubbard1996-07-121-2/+2
| | | | | | | Submitted-By: Kent Vander Velden <graphix@iastate.edu> Notes: svn path=/head/; revision=17141