Commit Graph

33 Commits

Author SHA1 Message Date
Xin LI
3e09403f77 Plug a possible memory leak.
MFC after:	2 weeks
2018-03-19 05:49:26 +00:00
Conrad Meyer
35f85edc80 rpcbind: Fix race in signal termination
If a signal was delivered while the main thread was not in poll(2) and after
check was performed, we could reenter poll and never detect termination. Fix
this with the pipefd trick.  (This race was introduced very recently, in
r327482.)

PR:		224503
Reported by:	kib
Reviewed by:	kib, markj
Sponsored by:	Dell EMC Isilon
2018-01-02 17:25:13 +00:00
Conrad Meyer
055569f608 rpcbind: Do not use signal-unsafe functions in SIGTERM handler
syslog(3), routines used in write_warmstart(), and exit(3) are all
signal-unsafe.  Instead, set a signal-safe flag and check the flag in the
rpcbind main loop to shutdown safely.

PR:		224503
Reviewed by:	kib, markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D13728
2018-01-02 00:48:19 +00:00
Xin LI
c3fc0d96f3 Remove unused includes. 2018-01-01 09:41:18 +00:00
Pedro F. Giffuni
8a16b7a18f 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.
2017-11-20 19:49:47 +00:00
Enji Cooper
fadafdfa69 Print out the signal number on exit in terminate(..) if WARMSTART is compiled
into rpcbind.

The signal number can provide helpful diagnostic info.

MFC after:	1 week
Obtained from:	Isilon OneFS
Sponsored by:	Dell EMC Isilon
2017-04-19 17:51:32 +00:00
Enji Cooper
4eb767eab0 Staticize variables only used in rpcbind.c
This is some low hanging fruit necessary for making this WARNS?= 6 clean

MFC after: 3 days
Sponsored by: EMC / Isilon Storage Division
2016-05-29 07:01:12 +00:00
Alexander Motin
ea9ed3d85b Disable libwrap (TCP wrappers) support in rpcbind by default, introducing
new command line options -W, to enable it when needed.

On my tests this change by almost ten times improves rpcbind performance.

No objections:	many, net@
2014-03-06 17:33:27 +00:00
Hiroki Sato
a7c51fa1a0 Replace Sun RPC license with a 3-clause BSD license, with the explicit
permission of Sun Microsystems in 2009.
2013-11-25 16:44:02 +00:00
Kevin Lo
a5752d55e0 Fix socket calls on error post-r243965.
Submitted by:	Garrett Cooper
2012-12-21 15:54:13 +00:00
Ulrich Spörlein
3df5ecac8c Spelling fixes for usr.sbin/ 2011-12-30 10:58:14 +00:00
Xin LI
07de1c52db Use prototype. While I'm there, add a pair of parenthesis to mark an if
statment's border.

MFC after:	1 month
2011-07-14 07:28:49 +00:00
Warner Losh
923dd9a7a7 When you have multiple addresses on the same network on different
interfaces (such as when you are part of a carp pool), and you run
rpcbind -h to restrict which interfaces have rpc services, rpcbind can
none-the-less return addresses that aren't in the -h list.  This patch
enforces the rule that when you specify -h on the command line, then
services returned from rpcbind must be to one of the addresses listed
in -h, or be a loopback address (since localhost is implicit when
running -h).

The root cause of this is the assumption in addrmerge that there can
be only one interface that matches a given network IP address.  This
turns out not to be the case.  To retain historical behavior, I didn't
try to fix the routine to prefer the address that the request came
into, since I didn't know the side effects that might cause in the
normal case.  My quick analysis suggests that it wouldn't be a
problem, but since this code is tricky I opted for the more
conservative patch of only restricting the reply when -h is in effect.

Hence, this change will have no effect when you are running rpcbind
without -h.

Reviewed by:	alfred@
Sponsored by:	iX Systems
MFC after:	2 weeks
2010-02-09 18:10:56 +00:00
Yaroslav Tykhiy
870db2da6d No network addresses in the system isn't a good excuse
for rpcbind(8) to crash.

The crash was due to a boolean variable initialized
improperly.  Besides fixing the initialization, pick
a better name for the variable so that its meaning is
clear and no more coding errors appear around it.
2008-02-14 20:12:23 +00:00
Kevin Lo
784bddbc5b Cleanup of userland __P use 2007-11-07 10:53:41 +00:00
Matteo Riondato
8a06ee9ea0 Avoid leaking file descriptors 2007-10-23 07:35:17 +00:00
Matteo Riondato
e2f7e255c4 Remove a comment I forgot to remove 2007-06-09 09:20:22 +00:00
Matteo Riondato
48e5a99e7f Correctly inizialize local/unix transport. I broke it in rev.1.15.
PR:	 bin/1122566
MFC after:	1 week
2007-05-01 14:47:35 +00:00
Matteo Riondato
55987d865b 1)Make it possible for rpcbind(8) to bind TCP listening socket to an IP
other than INADDR_ANY.

2) Add the -6 option to specify "IPv6 only".

Glanced at by: bms
Requested by: bms [2]
PR: bin/84494 [1]
Approved by:	silence from maintainer (~2 weeks) [1]
MFC after:	2 weeks
2007-04-23 07:09:25 +00:00
Dima Dorfman
cb4c0b80e8 Make the usage message match reality about -h and -w. 2004-11-07 04:32:51 +00:00
Martin Blapp
90c9edaaa4 MFNetBSD
Decrease log severity to debug if a protocol is not supported by the
kernel (rpcbind checks /etc/netconfig if a protocol is available).
This avoids "rpcbind: cannot create socket for tcp6" messages
at startup on IPv4-only kernels.
2004-08-16 00:20:31 +00:00
Martin Blapp
11362b0945 Don't pass NULL as an integer.
Obtained from:  NetBSD
2003-10-29 09:31:41 +00:00
Martin Blapp
bcb53b1606 Implement nonblocking tpc-connections. rpcgen -m does still
produce backcompatible code.

Reviewed by:	rwatson
Obtained from:	NetBSD
MFC after:	1 day
2003-01-16 07:27:30 +00:00
Jens Schweikhardt
9d5abbddbf Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,
especially in troff files.
2003-01-01 18:49:04 +00:00
Martin Blapp
fb4c80619a Change the name for the local unix-socket based protocol
from "unix" back to "local".  Add some compat stuff so both
ways work for some time.

Reviewed by:    phk
Approved by:    imp (UPDATING)
Requested by:   iedowse, lukem@netbsd.org
2002-12-16 22:24:26 +00:00
Martin Blapp
b1c56f9c37 Check if rpcbind is already running and print a warning.
Fixes segfault if rpcbind is started up a second time.

Solution has been taken from mountd(8).

Reviewed by:	phk
Approved by:	re (rwatson)
2002-12-10 08:47:18 +00:00
Alfred Perlstein
4180788ff0 WARNS=3 safety (mostly), use __unused for unused params and unsigned where
needed to avoid warnings about comparing signed and unsigned values.
2002-10-07 02:56:59 +00:00
Alfred Perlstein
4362ea2992 fix line wrap. 2002-10-07 01:19:56 +00:00
Alfred Perlstein
e9fb8a0e9d Don't pass a NULL pointer to syslog(3).
Submitted by: kris
2002-10-07 00:58:21 +00:00
Hajimu UMEMOTO
fc99a00c7f use IPV6_V6ONLY instead of non standard IPV6_BINDV6ONLY.
MFC after:	1 week
2002-07-22 15:22:53 +00:00
Alfred Perlstein
9fb9141723 Add -h option to rpcbind, used to specify what address to bind to for
UDP requests.

Submitted by: mbr
2002-07-11 16:19:43 +00:00
Juli Mallett
2244ec0163 Stop this program's abuse of malloc(3). Its return value doesn't need these
ugly explicit casts, and its argument doesn't need explicitly cast to u_int,
especially if sizeof() is being used.
2002-05-17 05:27:52 +00:00
Alfred Perlstein
8360efbd6c 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
2001-03-19 12:50:13 +00:00