Commit Graph

122 Commits

Author SHA1 Message Date
Baptiste Daroussin
7a78c2b3d8 rpcbind does not need to be linked to libutil 2014-11-06 10:07:26 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
cc3f4b9965 Merge from head 2014-05-08 23:54:15 +00:00
Warner Losh
c6063d0da8 Use src.opts.mk in preference to bsd.own.mk except where we need stuff
from the latter.
2014-05-06 04:22:01 +00:00
Simon J. Gerraty
3b8f084595 Merge head 2014-04-28 07:50:45 +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
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
David E. O'Brien
d9a447559b Sync with HEAD. 2013-02-08 16:10:16 +00:00
Kevin Lo
a5752d55e0 Fix socket calls on error post-r243965.
Submitted by:	Garrett Cooper
2012-12-21 15:54:13 +00:00
Hiroki Sato
6bbfef9004 Fill sin6_scope_id in sockaddr_in6 before passing it from the kernel to
userland via routing socket or sysctl.  This eliminates the following
KAME-specific sin6_scope_id handling routine from each userland utility:

 sin6.sin6_scope_id = ntohs(*(u_int16_t *)&sin6.sin6_addr.s6_addr[2]);

This behavior can be controlled by net.inet6.ip6.deembed_scopeid.  This is
set to 1 by default (sin6_scope_id will be filled in the kernel).

Reviewed by:	bz
2012-11-17 20:19:00 +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
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
Rebecca Cran
6bccea7c2b Fix typos - remove duplicate "the".
PR:	bin/154928
Submitted by:	Eitan Adler <lists at eitanadler.com>
MFC after: 	3 days
2011-02-21 09:01:34 +00:00
Warner Losh
f77a51d7a8 Revert bogus change that snuck into r203972. 2010-02-17 06:11:05 +00:00
Warner Losh
08ab090881 The NetBSD Foundation has given permission to remove clause 3 and 4
from their liceense.

Obtained from:	NetBSD
2010-02-16 21:47:05 +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
Warner Losh
200ad46cd3 Initialize fromlen before calling recvfrom to avoid passing in random
stack garbage.

Obtained from:	NetBSD 1.13
2010-02-07 07:50:41 +00:00
Ed Schouten
71ccf09269 The last big commit: let usr.sbin/ use WARNS=6 by default. 2010-01-02 11:07:44 +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
Ceri Davies
95b9bd2890 Bump .Dd for revision 1.8. 2006-11-30 18:06:57 +00:00
Maxim Konovalov
ca60a6fe85 o Xr netconfig(5).
PR:		docs/105720
Submitted by:	koitsu
MFC after:	1 week
2006-11-29 09:01:28 +00:00
Ruslan Ermilov
e1fe3dba5c Reimplementation of world/kernel build options. For details, see:
http://lists.freebsd.org/pipermail/freebsd-current/2006-March/061725.html

The src.conf(5) manpage is to follow in a few days.

Brought to you by:	imp, jhb, kris, phk, ru (all bugs are mine)
2006-03-17 18:54:44 +00:00
Daniel Eischen
03d485eb77 Remove including of libc sources. All the required functions
are exported by libc with prototypes in our standard headers.
I guess at one time this was necessary, but not any longer.
2006-03-10 07:58:02 +00:00
Matteo Riondato
f91072f72e Don't build IPv6 support if NO_INET6 was defined
PR:		kern/73865
Submitted by:	Jeremy Chadwick <freebsd@jdc.parodius.com>
MFC after:	3 days
2006-03-06 10:07:52 +00:00
Ruslan Ermilov
59a3c79da6 Sort sections. 2005-01-18 20:02:45 +00:00
Dima Dorfman
6143758681 Reflect that -h takes an argument and belatedly bump .Dd for addition of -h 2004-11-07 04:34:37 +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
545fbf37df Don't compare a char to NULL.
Obtained from:  NetBSD
2003-10-29 09:30:37 +00:00
David E. O'Brien
052238b16c style.Makefile(5) 2003-04-04 17:49:21 +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
Jens Schweikhardt
d64ada501a Fix typos, mostly s/ an / a / where appropriate and a few s/an/and/
Add FreeBSD Id tag where missing.
2002-12-30 21:18:15 +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
Ruslan Ermilov
f7b5becb5c mdoc(7) police:
Added the -h option to the synopsis, documented the -a option,
sorted options descriptions according to style(9).

Approved by:	re
2002-11-27 15:33:47 +00:00
Alfred Perlstein
4ee5e5868f Add 'break' to empty 'default' 'switch' statements.
Requested by: mike
2002-10-07 03:56:13 +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
fa0ce29ae7 cast xdr_rpcblist_ptr to xdrproc_t to silence warnings. 2002-10-07 01:16:00 +00:00
Alfred Perlstein
b3359df33e Add ';' after 'default:' labels to avoid 'deprecated use of label at end
of compound statement' warnings.
2002-10-07 01:09:40 +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
Philippe Charnier
490d5836b5 The .Nm utility 2002-07-14 14:47:15 +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
Dima Dorfman
b7e90a112f Capitalize the first word in sentences, and put periods at the end of
sentences.
2001-08-20 00:03:01 +00:00
David E. O'Brien
90e655ea4e Perform a major cleanup of the usr.sbin Makefiles.
These are not perfectly in agreement with each other style-wise, but they
are orders of orders of magnitude more consistent style-wise than before.
2001-07-20 06:20:32 +00:00
Brian Somers
abca534c5b Free things in the right order 2001-07-16 22:12:06 +00:00
Ian Dowse
09d4f7789e This is a selection of essentially cosmetic changes:
- Use '\0' for a char instead of NULL.
- Explicitly compare against the global `nullstring' to determine if
  a non-NULL uaddr is not malloc'd.
- Remove some unnecessary casting of the argument to free().
- In rpcbproc_callit_com(), move the freeing of m_uaddr to the
  cleanup code at the end of the function.
- To avoid confusion and  possible alignment problems, change
  netbufdup() to allocate the netbuf struct and the sockaddr buffer
  separately, and change netbuffree() accordingly. This makes it
  produce netbufs that are consistent with all other netbufs in
  rpcbind.
2001-07-14 17:46:52 +00:00
Ian Dowse
c8a28c2ec9 Fix a memory leak in check_bound() by freeing the buffer area of
the netbuf before freeing the netbuf structure itself.
2001-07-14 17:17:48 +00:00
Ian Dowse
05c4b26e95 Add missing #include <stdio.h>.
Fix an off-by-one error in logit() when determining if a procedure
number has a known name.
2001-07-14 17:10:58 +00:00
Ian Dowse
e8418b515c Simplify to bitmaskcmp() to use the obvious approach instead of
comparing bit by bit.

Make the logic in in6_fillscopeid() match that in our ifconfig(8):
only set the scope ID if there is one in the address and none in
sin6_scope_id.

Correct a comment in network_init() that didn't make sense; it was
probably never updated after it was pasted from similar code in
addrmerge().
2001-07-14 17:04:26 +00:00
Ian Dowse
9510612d41 Use snprintf instead of sprintf. 2001-07-14 16:54:37 +00:00
Ian Dowse
5732749c1c Avoid a harmless compiler warning, and add a missing \n to a
debugging fprintf.

Submitted by:   Martin Blapp <mb@imp.ch>
2001-07-14 16:32:44 +00:00
Ian Dowse
99d4ecdfc0 Clean up the addrmerge() function, which was over-complicated and
contained a number of memory leaks. The changes include:

 - Add a comment describing what addrmerge() does.
 - Deal with 0.0.0.0./::. or AF_LOCAL callers correctly.
 - Use rpcbind_get_conf() instead of getnetconfigent() so we don't
   have to remember to free the returned netconfig struct.
 - Make just one pass through the ifaddrs list; we can pick up a fallback
   interface address in the same pass as the netmask comparison.
 - Define and use SA2SIN* macros to avoid the need for loads of
   protocol-specific local variables.
 - Use mostly protocol-independent code for building the netbuf version
   of the address to be returned.
 - Use the common cleanup code for virtually all error and non-error
   cases, fixing a number of memory leaks.
2001-06-24 15:03:06 +00:00
Ian Dowse
98f36a359d Fix some return-value brain-damage in forward_register(). This
function has a return type of u_int32_t, into which it was somehow
supposed to encode:
 *  A valid 32-bit XID (which could be any value including 0).
 *  0, meaning a duplicate request.
 *  -1, meaning a malloc failed (!);
We now ensure that all XIDs are non-zero, and pass the XID out via
a pointer argument.

In forward_find() and free_slot_by_xid(), remove an unnecessary
and confusing test for a negative result from an unsigned modulo
operation, but add an unnecessary cast to highlight why.
2001-06-23 21:54:47 +00:00
Ian Dowse
05f91f8d49 Bring in some bugfixes from NetBSD. I'm going to make a more
extensive pass through the rpcbind code soon, but I might as well
bring these in now.

- (NetBSD util.c r1.5) Move the initialisation of `tbuf' to avoid
  a case where it could end up containing junk from the stack. This
  should address the issue in PR bin/26806.
- (NetBSD util.c r1.6) Don't `merge' AF_LOCAL addresses, fix a few
  memory leaks.

PR:		bin/26806
Submitted by:	Martin Blapp <mb@imp.ch>
Obtained from:	NetBSD
2001-04-26 17:05:55 +00:00
Ruslan Ermilov
345e52e742 - Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.
2001-03-26 14:42:20 +00:00
Alfred Perlstein
4ed6d63483 Hopefully fix some of the bugs in passing credentials over UNIX domain sockets.
Make struct cmessage visible from socket.h (about 4 places were
defining it for themselves which wasn't good)

Make __rpc_get_local_uid() useable and give it prototype that's
visible.

Fix some issues with printing out usernames from rpcbind and keyserv.
2001-03-22 04:31:30 +00:00
Ruslan Ermilov
c73e22c3d4 Set the default manual section for usr.sbin/ to 8. 2001-03-20 18:17:26 +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