Commit graph

108 commits

Author SHA1 Message Date
Warner Losh 5b31cc94b1 sccs: Manual changes
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
2023-11-26 22:23:58 -07:00
Warner Losh 5a1d14419a include: 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
2023-11-26 22:23:28 -07:00
Alan Somers 24938f9311 lib/libc/rpc: switch the per-fd structs in clnt_{dg,vc}.c to RB Trees
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
2023-11-15 16:12:50 -07:00
John Baldwin f53355131f Trim various $FreeBSD$
Approved by:	markj (cddl/contrib changes)
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D41961
2023-10-10 10:34:43 -07:00
Warner Losh d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Warner Losh 2a63c3be15 Remove $FreeBSD$: one-line .c comment pattern
Remove /^/[*/]\s*\$FreeBSD\$.*\n/
2023-08-16 11:54:29 -06:00
Warner Losh 42b388439b Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
2023-08-16 11:54:23 -06:00
Warner Losh b3e7694832 Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-08-16 11:54:16 -06:00
Warner Losh 4d846d260e spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
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
2023-05-12 10:44:03 -06:00
Elyes Haouas ce7db385f5 include: Fix typos
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
2023-02-22 11:52:57 -05:00
John Baldwin a2e41a585b libc rpc: Fix mismatches in prototypes for array bounds.
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
2022-09-28 14:01:36 -07:00
Dmitry Ovsyannikov 9f48eea366 rpcbind: get contact addr from xprt members
Addition to D31491 in order to actually resolve the top root cause.

Currently rpcbind gets contact address from connectionless xprt->xp_p2
member of a transport and will fail to get it when working over
connection oriented transport, leading to a guess game in terms of
contact address on rpcinfo requests like RPCBPROC_GETVERSADDR or
RPCBPROC_GETADDRLIST and poor returns which may influence a user
of a call and specifically reported on OSX clients, which tend to
not provide address hint from rpcinfo request to a server.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D35220
2022-06-13 08:54:08 -05:00
Pedro F. Giffuni e58eb3c437 include: General further adoption of SPDX licensing ID tags.
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.
2017-11-25 17:09:43 +00:00
Pedro F. Giffuni 2321c47418 include: 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.
2017-11-20 19:45:28 +00:00
Pedro F. Giffuni d1bd689d10 xdr: Fix xdr_rpc* defines.
The defines for xdr_rpc* in xdr.h are wrong. It could be
very well that Solaris did strip the '_t' from xdr_u_int32_t,
but Solaris has a xdr_u_int32 function, we don't have this.
So all of this defines will lead to an unresolved symbol.

This explains why we do not use these functions in FreeBSD
while they are used in Illumos/Solaris.

Obtained from:	linux libtirpc (git 7864122e61ffe4db1aa8ace89117358a1e3a391b)
MFC after:	3 weeks
2016-03-04 22:03:38 +00:00
Pedro F. Giffuni ceb5a304ca Add sunrpc compat define for xp_sock.
SunRPC is using xp_sock in SVCXPRT, while TI-RPC is using
xp_fd. Add a compatibility define.

Illumos has something similar for the non-kernel case.

Obtained from: linux-nfs project (git 0d94036c3a0d4c24d22bf6a8c40ac6625d972c29)
2016-03-03 14:44:30 +00:00
Pedro F. Giffuni 283970e873 RPC: update the getrpcbyname() definition to include a const qualifier.
Add const qualifier making getrpcbyname() and getrpcbyname_r()
prototypes match those used in latest Sun RPC code (TI-RPC 2.3).

Obtained from:	NetBSD
2016-02-26 23:25:21 +00:00
Simon J. Gerraty ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty 44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty 3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Hiroki Sato 44443e425f 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.
2013-11-25 19:08:38 +00:00
Hiroki Sato 2e322d3796 Replace Sun RPC license in TI-RPC library with a 3-clause BSD license,
with the explicit permission of Sun Microsystems in 2009.
2013-11-25 19:04:36 +00:00
Simon J. Gerraty f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
Simon J. Gerraty 23090366f7 Sync from head 2012-11-04 02:52:03 +00:00
Pedro F. Giffuni 0d1040e5e1 rpc: convert all uid and gid variables to u_int.
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
2012-10-04 04:15:18 +00:00
Pedro F. Giffuni f3c3ef7b2a RPC: Convert all uid and gid variables of the type uid_t and gid_t.
This matches what upstream (OpenSolaris) does.

Tested by:	David Wolfskill
Obtained from:	Bull GNU/Linux NFSv4 project (libtirpc)
MFC after:	3 days
2012-10-02 19:00:56 +00:00
Pedro F. Giffuni 827396ba31 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
2012-09-27 20:06:37 +00:00
Pedro F. Giffuni 46f442e58a Revert r240060: (Partial)
__BEGIN_DECLS and __END_DECLS in cdefs.h take care of the
__cplusplus mangling issues so most of the definitions
were redundant.

In the few places where they were not redundant we should
use BSD style instead of the guards used upstream.

Reported by:	Yuri Pankov
2012-09-02 22:23:23 +00:00
Pedro F. Giffuni 370c6ad8ce Fix RPC headers for C++
C++ mangling will cause trouble with variables like __rpc_xdr
in xdr.h so rename this to XDR.
While here add proper C++ guards to RPC headers.

PR:		137443
MFC after:	2 weeks
2012-09-02 21:04:40 +00:00
Pedro F. Giffuni 43981b6c53 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
2012-09-01 02:56:17 +00:00
Marcel Moolenaar 7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Tijl Coosemans 265f940acc Change some headers such that lang/gcc* ports no longer patch them.
The lang/gcc* ports patch headers where they think something is
non-standard. These patched headers override the system headers which means
you have to rebuild these ports whenever you do installworld to make sure
they contain the latest changes.
2012-02-14 12:50:20 +00:00
Dimitry Andric 5e0a19bdee Consistently set RPCGEN_CPP when running rpcgen, so the C preprocessor
set via ${CPP} is used, instead of always using hardcoded /usr/bin/cpp.

MFC after:	1 week
2012-02-07 09:27:07 +00:00
Ulrich Spörlein 2f98c0ba01 Spelling fixes for include/ 2012-01-07 16:10:15 +00:00
Kevin Lo d0b2bb9e86 Revert the previous change and add xdr_sizeof
Requested by:	bde
2011-07-10 14:03:13 +00:00
Kevin Lo d98b6d6edd - Add xdr_sizeof(3) to libc
- Document xdr_sizeof(3); from NetBSD

Discussed with:	kib
2011-07-09 07:43:56 +00:00
Alexander Kabaev e7733ffa39 Re-do r192913 in less intrusive way. Only do IP_RECVDSTADDR/IP_SENDSRCADDR
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
2009-06-18 17:10:43 +00:00
Doug Rabson a9148abd9d Implement support for RPCSEC_GSS authentication to both the NFS client
and server. This replaces the RPC implementation of the NFS client and
server with the newer RPC implementation originally developed
(actually ported from the userland sunrpc code) to support the NFS
Lock Manager.  I have tested this code extensively and I believe it is
stable and that performance is at least equal to the legacy RPC
implementation.

The NFS code currently contains support for both the new RPC
implementation and the older legacy implementation inherited from the
original NFS codebase. The default is to use the new implementation -
add the NFS_LEGACYRPC option to fall back to the old code. When I
merge this support back to RELENG_7, I will probably change this so
that users have to 'opt in' to get the new code.

To use RPCSEC_GSS on either client or server, you must build a kernel
which includes the KGSSAPI option and the crypto device. On the
userland side, you must build at least a new libc, mountd, mount_nfs
and gssd. You must install new versions of /etc/rc.d/gssd and
/etc/rc.d/nfsd and add 'gssd_enable=YES' to /etc/rc.conf.

As long as gssd is running, you should be able to mount an NFS
filesystem from a server that requires RPCSEC_GSS authentication. The
mount itself can happen without any kerberos credentials but all
access to the filesystem will be denied unless the accessing user has
a valid ticket file in the standard place (/tmp/krb5cc_<uid>). There
is currently no support for situations where the ticket file is in a
different place, such as when the user logged in via SSH and has
delegated credentials from that login. This restriction is also
present in Solaris and Linux. In theory, we could improve this in
future, possibly using Brooks Davis' implementation of variant
symlinks.

Supporting RPCSEC_GSS on a server is nearly as simple. You must create
service creds for the server in the form 'nfs/<fqdn>@<REALM>' and
install them in /etc/krb5.keytab. The standard heimdal utility ktutil
makes this fairly easy. After the service creds have been created, you
can add a '-sec=krb5' option to /etc/exports and restart both mountd
and nfsd.

The only other difference an administrator should notice is that nfsd
doesn't fork to create service threads any more. In normal operation,
there will be two nfsd processes, one in userland waiting for TCP
connections and one in the kernel handling requests. The latter
process will create as many kthreads as required - these should be
visible via 'top -H'. The code has some support for varying the number
of service threads according to load but initially at least, nfsd uses
a fixed number of threads according to the value supplied to its '-n'
option.

Sponsored by:	Isilon Systems
MFC after:	1 month
2008-11-03 10:38:00 +00:00
Doug Rabson 4efa8f3e07 Initialise the SVCAUTH field for new transport structures when they are
allocated instead of waiting for the first request. This fixes an issue with
rpcbind's support for PMAPPROC_CALLIT.

Reviewed by:	markm
2008-09-09 14:15:55 +00:00
Doug Rabson 8f55a568f6 Add an implementation of the RPCSEC_GSS authentication protocol for RPC. This
is based on an old implementation from the University of Michigan with lots of
changes and fixes by me and the addition of a Solaris-compatible API.

Sponsored by:	Isilon Systems
Reviewed by:	alfred
2008-08-06 14:02:05 +00:00
Pawel Jakub Dawidek 7f64b05f79 Move rpc/types.h under sys/, as this is used by ZFS kernel module.
Repo-copied by:	simon
2007-04-10 22:10:16 +00:00
Jens Schweikhardt 8011e03458 Comment the token after #endif, like we do everywhere else.
Static analyzers like FlexeLint complain about it.

MFC after:	7 days
2007-02-02 18:11:18 +00:00
Hajimu UMEMOTO 0e3a96aae0 English grammar fix in comment.
Submitted by:	keramida
2006-04-29 04:26:16 +00:00
Hajimu UMEMOTO 06a99fe36f - Extend the nsswitch to support Services, Protocols and Rpc
databases.
- Make nsswitch support caching.

Submitted by:	Michael Bushkov <bushman__at__rsu.ru>
Sponsored by:	Google Summer of Code 2005
2006-04-28 12:03:38 +00:00
Daniel Eischen 0411773be7 Const'ify arguments to a couple of functions to fix breakage
with -O2.
2006-02-28 16:02:26 +00:00
Marcel Moolenaar 12eb46c8bb Change the definition of NULL on ia64 (for LP64 compilations) from
an int constant to a long constant. This change improves consistency
in the following two ways:
1. The first 8 arguments are always passed in registers on ia64, which
   by virtue of the generated code implicitly widens ints to longs and
   allows the use of an 32-bit integral type for 64-bit arguments.
   Subsequent arguments are passed onto the memory stack, which does
   not exhibit the same behaviour and consequently do not allow this.
   In practice this means that variadic functions taking pointers
   and given NULL (without cast) work as long as the NULL is passed
   in one of the first 8 arguments. A SIGSEGV is more likely the
   result if such would be done for stack-based arguments. This is
   due to the fact that the upper 4 bytes remain undefined.
2. All 64-bit platforms that FreeBSD supports, with the obvious
   exception of ia64, allow 32-bit integral types (specifically NULL)
   when 64-bit pointers are expected in variadic functions by way of
   how the compiler generates code. As such, code that works correctly
   (whether rightfully so or not) on any platform other than ia64, may
   fail on ia64.

To more easily allow tweaking of the definition of NULL, this commit
removes the 12 definitions in the various headers and puts it in a
new header that can be included whenever NULL is to be made visible.

This commit fixes GNOME, emacs, xemacs and a whole bunch of ports
that I don't particularly care about at this time...
2003-12-07 21:10:06 +00:00
Martin Blapp ce9bc43cb3 Replace the old SCM_CREDS cred procedures. They can now be
replaced just fine with getpeereid() and the whole code
gets a lot simpler. We don't break the ABI, since all server
programms use __rpc_get_local_uid(), and we just change library
internals.

Reviewed by:	des
2003-06-15 10:32:01 +00:00
Jacques Vidrine d7f15c948f Clean up some signed/unsigned issues in the XDR code.
Obtained from:	OpenBSD
2003-03-07 13:19:40 +00:00
Max Khon 3fe5b5db73 unifdef -D_THREAD_SAFE 2003-01-24 01:47:55 +00:00
Martin Blapp 08497c026c Implement non-blocking tcp-connections.
Reviewed by:	rwatson
Obtained from:	NetBSD
MFC after:	1 day
2003-01-16 07:13:51 +00:00