summaryrefslogtreecommitdiffstats
path: root/lib/libc/rpc
Commit message (Collapse)AuthorAgeFilesLines
* MFC r293715:ngie2016-01-191-2/+2
| | | | | | | | | | Fix a mismerge from NetBSD in r162194 with `xdr_rpcb_entry_list_ptr(..)` This fixes the potential NULL pointer dereference properly, and also fixes memory leaks encountered in the process of iterating through `*rp`. Found by: Valgrind Submitted by: Miles Ohlrich <miles.ohlrich@isilon.com>
* MFC r293705:ngie2016-01-181-2/+2
| | | | | | | | | Similar to r293704, fix theoretical leak of netconfig(3) resources in __rpcbind_is_up(..) if getnetconfig(3) is partly successful in allocating resources, but not completely successful by moving the endnetconfig(3) call up before we return from the function if nconf == NULL. Submitted by: Miles Ohlrich <miles.ohlrich@isilon.com>
* MFC r293704:ngie2016-01-181-1/+1
| | | | | | | | | | | | Fix theoretical leak of netconfig(3) resources in svcunix_create(..) In the event that the getconfig(3) call in svcunix_create is partly successful, some of the netconfig(3) resources allocated might be leaked if the call returns NULL as endnetconfig(3) wasn't called explicitly in that case. Ensure that the resources are fully cleaned up by going to the `done` label, which will call endnetconfig(3) for us. Submitted by: Miles Ohlrich <miles.ohlrich@isilon.com>
* MFC r292047: RPC: populate local address for rendezvous transporter.stas2016-01-081-2/+16
|
* MFC r278932:ngie2015-12-012-4/+1
| | | | | | | | | | | r278932 (by pfg): libc: clean some set-but-not-used errors. These were found by gcc 5.0 on Dragonfly BSD, however I made no attempt to silence the false positives. Obtained from: DragonFly (cf515c3a6f3a8964ad592e524442bc628f8ed63b)
* MFC r290253:ngie2015-11-1610-49/+25
| | | | | | | Remove unnecessary `if (x)` tests before calling `free(x)`; free(3) already employs this check Sponsored by: EMC / Isilon Storage Division
* MFC r258580:hrs2014-10-091-335/+0
| | | | | | | | | | | | | | | | | | | | | Replace Sun RPC license in TI-RPC library with a 3-clause BSD license, with the explicit permission of Sun Microsystems in 2009. MFC r258581, 258582: Replace Sun Industry Standards Source License for Sun RPC code with a 3-clause BSD license as specified by Oracle America, Inc. in 2010. This license change was approved by Wim Coekaerts, Senior Vice President, Linux and Virtualization at Oracle Corporation. MFC r259117, 259118: Replace Sun RPC license with a 3-clause BSD license. This license change was approved in 2010 by Wim Coekaerts, Senior Vice President, Linux and Virtualization at Oracle Corporation. MFC r259417: Replace Sun RPC license for TI-RPC library with a 3-clause BSD license, with the explicit permission of Sun Microsystems in 2009. The code in question in this file was copied from lib/libc/rpc/pmap_getport.c.
* MFC: r265238, r265240brueffer2014-05-161-8/+6
| | | | | | | Properly free resources in case of error. CID: 1007032 Found with: Coverity Prevent(tm)
* MFC r258578, r258580, r258581 (by hrs):mav2014-01-2253-1422/+1353
| | | | | Replace Sun RPC license in TI-RPC library with a 3-clause BSD license with the explicit permissions.
* Assign the len field of the netbuf structure to the current length ofkevlo2013-03-011-1/+1
| | | | | | a sockaddr. Obtained from: NetBSD
* rpc: convert all uid and gid variables to u_int.pfg2012-10-044-7/+8
| | | | | | | | | | | After further discussion, instead of pretending to use uid_t and gid_t as upstream Solaris and linux try to, we are better using u_int, which is in fact what the code can handle and best approaches the range of values used by uid and gid. Discussed with: bde Reviewed by: bde
* rpc: convert all uid and gid variables of the type uid_t and gid_t.pfg2012-10-031-3/+3
| | | | | | | | | | The previous change (based on Solaris) doesn't work properly either as the casting only has the effect of quieting the compiler. Move back to the previous solution but adjust the sizeof() type in xdr_array(). This should mostly work (by accident). Reported by: bde
* rpc: convert all uid and gid variables of the type uid_t and gid_t.pfg2012-10-031-5/+5
| | | | | | | | | | | | | | As part of the previous commit, uses of xdr_int() were replaced with xdr_u_int(). This has undesired effects as the second argument doesn't match exactly uid_t or gid_t. It also breaks assumptions in the size of the provided types. To work around those issues we revert back to the use of xdr_int() but provide proper casting so the behaviour doesn't change. While here fix a style issue in the affected lines. Reported by: bde
* libtirpc: be sure to free cl_netid and cl_tppfg2012-10-021-0/+4
| | | | | | | | | | | | | When creating a client with clnt_tli_create, it uses strdup to copy strings for these fields if nconf is passed in. clnt_dg_destroy frees these strings already. Make sure clnt_vc_destroy frees them in the same way. This change matches the reference (OpenSolaris) implementation. Tested by: David Wolfskill Obtained from: Bull GNU/Linux NFSv4 Project (libtirpc) MFC after: 2 weeks
* Fix __rpc_getconfippfg2012-10-021-2/+4
| | | | | | | | | | | | | | __rpc_getconfip is supposed to return the first netconf entry supporting tcp or udp, respectively. The code will currently return the *last* entry, plus it will leak memory when there is more than one such entry. This change matches the reference (OpenSolaris) implementation. Tested by: David Wolfskill Obtained from: Bull GNU/linux NFSv4 Project (libtirpc) MFC after: 1 week
* RPC: Convert all uid and gid variables of the type uid_t and gid_t.pfg2012-10-024-11/+9
| | | | | | | | This matches what upstream (OpenSolaris) does. Tested by: David Wolfskill Obtained from: Bull GNU/Linux NFSv4 project (libtirpc) MFC after: 3 days
* Complete revert of r239963:pfg2012-09-278-41/+19
| | | | | | | | | | | | | | | The attempt to merge changes from the linux libtirpc caused rpc.lockd to exit after startup under unclear conditions. After many hours of selective experiments and inconsistent results the conclusion is that it's better to just revert everything and restart in a future time with a much smaller subset of the changes. ____ MFC after: 3 days Reported by: David Wolfskill Tested by: David Wolfskill
* Partial revert of r239963:pfg2012-09-241-4/+0
| | | | | | | | | | | | | | | | | The following change caused rpc.lockd to exit after startup: ____ libtirpc: be sure to free cl_netid and cl_tp When creating a client with clnt_tli_create, it uses strdup to copy strings for these fields if nconf is passed in. clnt_dg_destroy frees these strings already. Make sure clnt_vc_destroy frees them in the same way. ____ MFC after: 3 days Reported by: David Wolfskill Tested by: David Wolfskill
* Rework all non-contributed files that use `struct timezone'.ed2012-09-012-2/+2
| | | | | | | | | | | | | | This structure is not part of POSIX. According to POSIX, gettimeofday() has the following prototype: int gettimeofday(struct timeval *restrict tp, void *restrict tzp); Also, POSIX states that gettimeofday() shall return 0 (as long as tzp is not used). Remove dead error handling code. Also use NULL for a nul-pointer instead of integer 0. While there, change all pieces of code that only use tv_sec to use time(3), as this provides less overhead.
* Bring some changes from Bull's NFSv4 libtirpc implementation.pfg2012-09-019-19/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We especifically ignored the glibc compatibility changes but this should help interaction with Solaris and Linux. ____ Fixed infinite loop in svc_run() author Steve Dickson Tue, 10 Jun 2008 12:35:52 -0500 (13:35 -0400) Fixed infinite loop in svc_run() ____ __rpc_taddr2uaddr_af() assumes the netbuf to always have a non-zero data. This is a bad assumption and can lead to a seg-fault. This patch adds a check for zero length and returns NULL when found. author Steve Dickson Mon, 27 Oct 2008 11:46:54 -0500 (12:46 -0400) ____ Changed clnt_spcreateerror() to return clearer and more concise error messages. author Steve Dickson Thu, 20 Nov 2008 08:55:31 -0500 (08:55 -0500) ____ Converted all uid and gid variables of the type uid_t and gid_t. author Steve Dickson Wed, 28 Jan 2009 12:44:46 -0500 (12:44 -0500) ____ libtirpc: set r_netid and r_owner in __rpcb_findaddr_timed These fields in the rpcbind GETADDR call are being passed uninitialized to CLNT_CALL. In the case of x86_64 at least, this usually leads to a segfault. On x86, it sometimes causes segfaults and other times causes garbage to be sent on the wire. rpcbind generally ignores the r_owner field for calls that come in over the wire, so it really doesn't matter what we send in that slot. We just need to send something. The reference implementation from Sun seems to send a blank string. Have ours follow suit. author Jeff Layton Fri, 13 Mar 2009 11:44:16 -0500 (12:44 -0400) ____ libtirpc: be sure to free cl_netid and cl_tp When creating a client with clnt_tli_create, it uses strdup to copy strings for these fields if nconf is passed in. clnt_dg_destroy frees these strings already. Make sure clnt_vc_destroy frees them in the same way. author Jeff Layton Fri, 13 Mar 2009 11:47:36 -0500 (12:47 -0400) Obtained from: Bull GNU/Linux NFSv4 Project MFC after: 3 weeks
* Jump to the failed label instead of doing cleanup ourselves.brueffer2012-07-151-2/+1
| | | | | Obtained from: DragonFly BSD MFC after: 2 weeks
* General mdoc(7) and typo fixes.gjb2012-05-111-2/+2
| | | | | | PR: 167734 Submitted by: Nobuyuki Koganemaru (kogane!jp.freebsd.org) MFC after: 3 days
* Plug a leak.kib2012-05-081-2/+5
| | | | | Submitted by: Greg Bednarek <gbednarek averesystems com> MFC after: 1 week
* Fix several memory and lock leaks on the out of memory condition.kib2012-04-282-2/+22
| | | | | Reported by: Matt Miller <matt matthewjmiller net> MFC after: 1 week
* Remove unnecessary Xo/Xc.joel2012-03-291-10/+5
| | | | Reviewed by: brueffer
* Minor mdoc nit.joel2012-03-271-1/+1
|
* Globally replace u_int*_t from (non-contributed) man pages.ed2012-02-122-10/+10
| | | | | | | | | | | The reasoning behind this, is that if we are consistent in our documentation about the uint*_t stuff, people will be less tempted to write new code that uses the non-standard types. I am not going to bump the man page dates, as these changes can be considered style nits. The meaning of the man pages is unaffected. MFC after: 1 month
* Consistently set RPCGEN_CPP when running rpcgen, so the C preprocessordim2012-02-071-1/+1
| | | | | | set via ${CPP} is used, instead of always using hardcoded /usr/bin/cpp. MFC after: 1 week
* In lib/libc/rpc/crypt_client.c, fix a clang warning about an implicitdim2011-12-151-2/+2
| | | | | | | | | conversion between enum desdir/desmode from include/rpc/des.h, and enum desdir/desmode from include/rpcsvc/crypt.x. These are actually different enums, with different value names, but by accident the integer representation of the enum values happened to be the same. MFC after: 1 week
* Fix a bug in the userland rpc library, where it would use armacklem2011-04-101-1/+2
| | | | | | | | | | | | negative return value from write to update its position in a buffer. The patch, courtesy of Andrey Simonenko, also simplifies a conditional by removing the "i != cnt" clause, since it is always true at this point in the code. The bug caused problems for mountd, when it generated a large reply to an exports RPC request. Submitted by: simon at comsys.ntu-kpi.kiev.ua MFC after: 2 weeks
* Revert most of r210764, now that mdocml does the rightuqs2010-12-281-1/+1
| | | | | | thing with empty quotation macros. Requested by: Alex Kozlov
* Move most of the remaining USD/PSD/SMM papers into share/docuqs2010-12-047-9696/+0
|
* mdoc: make sure to pass at least one argument to quotation macrosuqs2010-08-021-1/+1
|
* Fix a bug in the previous change: remove function-local definition ofjhb2010-03-111-1/+0
| | | | | | | tcp_key and udp_key that shadows the global definition. PR: threads/144558 Submitted by: Sam Robb
* Use thr_once() with once_t controls to initialize various thread_key_tjhb2010-03-108-64/+81
| | | | | | | | | | | | objects used to provide per-thread storage in the RPC code. Almost all of these used double-checking with a dedicated mutex (tsd_lock) to do this before. However, that is not always safe with more relaxed memory orders. There were also other bugs, such as one in __rpc_createrr() that caused a new key to be allocated each time __rpc_createrr() was invoked. PR: threads/144558 Reported by: Sam Robb samrobb of averesystems com (key leak) MFC after: 1 week
* Use the correct types to store uids and gids in the credential cache.brooks2010-01-091-4/+4
|
* Fix a double free().brueffer2010-01-051-1/+1
| | | | | | PR: 142339 Submitted by: Henning Petersen <henning.petersen@t-online.de> MFC after: 2 weeks
* The fd_mask type is an unsigned long, not an int, so treat the mask as ajhb2009-12-031-2/+2
| | | | | | | | | | long instead of an int when examining the results of select() to look for RPC requests. Previously this routine would ignore RPC requests to sockets whose file descriptor mod 64 was greater than 31 on a 64-bit platform. PR: amd64/141130 Submitted by: liujb of array networks MFC after: 3 days
* Style: use structure assignment rather than memcpy() to copy awollman2009-11-251-1/+1
| | | | structure.
* In clnt_raw_create(), avoid minor race condition initializing thewollman2009-11-251-4/+7
| | | | | | | file-scope variable clntraw_private. Found by: Clang static analyzer MFC after: 7 days
* In svc_raw_reply(), don't leave stat uninitialized if the MSG_ACCEPTEDwollman2009-11-251-3/+2
| | | | | | | && SUCCESS case succeeds. The stack garbage might be zero. Found by: Clang static analyzer MFC after: 7 days
* Eliminate more dead stores.wollman2009-11-252-3/+3
| | | | | Found by: Clang static analyzer MFC after: 7 days
* Lock around access to nc_file and netconfig_info ("ni"). The RPCdelphij2009-06-241-3/+49
| | | | | | | | | part of libc is still not thread safe but this would at least reduce the problems we have. PR: threads/118544 Submitted by: Changming Sun <snnn119 gmail com> MFC after: 2 weeks
* Rework the credential code to support larger values of NGROUPS andbrooks2009-06-192-10/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NGROUPS_MAX, eliminate ABI dependencies on them, and raise the to 1024 and 1023 respectively. (Previously they were equal, but under a close reading of POSIX, NGROUPS_MAX was defined to be too large by 1 since it is the number of supplemental groups, not total number of groups.) The bulk of the change consists of converting the struct ucred member cr_groups from a static array to a pointer. Do the equivalent in kinfo_proc. Introduce new interfaces crcopysafe() and crsetgroups() for duplicating a process credential before modifying it and for setting group lists respectively. Both interfaces take care for the details of allocating groups array. crsetgroups() takes care of truncating the group list to the current maximum (NGROUPS) if necessary. In the future, crsetgroups() may be responsible for insuring invariants such as sorting the supplemental groups to allow groupmember() to be implemented as a binary search. Because we can not change struct xucred without breaking application ABIs, we leave it alone and introduce a new XU_NGROUPS value which is always 16 and is to be used or NGRPS as appropriate for things such as NFS which need to use no more than 16 groups. When feasible, truncate the group list rather than generating an error. Minor changes: - Reduce the number of hand rolled versions of groupmember(). - Do not assign to both cr_gid and cr_groups[0]. - Modify ipfw to cache ucreds instead of part of their contents since they are immutable once referenced by more than one entity. Submitted by: Isilon Systems (initial implementation) X-MFC after: never PR: bin/113398 kern/133867
* In preparation for raising NGROUPS and NGROUPS_MAX, change basebrooks2009-06-191-6/+12
| | | | | | | | | | | | | | | | | | | | | | system callers of getgroups(), getgrouplist(), and setgroups() to allocate buffers dynamically. Specifically, allocate a buffer of size sysconf(_SC_NGROUPS_MAX)+1 (+2 in a few cases to allow for overflow). This (or similar gymnastics) is required for the code to actually follow the POSIX.1-2008 specification where {NGROUPS_MAX} may differ at runtime and where getgroups may return {NGROUPS_MAX}+1 results on systems like FreeBSD which include the primary group. In id(1), don't pointlessly add the primary group to the list of all groups, it is always the first result from getgroups(). In principle the old code was more portable, but this was only done in one of the two places where getgroups() was called to the overall effect was pointless. Document the actual POSIX requirements in the getgroups(2) and setgroups(2) manpages. We do not yet support a dynamic NGROUPS, but we may in the future. MFC after: 2 weeks
* Re-do r192913 in less intrusive way. Only do IP_RECVDSTADDR/IP_SENDSRCADDRkan2009-06-182-21/+36
| | | | | | | | | | | | | dace for UPDv4 sockets bound to INADDR_ANY. Move the code to set IP_RECVDSTADDR/IP_SENDSRCADDR into svc_dg.c, so that both TLI and non-TLI users will be using it. Back out my previous commit to mountd. Turns out the problem was affecting more than one binary so it needs to me addressed in generic rpc code in libc in order to fix them all. Reported by: lstewart Tested by: lstewart
* Do not attempt to set source address on outgoing messageskan2009-06-081-2/+2
| | | | on UDP socket if we do not have a valid IP address.
* Match type for socket option (in practice, unnecessary, but stylistically ↵zml2009-05-281-1/+1
| | | | | | | it's a little nicer). Suggested by: jilles Approved by: dfr (mentor)
* Handle UDP RPC replies correctly on a multi-homed system, in userland RPC. ↵zml2009-05-272-6/+107
| | | | | | Corrects an issue with mountd replies to OS X. Approved by: dfr (mentor)
* Include a space between "send" and "broadcast".emaste2009-04-091-1/+1
|
OpenPOWER on IntegriCloud