Commit Graph

91 Commits

Author SHA1 Message Date
Matteo Riondato
96e460ec53 Check the correct variables for malloc failures.
Submitted by:	Michiel Boland <michiel@boland.org>
2007-11-07 10:21:36 +00:00
Matteo Riondato
e56fbc5aad Add the -h <bindip> option to rpc.lockd, similar to the one in
nfsd(8), in mountd(8), and in rpc.statd(8)

-h bindip
Specify specific IP addresses to bind to for TCP and UDP requests.
This option may be specified multiple times.  If no -h option is
specified, rpc.lockd will bind to INADDR_ANY.  Note that when specifying
IP addresses with -h, rpc.lockd will automatically add 127.0.0.1 and
if IPv6 is enabled, ::1 to the list.

PR:		bin/98500
MFC after:	1 week
2007-11-02 14:51:53 +00:00
Jun Kuriyama
856f34f9e3 - Fix compilaton with DUMP_FILELOCK_VERBOSE.
- Use consistent "get_lock_matching_unlock" function name in
  debuglog().
2007-04-12 02:07:12 +00:00
Matteo Riondato
69f129c9f1 Add the "-p" option, which allows to specify a port which the daemon
should bind to.

PR:		bin/100969
Reviewed by:	alfred@
MFC after:	1 week
2007-04-03 20:58:28 +00:00
Christian Brueffer
fce8985370 Fix a typo in a comment, introduced in rev. 1.19. 2007-01-16 19:46:05 +00:00
Matt Jacob
84292608b3 some whitespace cleanup (which I usually don't bother with)
so I could note that the previous delta was:

Reviewed by:	Mohan
2007-01-04 20:45:33 +00:00
Matt Jacob
96f8e17c48 Add a function that checks for duplicate requests (based
on some fairly tight criteria) so we avoid having broken
clients spam rpc.lockd to death.

PR:		107530
Obtained from:	Doug Rudoff
MFC after:	1 week
2007-01-04 20:38:50 +00:00
Thomas Quinot
35a64c9f6f Set alarm timer for grace period from the grace_period variable, instead
of hard-coding a value of 10 seconds. Command line flag -g is thus now
correctly taken into account.

PR:		bin/102176
MFC after:	1 week
2006-08-23 15:59:43 +00:00
Maxim Konovalov
946289a591 o Style previous. 2006-08-17 05:55:20 +00:00
Thomas Quinot
c6d0f16db1 Use setproctitle(3) to provide identification of the client and server
processes created by rpc.lockd.

MFC after:	1 week
2006-08-16 18:33:35 +00:00
Thomas Quinot
bc1f62de8d Remove extraneous trailing \0 in string literal.
MFC after:	2 weeks
2006-08-11 23:03:16 +00:00
Craig Rodrigues
e91db40c18 Move call to ignore SIGPIPE signals before calling fork(),
so that both parent and child processes ignore this signal.

PR:             bin/97768
Submitted by:   Gea-Suan Lin <gslin at csie dot nctu dot edu dot tw>
MFC after:      3 days
2006-05-27 02:37:37 +00:00
Craig Rodrigues
a856bed399 Ignore SIGPIPE signals on write() failures.
We already check for write() failures and handle EPIPE.
Failure to handle SIGPIPE was resulting in rpc.lockd terminating.

PR:		bin/97768
Reported by:	Gea-Suan Lin <gslin at csie dot nctu dot edu dot tw>
MFC after:	1 day
2006-05-25 22:12:05 +00:00
Hartmut Brandt
251bb62d63 When a user is in more than 16 groups the call to authunix_create() will
result in abort() beeing called. This is because there is a limit of
the number of groups in the RPC which is 16. When the actual number of
groups is too large it results in xdr_array() returning an error which,
in turn, authunix_create() handles by just calling abort().

Fix this by passing only the first 16 groups to authunix_create().
2005-11-17 12:19:19 +00:00
Philippe Charnier
7838f9dd89 Add FBSDID. Add missing prototypes. Remove unused variables. Give variable
an initial value to silent compiler.
2005-05-20 13:01:47 +00:00
Olivier Houchard
d32c3b7dce Consumers of nfslockdans() seems to think it should return 0 on success, so
make it so.
2005-03-16 23:55:48 +00:00
Ruslan Ermilov
6b806d21d1 Fixed the misplaced $FreeBSD$. 2005-02-09 18:07:17 +00:00
Jun Kuriyama
2d914e9670 - Use svc_getrpccaller() rather than svc_getcaller() for using
xt_rtaddr member of SVCXPRT structure.  This allows to use IPv6
  address stored in "struct sockaddr_storage" in "struct netbuf".
- Output the reason of getnameinfo() error.

Reviewed by:	alfred
2005-02-03 22:21:19 +00:00
Ruslan Ermilov
59a3c79da6 Sort sections. 2005-01-18 20:02:45 +00:00
Poul-Henning Kamp
0cbf6231e8 Userland change corresponding to the change in kernel/userland communication
for NFS locking.
2004-12-06 08:32:09 +00:00
Stefan Farfeleder
fbdef8fb8f Include <unistd.h> for {g,s}eteuid(). 2004-10-09 15:36:13 +00:00
Michael Reifenberger
3d81d1ad2e After talking to Colin,
apply the patch of bin/61718 (which should include/elimatate kern/61122 also).
It seems to fix a few annoying bugs.

PR:		bin/61718, kern/61122
Submitted by:	bg@sics.se ohartman@mail.physik.uni-mainz.de
2004-07-16 12:50:10 +00:00
Stefan Farfeleder
a752604477 Remove spurious semicolons. Outside of functions they are actually errors but
GCC doesn't warn about them without -pedantic.

Approved by:	das (mentor)
PR:		56649
Reviewed by:	md5
2004-05-16 22:08:17 +00:00
Peter Pentchev
c0f7cd1a2a Make rpc.lockd bind to a reserved port, since there are NFS clients
which ignore NLM requests not coming from a reserved port.

PR:		56500
Submitted by:	Jonathan Lennox <lennox@cs.columbia.edu>
MFC after:	1 week
2004-03-04 15:52:28 +00:00
Alfred Perlstein
aba638209b The callrpc call to unmonitor hosts was passing the wrong xdr
decode/encode functions for the arguments to the statd unmonitor
call.  Fix it.
2004-02-17 00:13:59 +00:00
Peter Wemm
75e40e4604 Make this compile cleanly. It passes WARNS=2, but I haven't checked
it is so on more platforms.
2003-10-26 06:10:44 +00:00
Robert Watson
eda8b2821f When getting back an NLM DENIED response for a requested lock from the
server, map it to EAGAIN locally rather than EACCES.  The NLM spec
indicates the DENIED corresponds to lock contention, not a permission
failure.  This fixes O_EXLOCK/O_SHLOCK with O_NONBLOCK, which would
previously give a permission error, which in turn fixes things
like mailq(8) and lockf(1) over NFS.

Approved by:	scottl (re)
Reviewed by:	truckman, Andrew P Lentvorski, Jr. <bsder@allcaps.org>
Idea from:	truckman
2003-05-15 03:19:30 +00:00
Robert Watson
86eb7cbada Avoid registering for a lock on the server in the event the NFS client
has requested the lock in a non-blocking form, instead returning an
immediate failure.  This appears to help reduce one of my "locks get
lost" symptoms involving lockf(1), which attempts a non-blocking lock
attempt before actually blocking on the lock.  At this point the client
still gets back EACCES, which is an issue we're still working.

Approved by:	re (scottl)
Submitted by:	Andrew P. Lentvorski, Jr. <bsder@allcaps.org>
2003-05-14 21:16:33 +00:00
Robert Watson
1870b993d0 When receiving NLM_GRANTED_RES or NLM4_GRANTED_RES lock granted messages
from the NFS server, following contention on a lock by this or another
client, immediately notify the waiting process that the lock has been
granted via a wakeup.  Without this change, the client rpc.lockd will
not wakeup the waiting process until it next re-polls the lock (sometime
in the next ten seconds), which can lead to marked latency across all
potential lockers, as the lock is held by the client for the duration.

Approved by:	re (scottl)
Submitted by:	truckman
Reviewed by:	Andrew P. Lentvorski, Jr <bsder@allcaps.org>
2003-05-14 13:50:40 +00:00
Guy Helmer
8ebcf97e95 init_nsm() is executed after a call to daemon(*, 0), so error and
warning messages should be logged rather than sent to /dev/null.

PR:	bin/45461
2003-04-24 14:38:42 +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
Alfred Perlstein
f898f7c5b2 Remove a case of exposing 'struct ucred' to userspace. Use a struct xucred
for LOCKD_MSG instead.

Requested by: rwatson
2002-08-15 21:52:22 +00:00
Alfred Perlstein
09ce4f7aaf Add IPv6 support.
Submitted by: Jean-Luc Richier <Jean-Luc.Richier@imag.fr>
2002-07-15 19:40:23 +00:00
Philippe Charnier
490d5836b5 The .Nm utility 2002-07-14 14:47:15 +00:00
Alfred Perlstein
5ed43a1e8e When binding to transports if getnetconfigent() fails then actually
print out the correct transport it failed on rather than always
spitting out 'udp', also call nc_sperror() to give a more verbose
error message detailing the problem.
2002-04-11 07:19:30 +00:00
Alfred Perlstein
e4b0fede2c Use char foo[] = "BAR" to avoid direct assignment of const char * into char *.
rpcgen can't really make those fields const because the remote side might
want to munge them, so we need to pass non-const in.  Hackish, but should
work.
2002-03-22 20:02:54 +00:00
Alfred Perlstein
7bb4bf8526 Const fix. 2002-03-22 20:00:10 +00:00
Alfred Perlstein
0d28a40a57 Remove cast that's not needed. 2002-03-22 19:57:09 +00:00
Alfred Perlstein
3af9aed6c5 WARNS from 3 to 4. still some warnings about assigning const char * to
char *, but we'll fix those later.
2002-03-22 19:50:58 +00:00
Alfred Perlstein
efddf1388d constify log_from_addr() parameter. 2002-03-22 19:20:35 +00:00
Alfred Perlstein
c4bc47ba6a Bring code to WARNS=3 level. Mostly fix unused variables. 2002-03-21 23:05:13 +00:00
Alfred Perlstein
b5749e6213 Remove main() prototype. 2002-03-21 22:53:49 +00:00
Alfred Perlstein
33314abe2c Remove __P. 2002-03-21 22:52:45 +00:00
Alfred Perlstein
4b4ec9b800 Fix boundry condition in lock management:
Alfred, I took a look at retry_blockingfilelocklist() and the
 solution seemed  simple enough. Please correct me if I am wrong.
 It seems said routine doesn't  take into account boundary conditions
 when putting back file_lock entries into the blocked lock-list.
 Specifically, it fails when the file_lock being put back is the
 last element in the list, and when it is the only element in the
 list.  I've included a patch below.

 Basically, it introduces another variable: pfl, which keeps track
 of the list  item before ifl. That way if nfl is NULL, ifl gets
 inserted after pfl. If pfl  is also NULL, then it gets inserted
 at the head of the list (since it was the  only element in the
 list).

Submitted by: Mike Makonnen <mike_makonnen@yahoo.com>
Tested by: Thomas Quinot <thomas@cuivre.fr.eu.org>
2002-01-17 00:12:05 +00:00
Alfred Perlstein
815ac49626 prototype functions and fix some line wrapping 2001-12-02 11:10:46 +00:00
Alfred Perlstein
8c7daee735 Fold ANDREW_LOCKD into -current. 2001-11-29 17:36:45 +00:00
Alfred Perlstein
5f07c7b294 This completes the all partial file locking under NFS. The underlying
file is still completely covered by a flock(2) style lock, but we'll tackle
that at a later date.

Submitted by: "Andrew P. Lentvorski" <bsder@allcaps.org>
2001-11-20 06:13:53 +00:00
Alfred Perlstein
b6dc41baf1 Cleanup.
use LIST_FOREACH,

add prototypes (functions should be made static probably),

change DEBUG=1 to LOCKD_DEBUG,

K&R function instantiation for functions with long args lists,

Move comments about functions from within to above the function,

Simplified some if/else logic and reduced nested blocks.

parens around 'return' argument (return FOO -> return (FOO))
2001-11-18 05:08:19 +00:00
Alfred Perlstein
a4a8a04d08 Re-enable statd code.
Submitted by: "Andrew P. Lentvorski" <bsder@allcaps.org>
2001-11-18 03:50:38 +00:00