Commit Graph

398 Commits

Author SHA1 Message Date
John Baldwin
55fdae4cae The fd_mask type is an unsigned long, not an int, so treat the mask as a
long instead of an int when examining the results of select() to look for
RPC requests.  Previously this routine would ignore RPC requests to sockets
whose file descriptor mod 64 was greater than 31 on a 64-bit platform.

PR:		amd64/141130
Submitted by:	liujb of array networks
MFC after:	3 days
2009-12-03 15:14:30 +00:00
Garrett Wollman
87541d3110 Style: use structure assignment rather than memcpy() to copy a
structure.
2009-11-25 04:53:38 +00:00
Garrett Wollman
bedffadccc In clnt_raw_create(), avoid minor race condition initializing the
file-scope variable clntraw_private.

Found by:	Clang static analyzer
MFC after:	7 days
2009-11-25 04:52:12 +00:00
Garrett Wollman
fcbfc882d6 In svc_raw_reply(), don't leave stat uninitialized if the MSG_ACCEPTED
&& SUCCESS case succeeds.  The stack garbage might be zero.

Found by:	Clang static analyzer
MFC after:	7 days
2009-11-25 04:49:41 +00:00
Garrett Wollman
0c0349bfa4 Eliminate more dead stores.
Found by:	Clang static analyzer
MFC after:	7 days
2009-11-25 04:45:45 +00:00
Xin LI
5f4faf74cb Lock around access to nc_file and netconfig_info ("ni"). The RPC
part of libc is still not thread safe but this would at least
reduce the problems we have.

PR:		threads/118544
Submitted by:	Changming Sun <snnn119 gmail com>
MFC after:	2 weeks
2009-06-24 23:17:16 +00:00
Brooks Davis
838d985825 Rework the credential code to support larger values of NGROUPS and
NGROUPS_MAX, eliminate ABI dependencies on them, and raise the to 1024
and 1023 respectively.  (Previously they were equal, but under a close
reading of POSIX, NGROUPS_MAX was defined to be too large by 1 since it
is the number of supplemental groups, not total number of groups.)

The bulk of the change consists of converting the struct ucred member
cr_groups from a static array to a pointer.  Do the equivalent in
kinfo_proc.

Introduce new interfaces crcopysafe() and crsetgroups() for duplicating
a process credential before modifying it and for setting group lists
respectively.  Both interfaces take care for the details of allocating
groups array. crsetgroups() takes care of truncating the group list
to the current maximum (NGROUPS) if necessary.  In the future,
crsetgroups() may be responsible for insuring invariants such as sorting
the supplemental groups to allow groupmember() to be implemented as a
binary search.

Because we can not change struct xucred without breaking application
ABIs, we leave it alone and introduce a new XU_NGROUPS value which is
always 16 and is to be used or NGRPS as appropriate for things such as
NFS which need to use no more than 16 groups.  When feasible, truncate
the group list rather than generating an error.

Minor changes:
  - Reduce the number of hand rolled versions of groupmember().
  - Do not assign to both cr_gid and cr_groups[0].
  - Modify ipfw to cache ucreds instead of part of their contents since
    they are immutable once referenced by more than one entity.

Submitted by:	Isilon Systems (initial implementation)
X-MFC after:	never
PR:		bin/113398 kern/133867
2009-06-19 17:10:35 +00:00
Brooks Davis
54404cfb13 In preparation for raising NGROUPS and NGROUPS_MAX, change base
system callers of getgroups(), getgrouplist(), and setgroups() to
allocate buffers dynamically.  Specifically, allocate a buffer of size
sysconf(_SC_NGROUPS_MAX)+1 (+2 in a few cases to allow for overflow).

This (or similar gymnastics) is required for the code to actually follow
the POSIX.1-2008 specification where {NGROUPS_MAX} may differ at runtime
and where getgroups may return {NGROUPS_MAX}+1 results on systems like
FreeBSD which include the primary group.

In id(1), don't pointlessly add the primary group to the list of all
groups, it is always the first result from getgroups().  In principle
the old code was more portable, but this was only done in one of the two
places where getgroups() was called to the overall effect was pointless.

Document the actual POSIX requirements in the getgroups(2) and
setgroups(2) manpages.  We do not yet support a dynamic NGROUPS, but we
may in the future.

MFC after:	2 weeks
2009-06-19 15:58:24 +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
Alexander Kabaev
8a784b73d3 Do not attempt to set source address on outgoing messages
on UDP socket if we do not have a valid IP address.
2009-06-08 03:39:15 +00:00
Zachary Loafman
fcd3177f90 Match type for socket option (in practice, unnecessary, but stylistically it's a little nicer).
Suggested by:       jilles
Approved by:        dfr (mentor)
2009-05-28 15:02:44 +00:00
Zachary Loafman
35941cc841 Handle UDP RPC replies correctly on a multi-homed system, in userland RPC. Corrects an issue with mountd replies to OS X.
Approved by:        dfr (mentor)
2009-05-27 17:02:15 +00:00
Ed Maste
14846f9b49 Include a space between "send" and "broadcast". 2009-04-09 20:57:35 +00:00
Xin LI
985a73f6d3 Remove a warning which is supposed to have been removed on 20030301. 2009-04-02 21:51:54 +00:00
Doug Rabson
3d3ec67618 Fix async mode (required for ypbind in manycast mode). 2008-09-15 14:02:49 +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
Doug Rabson
ecc03b80f1 Don't call xdrrec_skiprecord in the non-blocking case. If
__xdrrec_getrec has returned TRUE, then we have a complete request in
the buffer - calling xdrrec_skiprecord is not necessary. In particular,
if there is another record already buffered on the stream,
xdrrec_skiprecord will discard both this request and the next
one, causing the call to xdr_callmsg to fail and the stream to be
closed.

Sponsored by:	Isilon Systems
2008-03-30 09:36:17 +00:00
John Birrell
102c7c9299 Use intermediate pointers to avoid strict alias type check failures
using gcc 4.2. This is required for tinderbox which doesn't have
-fno-strict-aliasing in it's custom CFLAGS.
2007-11-20 01:51:20 +00:00
Matteo Riondato
330e445c29 Fix some improper handling of malloc failures
PR:		bin/83344 , kern/81987
Reviewed by:	alfred
Approved by:	re (kensmith)
MFC after:	1 week
2007-09-20 22:35:24 +00:00
Hartmut Brandt
e62e610b7d Use an array of size NGROUP_MAX for the getgroups() call instead of NGRP.
When NGROUP_MAX is larger than NGRP the call used to fail. Now the call
succeedes, but only the first NGRP groups are actually used for authentication.
2007-06-14 20:07:35 +00:00
Daniel Eischen
2665faf497 Some libc symbol map cleanups.
net: endhostdnsent is named _endhostdnsent and is
  private to netdb family of functions.

  posix1e: acl_size.c has been never compiled in,
  so there's no "acl_size".

  rpc: "getnetid" is a static function.

  stdtime: "gtime" is #ifdef'ed out in the source.

  some symbols are specific only to some architectures,
  e.g., ___tls_get_addr is only defined on i386.

  __htonl, __htons, __ntohl and __ntohs are no longer
  functions, they are now (internal) defines in
  <machine/endian.h>.

Submitted by:	ru
2007-05-31 13:01:34 +00:00
Jonathan Chen
4ea8677105 endrpcent belongs with rpc name service db, not services.
MFC after:	1 week
2007-05-17 03:34:33 +00:00
Daniel Eischen
5f864214bb Use C comments since we now preprocess these files with CPP. 2007-04-29 14:05:22 +00:00
Simon L. B. Nielsen
3dd425f70b Disable RPC exponential back-off for FreeBSD.org systems (IE. hidden
behind _FREEFALL_CONFIG).  This is done mainly to make NIS even more
resistant to packet loss.

This is not enabled by default for "normal" FreeBSD since it might cause
the server providing the RPC service to be hit heavily with RPC traffic
in case of problems.  freefall.FreeBSD.org and hub.FreeBSD.org have been
running with a patch similar to this for a couple of weeks.

MFC after:	1 week
Discussed with:	peter
2007-03-04 12:25:03 +00:00
Maxim Konovalov
ba5b74d001 o Remove duplicate includes.
Obtained from:	Slava Semushin via NetBSD
2007-01-20 08:24:02 +00:00
Ruslan Ermilov
a73a3ab56b Markup fixes. 2006-09-17 21:27:35 +00:00
Martin Blapp
794295bab8 Sync with NetBSD rev. 1.16 + 1.17
Coverity CID 2292: Plug memory leak.
Coverity CID 2291: Move function call before allocating storage to prevent
memory leak on error.

MFC after:    1 month
2006-09-09 22:33:21 +00:00
Martin Blapp
8306b5154c Sync with NetBSD rev. 1.29
Coverity CID 2293: Fix memory leak.

MFC after:	1 month
2006-09-09 22:32:07 +00:00
Martin Blapp
c317a5c2f6 Sync with NetBSD rev. 1.6 + 1.7
Coverity CID 779 + 780: Avoid NULL pointer dereference.

MFC after:    1 month
2006-09-09 22:29:16 +00:00
Martin Blapp
f340bd4070 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
2006-09-09 22:26:47 +00:00
Martin Blapp
dc9fde8d4f Sync with NetBSD rev. 1.10
Coverity CID 2276: Don't leak memory on error.

MFC after:    1 month
2006-09-09 22:22:39 +00:00
Martin Blapp
b0718451b8 Sync with NetBSD rev. 1.15
Coverity CID 2275: Avoid memory leak on error.

MFC after:    1 month
2006-09-09 22:21:15 +00:00
Martin Blapp
b0eb405d46 Sync part of NetBSD rev. 1.14
Fix unpaired sigblock which possibly leaves the process with all
signals blocked.

MFC after:	2 weeks
2006-09-09 22:18:57 +00:00
Martin Blapp
e0c693387f Sync with NetBSD rev. 1.16 + 1.17
Coverity CID 3651: Don't leak ifaddrs on getaddrinfo failure.
Coverity CID 2283: Don't leak sys_auth on error.

MFC after:    1 month
2006-09-09 22:14:42 +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
6fad3aaf15 Add each directory's symbol map file to SYM_MAPS. 2006-03-13 01:15:01 +00:00
Daniel Eischen
cce72e8860 Add symbol maps and initial symbol version definitions to libc.
Reviewed by:	davidxu
2006-03-13 00:53:21 +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
Xin LI
30b86e872b Don't do a time travel to 12006... 2006-02-28 07:36:25 +00:00
Daniel Eischen
235baf269e Staticize a couple of functions.
Remove a few unused locks.

Remove locks from application namespace.
2006-02-27 22:10:59 +00:00
Ceri Davies
a3df483296 I wrote getnetconfig where I meant getnetpath in the previous revision. 2006-01-11 13:57:15 +00:00
Ceri Davies
1e1e1fce56 o Document the possibility of putting 'b' in the flag field.
While we don't use the NC_BROADCAST value of nc_flag anywhere in the
  RPC code, it is parseable by getnetconfigent(3) from /etc/netconfig.

o Clean up some "see below"'s that were cut and pasted from netconfig.h.
2006-01-06 19:39:16 +00:00
Ruslan Ermilov
79be508c8f Fix prototypes. 2005-11-23 16:44:23 +00:00
Stefan Farfeleder
f5365e2a65 Add a couple of missing MLINKS. 2005-09-11 20:59:52 +00:00
Stefan Farfeleder
1f7d62b344 Avoid pointer arithmetics on void *.
Approved by:	alfred
2005-03-10 08:25:49 +00:00
Stefan Farfeleder
08baa8a1fa Remove an superfluous assignment.
Approved by:	alfred
2005-03-10 00:58:21 +00:00
Stefan Farfeleder
720138bbde Use socklen_t where appropriate.
Approved by:	alfred
2005-03-10 00:57:01 +00:00
Ruslan Ermilov
0227791b40 Expand *n't contractions. 2005-02-13 22:25:33 +00:00
Ruslan Ermilov
6b806d21d1 Fixed the misplaced $FreeBSD$. 2005-02-09 18:07:17 +00:00
Ruslan Ermilov
24a0682c64 Sort sections. 2005-01-20 09:17:07 +00:00
Bjoern A. Zeeb
6c58990d47 Add knob NO_NIS (fka NO_YP_LIBC) and make world compileable when set.
If turned on  no NIS support and related programs will be built.

Lost parts rediscovered by:	Danny Braniss <danny at cs.huji.ac.il>
PR:		bin/68303
No objections:	des, gshapiro, nectar
Reviewed by:	ru
Approved by:	rwatson (mentor)
MFC after:	2 weeks
2004-11-13 20:40:32 +00:00
David E. O'Brien
a986ef5788 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
2004-10-16 06:11:35 +00:00
Stefan Farfeleder
361de173a5 Avoid using void pointers in additive expressions.
PR:		56653 (libc/rpc bits)
Approved by:	alfred
2004-08-13 23:22:38 +00:00
Ruslan Ermilov
30950a21e1 Eliminate double whitespace. 2004-07-03 22:30:10 +00:00
Ruslan Ermilov
1a0a934547 Mechanically kill hard sentence breaks. 2004-07-02 23:52:20 +00:00
Mark Murray
16fc3635f7 Make NULL a (void*)0 whereever possible, and fix the warnings(-Werror)
that this provokes. "Wherever possible" means "In the kernel OR NOT
C++" (implying C).

There are places where (void *) pointers are not valid, such as for
function pointers, but in the special case of (void *)0, agreement
settles on it being OK.

Most of the fixes were NULL where an integer zero was needed; many
of the fixes were NULL where ascii <nul> ('\0') was needed, and a
few were just "other".

Tested on: i386 sparc64
2004-03-05 08:10:19 +00:00
Colin Percival
3c754d8be1 style cleanup: Remove duplicate $FreeBSD$ tags.
These files had tags at the start of the file
(incorrect, removed), and after the copyright
notices (correct).

Approved by:	rwatson (mentor)
2004-02-10 20:40:17 +00:00
Ruslan Ermilov
cda0da5761 XDR sources are handled by ../xdr/Makefile.inc. 2004-01-11 17:14:54 +00:00
Jacques Vidrine
a587d2f78f Add missing declaration. 2004-01-06 18:45:58 +00:00
Martin Blapp
f4a180cc7b Make this part identical with NetBSD: Use recvlen instead of inlen.
No functionality change.

Obtained from:	NetBSD
2003-10-29 09:25:07 +00:00
Martin Blapp
b6c452a8fd Don't compare NULL against a character.
Obtained from:	NetBSD
2003-10-29 09:22:49 +00:00
Martin Blapp
74a482551f Don't use NULL to compare against a char.
Obtained from:	NetBSD
2003-10-29 09:20:33 +00:00
Martin Blapp
2ad99b72ee Don't use NULL to compare against a character.
Obtained from:	NetBSD
2003-10-29 09:18:44 +00:00
Ruslan Ermilov
959d6c24f6 Get rid of duplicates. 2003-09-14 13:41:59 +00:00
Ruslan Ermilov
fe08efe680 mdoc(7): Use the new feature of the .In macro. 2003-09-08 19:57:22 +00:00
Eivind Eklund
09a759d347 Clarify text 2003-08-26 15:52:47 +00:00
Martin Blapp
b77aeb1292 Kill prototype for __msgwrite too. It is not needed anymore. 2003-06-15 10:55:39 +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
Martin Blapp
65d06145a2 Don't return -1 and abort if msg.msg_controllen is 0. For
some strange reason recvmsg() never sets errno to EAGAIN
on a non-blocking socket and just returns 0.

Reviewed by:	jhb
Approved by:	re
2003-05-29 22:06:06 +00:00
Martin Blapp
e5cd12556d Fix a problem introduced in the last commit. sa and cm
are not initialized at this place. Move the initializing
before the non-blocking check.

Submitted by:	Marius Strobl <marius@alchemy.franken.de>
Reviewed by:	jhb
Approved by:	re
2003-05-29 19:43:22 +00:00
Martin Blapp
aee2eba2d1 If AF_LOCAL is used, we need to use __msgread_withcred() instead of
just read() in non-blocking mode too. The reason is obvious. NetBSD
uses a complete different way to get the credentials so this patch
only applies to FreeBSD.

Reviewed by:	rwatson
Approved by:	re
2003-05-28 09:16:35 +00:00
Martin Blapp
f8af072548 Fix a simple bug that prevents svc_tli_create to bind to the address
specified by caller.

NetBSD rev. 1.6

Reviewed by:	rwatson
Approved by:	rwatson (re)
Obtained from:	NetBSD
2003-05-18 15:07:25 +00:00
Jacques Vidrine
d05090827f Back out the `hiding' of strlcpy and strlcat. Several people
vocally objected to this safety belt.
2003-05-01 19:03:14 +00:00
Jacques Vidrine
5723e501ab `Hide' strlcpy and strlcat (using the namespace.h / __weak_reference
technique) so that we don't wind up calling into an application's
version if the application defines them.

Inspired by:	qpopper's interfering and buggy version of strlcpy
2003-04-29 21:13:50 +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
Jacques Vidrine
2bbd7cf820 Eliminate 19 warnings in libc (at level WARNS=2) of the
`implicit declaration of function' variety.
2003-02-27 13:40:01 +00:00
Jacques Vidrine
e0554a531f Eliminate 61 warnings emitted at WARNS=2 (leaving 53 to go).
Only warnings that could be fixed without changing the generated object
code and without restructuring the source code have been handled.

Reviewed by:	/sbin/md5
2003-02-16 17:29:11 +00:00
Philippe Charnier
d649825182 The .Fn function 2003-02-06 11:04:47 +00:00
Martin Blapp
2e26eba4b9 Fix signed/unsigned comparison warnings.
Reviewed by:		phk
Obtained from:		NetBSD
2003-01-27 22:46:50 +00:00
Martin Blapp
3c788545e8 Fix signed/unsigned comparison warnings. Fix spelling error in
comment.

NetBSD Rev. 1.9 and 1.7

Reviewed by:		phk
Obtained from:		NetBSD
2003-01-27 22:45:08 +00:00
Martin Blapp
33e0ae486e Make this work in the !INET6 case -- if we mismatch the AF, don't return a
bogus (uninitialized) structure. Also, ignore v4 ifa's with no broadcast
address (rather than core dumping).

NetBSD Rev 1.8

Reviewed by:		phk
Obtained from:		NetBSD
2003-01-27 22:43:23 +00:00
Martin Blapp
d063ef1461 Check pmap_flag before sendto.
NetBSD r 1.5

Reviewed by:		phk
Obtained from:		NetBSD
2003-01-27 22:38:25 +00:00
Martin Blapp
555f4cffb0 Make sure we don't look before the beginning of the string.
NetBSD Rev 1.5

Reviewed by:		phk
Obtained from:		NetBSD
2003-01-27 22:36:53 +00:00
Martin Blapp
77335102aa 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
2003-01-27 22:27:55 +00:00
Martin Blapp
b951fbe40c Free the correct buffer in error handling.
Handle that malloc may return NULL.

NetBSD Rev. 1.8

Reviewed by:		phk
Obtained from:		NetBSD
2003-01-27 22:22:59 +00:00
Martin Blapp
0ae0e1ea47 Fix namespace pollution introduced in previous commit.
Reviewed by:		phk
2003-01-26 23:01:49 +00:00
Martin Blapp
9790dbfc0f Fix memleak.
Reviewed by:	rwatson
MFC after:	2 weeks
2003-01-16 16:43:58 +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
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
57bd0fc6e8 english(4) police. 2002-12-27 12:15:40 +00:00
Ruslan Ermilov
2efeeba554 mdoc(7) police: "The .Fa argument.". 2002-12-19 09:40:28 +00:00
Ruslan Ermilov
1fae73b137 mdoc(7) police: "The .Fn function". 2002-12-18 12:45:11 +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
Ruslan Ermilov
8d5d039f80 Uniformly refer to a file system as "file system".
Approved by:	re
2002-12-12 17:26:04 +00:00
Ruslan Ermilov
c51d717f0c libc_r wasn't so tied to libc for 22 months. 2002-11-18 09:50:57 +00:00
Ruslan Ermilov
ff56972e0e Cosmetics. 2002-10-29 15:00:10 +00:00
Ruslan Ermilov
b382ba4fb1 bsd.doc.mk changes:
Don't gratuitously pipe thru a cat(1) if NODOCCOMPRESS.

Only create _stamp.extra when necessary.

Get rid of SOELIMPP and OBJS.

Use Groff version of soelim(1); we need its -I option
for the following to work.

Don't needlessly chdir to SRCDIR.  Only a few documents
need CD_HACK, and those that need it either use refer(1)
or .PSPIC macro which internally uses the .psbb call.
2002-10-29 14:56:09 +00:00
Ian Dowse
d7cd6ba39b Use kqueue(2) instead of poll(2) to wait for replies and timeouts
in the UDP RPC client code. As a side-effect, this fixes some bugs
that might prevent the RPC call from ever timing out for example
if the server keeps responding with the wrong xid. This could
probably be simplified further by using the EVFILT_TIMER filter.
2002-10-15 22:28:59 +00:00
Bill Fenner
e5b04cee36 Fix documentation of clnt_control()'s CL{GET|SET}_{VERS|XID} to
reflect that they actually require a u_int32_t *, which is not
 necessarily the same as an unsigned long *.
2002-09-16 21:45:37 +00:00
Bruce Evans
80ee2492c5 xdr.3 is added to MAN in ../xdr/Makefile.inc where it belongs, so don't
add it here.
2002-08-19 23:06:00 +00:00
Ruslan Ermilov
bebfe08f18 mdoc(7) police: whitespace nits. 2002-08-09 11:17:56 +00:00
Ian Dowse
bb1ca86f24 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>
2002-07-26 07:52:21 +00:00
Alfred Perlstein
988553e96a Fix "rpcinfo -m" when talking to other implementations of rpcbind.
Submitted by: mbr (NetBSD PR#15802)
2002-07-14 23:38:37 +00:00
Alfred Perlstein
886ee6f6a5 clnt_vc_create() has const scalar arguments that wind up being modified,
fix it (make them non-const) and update the associated documentation.

Submitted by: mbr
2002-07-14 23:35:04 +00:00
Alfred Perlstein
c549fd466b Cast function args to silence warning.
Submitted by: mbr
2002-07-14 23:20:08 +00:00
Alfred Perlstein
261e68702a Add a prototype for __rpcb_findaddr_timed to silence a warning. 2002-07-14 23:14:08 +00:00
Alfred Perlstein
cffc0b5784 Silence several warnings due to functions that needed to take a void *
having a char * as an argument instead. clnt_dg_control(), clnt_raw_control(),
clnt_vc_control().
2002-07-14 23:14:02 +00:00
Alfred Perlstein
62947a57cc Update manpages to reference 'timed' rpc functions 2002-07-11 22:25:16 +00:00
Alfred Perlstein
4e37855e01 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
2002-07-11 16:23:04 +00:00
Dima Dorfman
11612afabe s/demon/daemon/ 2002-05-12 00:22:38 +00:00
Dag-Erling Smørgrav
f249dbcc71 Spell void * as void * rather than caddr_t. This is complicated by the
fact that caddr_t is often misspelled as char *.

Sponsored by:	DARPA, NAI Labs
2002-04-28 15:18:50 +00:00
David E. O'Brien
d3d20c8267 Fix the style of the SCM ID's.
I believe have made all of libc .c's as consistent as possible.
2002-03-22 23:18:37 +00:00
David E. O'Brien
74fd44fc19 Fix the style of the SCM ID's.
I believe have made all of libc .h's as consistent as possible.
2002-03-22 23:18:17 +00:00
Alfred Perlstein
b275d8fe48 Constify the first arg to callrpc(3). 2002-03-22 19:19:32 +00:00
David E. O'Brien
1372519b15 Remove multi-line __P() usage. 2002-03-22 09:22:15 +00:00
David E. O'Brien
c05ac53b8b Remove __P() usage. 2002-03-21 22:49:10 +00:00
David E. O'Brien
8fb3f3f682 Remove 'register' keyword. 2002-03-21 18:49:23 +00:00
Mike Barcroft
fd8e4ebc8c o Move NTOHL() and associated macros into <sys/param.h>. These are
deprecated in favor of the POSIX-defined lowercase variants.
o Change all occurrences of NTOHL() and associated marcros in the
  source tree to use the lowercase function variants.
o Add missing license bits to sparc64's <machine/endian.h>.
  Approved by: jake
o Clean up <machine/endian.h> files.
o Remove unused __uint16_swap_uint32() from i386's <machine/endian.h>.
o Remove prototypes for non-existent bswapXX() functions.
o Include <machine/endian.h> in <arpa/inet.h> to define the
  POSIX-required ntohl() family of functions.
o Do similar things to expose the ntohl() family in libstand, <netinet/in.h>,
  and <sys/param.h>.
o Prepend underscores to the ntohl() family to help deal with
  complexities associated with having MD (asm and inline) versions, and
  having to prevent exposure of these functions in other headers that
  happen to make use of endian-specific defines.
o Create weak aliases to the canonical function name to help deal with
  third-party software forgetting to include an appropriate header.
o Remove some now unneeded pollution from <sys/types.h>.
o Add missing <arpa/inet.h> includes in userland.

Tested on:	alpha, i386
Reviewed by:	bde, jake, tmm
2002-02-18 20:35:27 +00:00
Ian Dowse
6112fceebd 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
2002-02-16 17:05:49 +00:00
Alfred Perlstein
866e3c9008 Move the AF_LOCAL check to the AF_INET check since portmap protocol
v. 2 only needs this. That also makes it shorter and simpler.

Submitted by: mbr
2002-02-06 19:14:02 +00:00
Alfred Perlstein
2abd9cf115 For RPC v2 we need to fill in ret->xp_raddr too. INET_6
is not supported in portmap, so we don't have to care about it.

Submitted by: mbr
2002-02-05 23:46:37 +00:00
Alfred Perlstein
8d6301358e Fix cc -Wall, fix rcsid warnings, add missing prototypes,
change prototypes to be the same as in the original sun tirpc code.
Remove ()P macro in a file where the mayority had ()P already removed.
Add them if the mayority use ()P macros.

Submitted by: mbr
Requested by: bde
2002-02-05 23:43:43 +00:00
Alfred Perlstein
e4db1131b8 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
2002-02-05 23:12:51 +00:00
Alfred Perlstein
49de9dcd8b style: return(x) -> return (x)
Submitted by: mbr
2002-02-05 19:31:16 +00:00
Alfred Perlstein
08760d5a57 Fix the credential handling code.
In NetBSD, Solaris, xprt->xp_p2 pointed directly to the credentials,
in FreeBSD xprt->xp_verf.oa_base was a pointer to a struct cmessage,
which is defined as follow:

struct cmessage {
        struct cmsghdr cmsg;
        struct cmsgcred cmcred;
};

The credentials were submitted the right way and xprt->xp_p2 pointed to them.
But cb_verf.oa_flavor was still empty. There was an assignment missing
in svc_recv() in svc_vc.c:

msg->rm_call.cb_verf.oa_flavor = AUTH_UNIX;

Also

+       if (addr.ss_family == AF_LOCAL) {
+               xprt->xp_raddr = *(struct sockaddr_in *)xprt->xp_rtaddr.buf;
+               xprt->xp_addrlen = sizeof (struct sockaddr_in);
+       }

was missing. But the first seems not to be needed:

I guess in rpc.yppasswdd there was a typo:

- transp>xp_verf.oa_flavor != AUTH_UNIX) {
+ rqstp->rq_cred.oa_flavor != AUTH_UNIX) {

This little fix does fix the breakage in rpc.yppasswdd :-)

+       if (msg.msg_controllen == 0 ||
+           (msg.msg_flags & MSG_CTRUNC) != 0)
+               return (-1);

We cannot set the cb_verf.oa_length in svc_recv() of svc_vc.c,
the credentials get overwritten then, and that's bad.

Submitted by: mbr
2002-02-05 19:30:30 +00:00
Alfred Perlstein
8858373f83 The clnt_create(KEYSERVSOCK, CRYPT_PROG, CRYPT_VERS, "unix") hacks
were removed and replaced them with clnt_tp_create, now the af_local
support is fixed.

I also removed the hack how rpcinfo contacted rpcbind, now we can
relay on clnt_tp_create create the client-handle for us.  Only
rpcbind itself needs a hardcoded socket-path.

Submitted by: mbr

Also add $FreeBSD
2002-02-05 19:26:04 +00:00
Peter Wemm
8754b1ac25 clnt_bcast.c:420:33: warning: extra tokens at end of #endif directive 2001-12-15 00:07:37 +00:00
Ruslan Ermilov
872013cb2a mdoc(7) police: consistently use the .Ux macro. 2001-11-20 13:54:11 +00:00
Alfred Perlstein
5814ff294d s/kernal/kernel 2001-10-19 07:52:11 +00:00
Bill Paul
e6f9ad0779 Add compatibility functions for the AF_LOCAL RPC transport stuff
that used to live in RPC 4.0. This is needed for yppasswd and
rpc.yppasswdd to work correctly. Patch supplied by Martin Blapp.
2001-10-04 21:03:17 +00:00
David Malone
2bc21ed985 Hopefully improve control message passing over Unix domain sockets.
1) Allow the sending of more than one control message at a time
over a unix domain socket. This should cover the PR 29499.

2) This requires that unp_{ex,in}ternalize and unp_scan understand
mbufs with more than one control message at a time.

3) Internalize and externalize used to work on the mbuf in-place.
This made life quite complicated and the code for sizeof(int) <
sizeof(file *) could end up doing the wrong thing. The patch always
create a new mbuf/cluster now. This resulted in the change of the
prototype for the domain externalise function.

4) You can now send SCM_TIMESTAMP messages.

5) Always use CMSG_DATA(cm) to determine the start where the data
in unp_{ex,in}ternalize. It was using ((struct cmsghdr *)cm + 1)
in some places, which gives the wrong alignment on the alpha.
(NetBSD made this fix some time ago).

This results in an ABI change for discriptor passing and creds
passing on the alpha. (Probably on the IA64 and Spare ports too).

6) Fix userland programs to use CMSG_* macros too.

7) Be more careful about freeing mbufs containing (file *)s.
This is made possible by the prototype change of externalise.

PR:		29499
MFC after:	6 weeks
2001-10-04 13:11:48 +00:00
Bruce Evans
db7534cfa2 Fixed bitrot in synopsis. The TI-RPC changes gave mounds of it, mainly
inconsistently weird const poisoning in the man pages relative to the
headers.
2001-10-03 16:47:56 +00:00
Ruslan Ermilov
32eef9aeb1 mdoc(7) police: Use the new .In macro for #include statements. 2001-10-01 16:09:29 +00:00
Bruce Evans
1643f03d5f Fixed namespace pollution related to `warn' in libc (but not in other
libraries or for other members of the err() family).

This fixes world breakage in bc and rcs/* for NOSHARED worlds.
2001-08-29 13:52:27 +00:00
Brian Somers
a53a9f6906 Handle snrintf() returning -1.
MFC after: 2 weeks
2001-08-20 12:31:13 +00:00
Ruslan Ermilov
94ba280c59 mdoc(7) police: join split punctuation to macro calls. 2001-08-10 17:35:21 +00:00
Ian Dowse
e73bb7f1e2 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
2001-08-02 21:31:21 +00:00
Sheldon Hearn
1d8ffb440b Finish the sweep of changes that fix doubled 'the'. 2001-07-24 08:30:55 +00:00
Dima Dorfman
7ebcc426ef Remove whitespace at EOL. 2001-07-15 07:53:42 +00:00
Ian Dowse
52353da871 Fix a memory leak in __rpcb_findaddr(), avoid compiler warnings.
Submitted by:	Martin Blapp <mb@imp.ch>
2001-07-14 18:18:23 +00:00
Ruslan Ermilov
5521ff5a4d mdoc(7) police: sort SEE ALSO xrefs (sort -b -f +2 -3 +1 -2). 2001-07-06 16:46:48 +00:00
Ruslan Ermilov
b23e7b410b mdoc(7) police: sort xrefs. 2001-07-04 11:02:10 +00:00
Dima Dorfman
a910f192bb Remove duplicate words. 2001-06-24 01:34:38 +00:00
Ian Dowse
32de72d27f Add a new clnt_control() request `CLSET_CONNECT' that controls
whether or not connect(2) is used for UDP client sockets. The default
is not to connect(), so existing clients will see no change in
behaviour.

The use of connect(2) for UDP clients has a number of advantages:
only replies from the intended address are received, and ICMP errors
pertaining to the connection are reported back to the application.
2001-06-23 19:43:21 +00:00
Mike Heffner
224e22e6c6 Fix typo: clnt_destroy() only takes one arg.
MFC after:	2 weeks
2001-06-18 00:45:31 +00:00
Maxim Sobolev
8657581bfd Correct cross-reference:
portmap.8 --> rpcbind.8

Submitted by:	.Xr testing script
2001-06-07 16:59:19 +00:00
Maxim Sobolev
76c6864951 Fix cross-references:
ipnat.8 --> ipnat.1
  environ.5 --> environ.7
  isssetugid.2 --> issetugid.2

MFC after:	1 week
2001-06-05 12:23:22 +00:00
Ian Dowse
a8634a0009 Copy the sockaddr from the netbuf data area, not from the netbuf
data pointer. This bug has been here since the ti-rpc import; it
apparently broke the clnt_control CLGET_SVC_ADDR options.

PR:		misc/27813
Submitted by:	Jean-Luc Richier <Jean-Luc.Richier@imag.fr>
2001-06-01 15:20:45 +00:00
Ian Dowse
a9d09e93db The function clnt_dg_call(), which is used for UDP RPC calls, could
accidentally clobber the server address if a stray packet arrived
at the client port. This would result in any further retransmits
going to the wrong address.

For now, fix this by not saving the source address of the reply; this
matches the pre-tirpc behaviour.
2001-05-18 19:43:18 +00:00