aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/rpc
Commit message (Collapse)AuthorAgeFilesLines
* rpc: Fix typo in commentAssume-Zhan2024-02-131-1/+1
| | | | | Event: Advanced UNIX Programming Course (Fall’23) at NTHU. Pull Request: https://github.com/freebsd/freebsd-src/pull/995
* lib: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-2/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* sccs: Manual changesWarner Losh2023-11-274-12/+0
| | | | | | | | | | | | | | | For the uncommon items: Go through the tree and remove sccs tags that didn't fit any nice pattern. If in the neighborhood, other SCM tags were removed when they were detritis of long-ago CVS somehow in the early mists of the project. Some adjacent copyrights stringswere removed (they duplicated the copyright notices in the file). This also removed non-standard formations of omission of SCCS tags (usually by adding an extra #if 0 somewhere. After this commit, a number of strings tagged with the 'what' @(#) prefix remain, but they are primarily copyright notices. Sponsored by: Netflix
* lib: Remove ancient SCCS tags.Warner Losh2023-11-2776-203/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* lib/libc/rpc: switch the per-fd structs in clnt_{dg,vc}.c to RB TreesAlan Somers2023-11-154-180/+162
| | | | | | | | | | | | | This saves oodles of memory, especially when "ulimit -n" is large. It also prevents a buffer overflow if getrlimit should fail. Also replace per-fd condvars with mutexes to simplify the code. PR: 274968 MFC after: 2 weeks Sponsored by: Axcient Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D42597
* libc/libc/rpc: refactor some global variablesAlan Somers2023-11-152-102/+83
| | | | | | | | | | | | | | * Combine dg_fd_locks and dg_cv into one array. * Similarly for vc_fd_locks and vc_cv * Turn some macros into inline functions This is a mostly cosmetic change to make refactoring these strutures in a future commit easier. MFC after: 2 weeks Sponsored by: Axcient Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D42597
* libc: Remove empty comments in Symbol.mapBrooks Davis2023-11-151-3/+0
| | | | | | | These were left over from $FreeBSD$ removal. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D42612
* libc: Purge unneeded cdefs.hWarner Losh2023-11-0155-56/+0
| | | | | | | | | These sys/cdefs.h are not needed. Purge them. They are mostly left-over from the $FreeBSD$ removal. A few in libc are still required for macros that cdefs.h defines. Keep those. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D42385
* libc: Fix missing or misspelled MLINKS.Dag-Erling Smørgrav2023-10-181-0/+2
| | | | Differential Revision: https://reviews.freebsd.org/D42192
* Remove $FreeBSD$: one-line bare tagWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line nroff patternWarner Losh2023-08-1623-23/+0
| | | | Remove /^\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-163-3/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-1654-109/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Remove $FreeBSD$: one-line .c comment patternWarner Losh2023-08-161-1/+0
| | | | Remove /^/[*/]\s*\$FreeBSD\$.*\n/
* Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-163-6/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-122-2/+2
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* rpcb_clnt.c: Do not force use of UDPRick Macklem2022-11-131-2/+12
| | | | | | | | | | | | | | | | | | | | | | | Without this patch, the code in the rpcbind client forces the use of UDP. A comment notes that some rpcbind servers only support UDP. This makes NFSv3 mounts to Azure servers impossible, since they require use of TCP for rpcbind. Since the comment is very old (imported from NetBSD in 2001) and I do not believe any UDP only rpcbind servers will still exist, this patch comments out the code that forces use of UDP, so that NFSv3 mounts to Azure servers can work. For an NFSv3 mount, the "udp" mount option will still make mount_nfs use UDP for rpcbind so that can be used as a workaround for any old NFSv3 server that only supports rpcbind over UDP (if any such server still exists). I asked if doing this change is appropriate on freebsd-fs@ and I only got one reply (off list) that supported doing the change. PR: 267301 MFC after: 1 month
* libc rpc: Fix mismatches in prototypes for array bounds.John Baldwin2022-09-281-1/+1
| | | | | | | | | | | | Various RPC functions used a bare pointer in function prototypes to describe fixed-length buffer arguments but used a fixed-length array in the function definition. The manual page for these functions describes the parameters as being fixed-length buffers, so update the prototypes to match the definitions. Reviewed by: imp, emaste Reported by: GCC -Warray-parameter Differential Revision: https://reviews.freebsd.org/D36757
* rpc(3): Fix two typos in source code commentsGordon Bergling2022-04-021-1/+1
| | | | | | | - s/alloctaed/allocated/ Obtained from: NetBSD MFC after: 3 days
* libc: Fix a typo in a source code commentGordon Bergling2022-03-281-1/+1
| | | | | | - s/compnent/component/ MFC after: 3 days
* libc clnt_com_create: relock rpcsoc_lock earlier when port is obtained from ↵Konstantin Belousov2022-01-091-1/+1
| | | | | | | | | | | | portmapper Otherwise on mapper failure we goto error handler which expect rpscoc_lock owned, but we do not. PR: 261051 Reported by: RyanCai <ryancaicse@gmail.com> Sponsored by: The FreeBSD Foundation MFC after: 1 week
* libc/rpc/getrpcent.c: Mark write-only variables as unusedKonstantin Belousov2021-11-291-6/+6
| | | | | Sponsored by: The FreeBSD Foundation MFC after: 1 week
* rpc(3): Correct a few common typos in source code commentsGordon Bergling2021-08-222-4/+4
| | | | | | | | - s/therfore/therefor/ - s/activte/active/ Obtained from: NetBSD MFC after: 3 days
* 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