aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/rpc
Commit message (Collapse)AuthorAgeFilesLines
* Remove references to timed(8)Ceri Davies2021-05-131-3/+1
| | | | | | | | | | | There are still references to timed(8) and timedc(8) in the base system, which were removed in 2018. PR: 255425 Reported by: Ceri Davies <ceri at submonkey dot net> Reviewed by: ygy, gbe MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30232
* libc: fix buffer overrun in getrpcport(3)Edward Tomasz Napierala2021-01-311-3/+3
| | | | | | | Reviewed By: markj Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D27332
* Fix -Wvoid-pointer-to-enum-cast warnings.Brooks Davis2020-04-151-7/+7
| | | | | | | | | | | | | | | | | This pattern is used in callbacks with void * data arguments and seems both relatively uncommon and relatively harmless. Silence the warning by casting through uintptr_t. This warning is on by default in Clang 11. Reviewed by: arichardson Obtained from: CheriBSD (partial) MFC after: 1 week Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24425 Notes: svn path=/head/; revision=359978
* Fix a use of an uninitialized pointer in xdr_rpcbs_rmtcalllist().Mark Johnston2020-02-051-80/+79
| | | | | | | | | | | | | This appears to have been introduced in r173763. Also fix the confusing indentation that probably led to the bug in the first place. PR: 243759 Diagnosed by: martin@lispworks.com MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=357576
* Increase YPMAXRECORD to 16M to be compatible with Linux.Konstantin Belousov2019-08-121-3/+11
| | | | | | | | | | | | | | | | | | | | | | | Since YP protocol definition uses the constant to declare variable-size opaque byte strings, the change should be binary compatible with existing installations which do not expose keys or values larger than 1024 bytes. All uses of local variables with YPMAXRECORD sizes were removed to avoid insane stack use. On the other hand, variables with static lifetime should be fine and only result in increased VA use. Glibc made same change, increasing the allowed length for keys and values in YP to 16M, in 2013. Reviewed by: markj Discussed with: ian Sponsored by: Mellanox Technologies MFC after: 3 weeks Differential revision: https://reviews.freebsd.org/D20900 Notes: svn path=/head/; revision=350957
* Fix CONFS to append the value in this case.Brad Davis2018-09-181-1/+1
| | | | | | | Approved by: re (blanket, pkgbase), will (mentor) Notes: svn path=/head/; revision=338744
* Move rpc and netconfig to lib/libc/rpc/Brad Davis2018-09-173-0/+88
| | | | | | | | | | | | | | This uses relative paths to make it more specific to avoid any potential future problems with .PATH and leverages CONFS. libc was picked as the destination location for these because of the syscalls that use these files as the lowest level place they are referenced. Approved by: re (gjb), will (mentor) Differential Revision: https://reviews.freebsd.org/D17163 Notes: svn path=/head/; revision=338732
* des_crypt.3: Fix typo.Eitan Adler2018-03-071-1/+1
| | | | | | | | Obtained from: DragonflyBSD (a78d083cf561cf325e8f1a151251b8901159e2ce) MFC After: 3 days Notes: svn path=/head/; revision=330572
* su_data: correct macro expansion.Pedro F. Giffuni2018-02-081-1/+1
| | | | | | | | | Protect su_data() users from strange macro expansion. Obtained from: linux libtirpc Notes: svn path=/head/; revision=329018
* libc: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-252-1/+5
| | | | | | | | | | | | | | | 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
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-2052-0/+104
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. 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. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* spdx: initial adoption of licensing ID tags.Pedro F. Giffuni2017-11-181-1/+3
| | | | | | | | | | | | | | | | | | | | 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. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Initially, only tag files that use BSD 4-Clause "Original" license. RelNotes: yes Differential Revision: https://reviews.freebsd.org/D13133 Notes: svn path=/head/; revision=325966
* Revert r300385 and r300624 which was false positiveXin LI2017-06-301-3/+1
| | | | | | | | | | | | | | | reported by cppcheck. dup_ncp() tries to allocate a buffer of MAXNETCONFIGLINE as tmp, which is then assigned to p->nc_netid via strcpy, so the free(p->nc_netid) would have correctly released the memory in case nc_lookups() fails, therefore, the allerged leak never existed. MFC after: 3 days Notes: svn path=/head/; revision=320494
* Fix use-after-free introduced in r300388.Xin LI2017-06-221-1/+2
| | | | | | | | | | | | | | | | In r300388, endnetconfig() was called on nc_handle which would release the associated netconfig structure, which means tmpnconf->nc_netid would be a use-after-free. Solve this by doing endnetconfig() in return paths instead. Reported by: jemalloc via kevlo Reviewed by: cem, ngie (earlier version) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D11288 Notes: svn path=/head/; revision=320216
* * limit size of buffers to RPC_MAXDATASIZEXin LI2017-06-013-12/+22
| | | | | | | | | | | | | | | | | | | * don't leak memory * be more picky about bad parameters From: https://raw.githubusercontent.com/guidovranken/rpcbomb/master/libtirpc_patch.txt https://github.com/guidovranken/rpcbomb/blob/master/rpcbind_patch.txt via NetBSD. Reviewed by: emaste, cem (earlier version) Differential Revision: https://reviews.freebsd.org/D10922 MFC after: 3 days Notes: svn path=/head/; revision=319369
* Support clnt_raw's use of FD_SETSIZE as a fake file descriptor.Brooks Davis2017-05-011-4/+6
| | | | | | | | | | | | | | | | | | | Accomplish this by allocating space for it in __svc_xports and allowing it to be registered. The failure to allocate space was causing an out-of-bounds read in svc_getreq_common(). The failure to register caused PR 211804. The bug was found with CHERI bounds checking. PR: 211804 Obtained from: CheriBSD Sponsored by: DARPA, AFRL Reviewed by: ngie MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D10528 Notes: svn path=/head/; revision=317660
* libc: provide some bounds-checking through reallocarray(3).Pedro F. Giffuni2017-03-121-2/+2
| | | | | | | | | | | | reallocarray(3) is a non portable extension that originated in OpenBSD. Given that it is already in FreeBSD's libc it is useful for the cases where reallocation involves a multiplication. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D9955 Notes: svn path=/head/; revision=315162
* libc/rpc: replace comma with semicolon when pertinent.Pedro F. Giffuni2016-08-091-1/+1
| | | | | | | | | | | | | Uses of commas instead of a semicolons can easily go undetected. The comma can serve as a statement separator but this shouldn't be abused when statements are meant to be standalone. Detected with devel/coccinelle following a hint from DragonFlyBSD. MFC after: 1 month Notes: svn path=/head/; revision=303889
* 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/rpc: Make use of some xdr_* macros. (part 2)Pedro F. Giffuni2016-06-093-19/+19
| | | | | | | | | xdr_rpcproc, xdr_rpcprog and xdr_rpcvers were broken in older versions of FreeBSD but fixed in r296394. Give them some use hoping they help make the code somewhat more readable. Notes: svn path=/head/; revision=301769
* libc/rpc: Make use of some xdr_* macros.Pedro F. Giffuni2016-06-092-7/+7
| | | | | | | | | xdr_rpcprog and xdr_rpcvers were broken in older versions of FreeBSD but were fixed in r296394. Give them some use hoping they help make the code somewhat more readable. Notes: svn path=/head/; revision=301754
* Fix the rpcb_getaddr() definition to match its declaration.Kevin Lo2016-06-091-1/+1
| | | | | | | Submitted by: Sebastian Huber <sebastian dot huber at embedded-brains dot de> Notes: svn path=/head/; revision=301734
* Test for strchr(3) returning NULL, not 0Enji Cooper2016-06-081-1/+1
| | | | | | | | | MFC after: 3 days Reported by: coccinelle Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=301704
* Fix up r300385Enji Cooper2016-05-241-2/+3
| | | | | | | | | | | | | | | | | I accidentally glossed over the fact that tmp is manipulated via strchr, so if we tried to free `tmp` after r300385, it would have crashed. Create a separate pointer (tmp2) to track the original allocation of `tmp`, and free `tmp2` if `p->nc_lookups` can't be malloced MFC after: 4 days X-MFC with: r300385 Reported by: Coverity CID: 1356026 Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=300624
* Remove redundant NULLing of outbuf_pmapEnji Cooper2016-05-241-1/+0
| | | | | | | | | | | | If reallocf ever failed, outbuf_pmap would already be NULL MFC after: 1 week X-MFC with: r300620 Reported by: cem Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=300621
* Use reallocf instead of malloc to fix leak with outbuf_pmapEnji Cooper2016-05-241-1/+3
| | | | | | | | | | | | | | | | | | | The previous code overwrote outbuf_pmap's memory with malloc once per loop iteration, which leaked its memory; use reallocf instead to ensure that memory is properly free'd each loop iteration. Add a outbuf_pmap = NULL in the failure case to avoid a double-free at the bottom of the function. Differential Revision: https://reviews.freebsd.org/D6495 MFC after: 1 week Reported by: Coverity CID: 1038776 Reviewed by: markj, pfgj Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=300620
* nis_rpcent: don't leak resultbuf from yp_first(..)/yp_next(..)Enji Cooper2016-05-221-0/+2
| | | | | | | | | | | | | If the buffer couldn't be adequately resized to accomodate an additional "\n", it would leak resultbuf by breaking from the loop early MFC after: 2 weeks Reported by: Coverity CID: 1016702 Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=300389
* Call endnetconfig on nc_handle sooner to avoid leaking nc_handle if tmpnconfEnji Cooper2016-05-221-1/+1
| | | | | | | | | | | | | | | was NULL This would theoretically happen if the netconfig protocol family and protocol semantics were never matched. MFC after: 2 weeks Reported by: Coverity CID: 978179 Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=300388
* getnetid(..): consistently fclose fd at the end of the functionEnji Cooper2016-05-221-11/+15
| | | | | | | | | | | This mutes a false positive with cppcheck, but also helps eliminate future potential issues with this variable MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=300387
* Don't leak `handle` if svc_tp_create(..) succeeds and allocating a newEnji Cooper2016-05-221-1/+3
| | | | | | | | | | | | struct xlist object fails MFC after: 1 week Reported by: Coverity CID: 978277 Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=300386
* Don't leak `tmp` if `p->nc_lookups` can't be mallocedEnji Cooper2016-05-221-0/+1
| | | | | | | | | MFC after: 1 week Reported by: cppcheck Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=300385
* libc: spelling fixes.Pedro F. Giffuni2016-04-307-11/+11
| | | | | | | Mostly on comments. Notes: svn path=/head/; revision=298830
* libc: do not include <sys/types.h> where <sys/param.h> was already includedAndriy Voskoboinyk2016-04-183-3/+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
* libc: cleanup unnecessary semicolons (part 2).Pedro F. Giffuni2016-04-112-2/+2
| | | | | | | Found with devel/coccinelle. Notes: svn path=/head/; revision=297829
* libc: replace 0 with NULL for pointers.Pedro F. Giffuni2016-04-104-13/+13
| | | | | | | | | | | | While here also cleanup some surrounding code; particularly drop some malloc() casts. Found with devel/coccinelle. Reviewed by: bde (previous version - all new bugs are mine) Notes: svn path=/head/; revision=297790
* Stray tabs and spaces.Pedro F. Giffuni2016-03-051-8/+8
| | | | | | | No functional change. Notes: svn path=/head/; revision=296404
* Work around aliasing issues detected in modern GCC.Pedro F. Giffuni2016-03-041-16/+20
| | | | | | | | | | Avoid casting gymnastics that lead to pointer aliasing by introducing an inline function as done in NetBSD (but without #if0'd WIP code). Obtained from: NetBSD (CVS Rev. 1.24, 1.25) Notes: svn path=/head/; revision=296386
* RPC: update the getrpcbyname() definition to include a const qualifier.Pedro F. Giffuni2016-02-262-3/+3
| | | | | | | | | | Add const qualifier making getrpcbyname() and getrpcbyname_r() prototypes match those used in latest Sun RPC code (TI-RPC 2.3). Obtained from: NetBSD Notes: svn path=/head/; revision=296133
* rpc: fix failure to clear string by passing the wrong size to memset.Pedro F. Giffuni2016-02-261-1/+1
| | | | | | | | | | Noted by NetBSD's PR/21014 Obtained from: NetBSD (CVS Rev. 1.24, 1.25) MFC after: 1 month Notes: svn path=/head/; revision=296095
* Fix a mismerge from NetBSD in r162194 with `xdr_rpcb_entry_list_ptr(..)`Enji Cooper2016-01-121-2/+2
| | | | | | | | | | | | | | This fixes the potential NULL pointer dereference properly, and also fixes memory leaks encountered in the process of iterating through `*rp`. MFC after: 1 week Found by: Valgrind Reported by: Dan Roberts <dan.roberts@isilon.com> Submitted by: Miles Ohlrich <miles.ohlrich@isilon.com> Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=293715
* Similar to r293704, fix theoretical leak of netconfig(3) resources inEnji Cooper2016-01-111-2/+2
| | | | | | | | | | | | | | __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. MFC after: 1 week Reported by: Coverity Submitted by: Miles Ohlrich <miles.ohlrich@isilon.com> Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=293705
* Fix theoretical leak of netconfig(3) resources in svcunix_create(..)Enji Cooper2016-01-111-1/+1
| | | | | | | | | | | | | | | | 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. MFC after: 1 week Reported by: Coverity Submitted by: Miles Ohlrich <miles.ohlrich@isilon.com> Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=293704
* RPC: populate local address for rendezvous transporter.Stanislav Sedov2015-12-101-2/+16
| | | | | | | | | | | | | | When accepting a connection on underlying tcp socket rpc vc transporter fails to populate local address. This change rectifies this problem by modifying rendezvous_request() to fill out the xptr structure member with appropriate information. Submitted by: Alex Burlyga <alex.burlyga.ietf@gmail.com> MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D4206 Notes: svn path=/head/; revision=292047
* Remove unnecessary `if (x)` tests before calling `free(x)`; free(3)Enji Cooper2015-11-0210-49/+25
| | | | | | | | | | already employs this check MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=290253
* Use proper function prototypes.Craig Rodrigues2015-10-072-4/+4
| | | | | | | Eliminates -Wstrict-prototypes warning Notes: svn path=/head/; revision=288995
* Use ANSI C prototypes. Eliminates -Wold-style-definition warnings.Craig Rodrigues2015-09-2235-409/+235
| | | | Notes: svn path=/head/; revision=288113
* Use ANSI C prototypes.Craig Rodrigues2015-09-201-69/+31
| | | | | | | Eliminates gcc 4.9 warnings. Notes: svn path=/head/; revision=288017
* Use unsigned variable.Craig Rodrigues2015-09-011-1/+1
| | | | | | | Eliminates gcc 4.9 compiler warning. Notes: svn path=/head/; revision=287353
* Use ANSI C prototypes.Craig Rodrigues2015-09-015-12/+12
| | | | | | | Eliminates gcc 4.9 warnings. Notes: svn path=/head/; revision=287350
* Use correct function prototype for signal handler.Craig Rodrigues2015-09-011-2/+2
| | | | | | | Eliminates gcc 4.9 warning. Notes: svn path=/head/; revision=287348