History log of /freebsd-current/lib/libc/rpc/rpcb_clnt.c
Revision Date Author Comments
# dc36d6f9 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

lib: Remove ancient SCCS tags.

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


# 559a218c 01-Nov-2023 Warner Losh <imp@FreeBSD.org>

libc: Purge unneeded cdefs.h

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


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 032b0462 13-Nov-2022 Rick Macklem <rmacklem@FreeBSD.org>

rpcb_clnt.c: Do not force use of UDP

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


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

General further adoption of SPDX licensing ID tags.

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.


# 091867a6 21-Jun-2017 Xin LI <delphij@FreeBSD.org>

Fix use-after-free introduced in r300388.

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


# 88609a6a 09-Jun-2016 Kevin Lo <kevlo@FreeBSD.org>

Fix the rpcb_getaddr() definition to match its declaration.

Submitted by: Sebastian Huber <sebastian dot huber at embedded-brains dot de>


# b70cb069 21-May-2016 Enji Cooper <ngie@FreeBSD.org>

Call endnetconfig on nc_handle sooner to avoid leaking nc_handle if tmpnconf
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


# 7f3159ed 11-Jan-2016 Enji Cooper <ngie@FreeBSD.org>

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.

MFC after: 1 week
Reported by: Coverity
Submitted by: Miles Ohlrich <miles.ohlrich@isilon.com>
Sponsored by: EMC / Isilon Storage Division


# c7f7fdd2 01-Nov-2015 Enji Cooper <ngie@FreeBSD.org>

Remove unnecessary `if (x)` tests before calling `free(x)`; free(3)
already employs this check

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Division


# 587cf682 22-Sep-2015 Craig Rodrigues <rodrigc@FreeBSD.org>

Use ANSI C prototypes. Eliminates -Wold-style-definition warnings.


# 77601543 01-Sep-2015 Craig Rodrigues <rodrigc@FreeBSD.org>

Use ANSI C prototypes.

Eliminates gcc 4.9 warnings.


# 68895e38 31-Aug-2015 Craig Rodrigues <rodrigc@FreeBSD.org>

Use ANSI C prototypes.

Eliminates gcc 4.9 warnings.


# 44443e42 25-Nov-2013 Hiroki Sato <hrs@FreeBSD.org>

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.


# 06f13fb3 27-Sep-2012 Pedro F. Giffuni <pfg@FreeBSD.org>

Complete revert of r239963:

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


# 43981b6c 31-Aug-2012 Pedro F. Giffuni <pfg@FreeBSD.org>

Bring some changes from Bull's NFSv4 libtirpc implementation.

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


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 330e445c 20-Sep-2007 Matteo Riondato <matteo@FreeBSD.org>

Fix some improper handling of malloc failures

PR: bin/83344 , kern/81987
Reviewed by: alfred
Approved by: re (kensmith)
MFC after: 1 week


# f340bd40 09-Sep-2006 Martin Blapp <mbr@FreeBSD.org>

Sync with NetBSD rev. 1.20 + 1.21

Coverity CID 2284: Fix multiple memory leaks.
Coverity CID 710: Remove unreachable code.

MFC after: 1 month


# 235baf26 27-Feb-2006 Daniel Eischen <deischen@FreeBSD.org>

Staticize a couple of functions.

Remove a few unused locks.

Remove locks from application namespace.


# a986ef57 16-Oct-2004 David E. O'Brien <obrien@FreeBSD.org>

Try to bring some sanity to the SCM ID's.
+ spell LIBC_SCCS consistently
+ enable builds with LIBC_SCCS defined to not syntax error
+ minor SCM reformatting to try to have some consistency


# b6c452a8 29-Oct-2003 Martin Blapp <mbr@FreeBSD.org>

Don't compare NULL against a character.

Obtained from: NetBSD


# 77335102 27-Jan-2003 Martin Blapp <mbr@FreeBSD.org>

Add missing __rpc_fixup_addr. This is needed to make
mount_nfs -T work for scoped addresses.

NetBSD Rev 1.11

Reviewed by: phk
Obtained from: NetBSD


# bb1ca86f 26-Jul-2002 Ian Dowse <iedowse@FreeBSD.org>

Revert part of revision 1.10, as it broke portmap lookups for IPv4
TCP clients. The problem was that a struct netconfig returned by
getnetconfigent() was being treated as a handle for __rpc_getconf(),
which certainly isn't right.

The tirpc-99 code uses __rpc_setconf("udp")/__rpc_getconf() to find
the IPv4 udp netconfig, but our implementation of these functions
seem happy to return IPv6 entries, so we can't use them. By reverting
to the old version, we are hard-coding the name of the udp4 netid.

Tracked down by: Bakul Shah <bakul@bitblocks.com>


# 4e37855e 11-Jul-2002 Alfred Perlstein <alfred@FreeBSD.org>

Add functions allowing for the user to specify a timeout for rpc functions.

Update copyrights to reflect where this code was lifted from. (tirpc '99)

Submitted by: mbr


# d3d20c82 22-Mar-2002 David E. O'Brien <obrien@FreeBSD.org>

Fix the style of the SCM ID's.
I believe have made all of libc .c's as consistent as possible.


# 1372519b 22-Mar-2002 David E. O'Brien <obrien@FreeBSD.org>

Remove multi-line __P() usage.


# c05ac53b 21-Mar-2002 David E. O'Brien <obrien@FreeBSD.org>

Remove __P() usage.


# 6112fcee 16-Feb-2002 Ian Dowse <iedowse@FreeBSD.org>

Fix two file descriptor leaks in the internal function local_rpcb()
that is used by a number of rpcbind-related library functions. Also
fix a rpc client leak in rpcb_set().

Submitted by: mbr
Obtained from: NetBSD


# e4db1131 05-Feb-2002 Alfred Perlstein <alfred@FreeBSD.org>

Do not call addrinfo on local transport adresses, if returning a
server handle (for reuse or whatever). We just return now a handle
connected to the local rpcbind.

Do not try to call checkcache, if host = NULL;

Submitted by: mbr


# e73bb7f1 02-Aug-2001 Ian Dowse <iedowse@FreeBSD.org>

In getclnthandle(), if the address is found in the cache we need
to strdup() the address string before returning it via *targaddr
because the caller will free the string.

Change the comment at the top of getclnthandle() to clarify that
the caller is responsible for freeing *targaddr.

Noticed by: sobomax


# 52353da8 14-Jul-2001 Ian Dowse <iedowse@FreeBSD.org>

Fix a memory leak in __rpcb_findaddr(), avoid compiler warnings.

Submitted by: Martin Blapp <mb@imp.ch>


# 9f5afc13 02-Apr-2001 Ian Dowse <iedowse@FreeBSD.org>

Move the #includes of reentrant.h to after the `#include "namespace.h"',
so that the underscored versions of the pthread functions get
declared. This removes around 300 lines of 'implicit declaration
of XXX' warnings from the output of a libc build with -Wall.

Reviewed by: Martin Blapp <mb@imp.ch>, alfred


# 8360efbd 18-Mar-2001 Alfred Perlstein <alfred@FreeBSD.org>

Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.

Bring in required TLI library routines to support this.

Since we don't support TLI we've essentially copied what NetBSD
has done, adding a thin layer to emulate direct the TLI calls
into BSD socket calls.

This is mostly from Sun's tirpc release that was made in 1994,
however some fixes were backported from the 1999 release (supposedly
only made available after this porting effort was underway).

The submitter has agreed to continue on and bring us up to the
1999 release.

Several key features are introduced with this update:
Client calls are thread safe. (1999 code has server side thread
safe)
Updated, a more modern interface.

Many userland updates were done to bring the code up to par with
the recent RPC API.

There is an update to the pthreads library, a function
pthread_main_np() was added to emulate a function of Sun's threads
library.

While we're at it, bring in NetBSD's lockd, it's been far too
long of a wait.

New rpcbind(8) replaces portmap(8) (supporting communication over
an authenticated Unix-domain socket, and by default only allowing
set and unset requests over that channel). It's much more secure
than the old portmapper.

Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
to support TI-RPC and to support IPV6.

Umount(8) is also fixed to unmount pathnames longer than 80 chars,
which are currently truncated by the Kernel statfs structure.

Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul