Kevin Coffman [Sat, 8 Jul 2006 00:01:40 +0000 (10:01 +1000)]
Use uid/gid of -1 to indicate the export's anonuid/anongid should be used
Kernel routine nfsd_setuser() in fs/nfsd/auth.c checks for the
value -1 and defaults the credential's fsuid/fsgid to the
correct anonuid/anongid values for the given export. We should
be passing this value (-1) down when a name mapping cannot be found.
Thanks to J. Bruce Fields <bfields@fieldses.org> for the reference.
Signed-off-by: Kevin Coffman <kwc@citi.umich.edu> Acked-by: J. Bruce Fields <bfields@fieldses.org>
Neil Brown [Fri, 7 Jul 2006 23:41:58 +0000 (09:41 +1000)]
Disable building/installing mount.nfs by default.
mount.nfs does not yet support 'user' option and some others.
To make it support this we need to make it setuid-root, and
some security isses need to be resolved before that can be done
safely.
Don't depend on Kerberos headers when checking librpcsecgss in configure
Signed-off-by: Kevin Coffman <kwc@citi.umich.edu>
Older versions of MIT Kerberos are missing an OID definition, causing
the configure checks for librpcsecgss to fail. We shouldn't be depending
on their libraries during the configure.
- unused variable 'buf'
- emit a declaration for `buf' on demand.
- unused variable 'i'
- declare i immediately before use
- unused value from IXDR_PUT_
- cast to (void)
- type-punned pointer reference
- cast to (void*) first :-(
Signed-off-by: Kevin Coffman <kwc@citi.umich.edu>
Temporary patch to do default mapping if we get an error while trying to
map a gss principal to the appropriate uid/gid. This currently returns
hardcoded values. This may be correct, or we may need to try and figure
out the correct values to match the anonuid/anongid for the export.
Change default buffer size increment for readline()
Signed-off-by: Kevin Coffman <kwc@citi.umich.edu>
The readline routine expects much smaller messages than we are passing.
Change the default initial allocation and increment value from 128
to 2048. This saves many calls to realloc().
Signed-off-by: Kevin Coffman <kwc@citi.umich.edu>
Update the printerr() function to:
1) Determine whether we'll print the message before going to all the
work of formatting it.
2) Don't just toss away messages that are too long for the buffer.
Print what we can and give an indication of the truncation with
"..." at the end.
3) Use a single buffer rather than two.
4) Messages either go to syslog (with level ERR) or stderr. Don't
send some messages to syslog level DEBUG.
Use setfsuid() rather than seteuid() while creating contexts
Signed-off-by: Kevin Coffman <kwc@citi.umich.edu>
As suggested by Olaf Kirch <okir@suse.de>, use setfsuid() rather than
seteuid() when creating a gss context. This prevents users from using
credentials that do not belong to them, while also preventing them from
doing things like killing, renicing, or changing the priority of the
gssd process while it is processing the context creation.
Signed-off-by: Kevin Coffman <kwc@citi.umich.edu>
Specify that the acquire_cred call should only be concerned with returning
Kerberos credentials since this is Kerberos-only functionality.
Signed-off-by: Kevin Coffman <kwc@citi.umich.edu>
Do a call to determine mechanisms supported by the gssapi library early.
This allows us to discover early in case the gssapi library is somehow
misconfigured. We can bail out early and give a meaningful message
rather than getting errors on each attempt at a context negotiation.
Signed-off-by: Kevin Coffman <kwc@citi.umich.edu>
Correct the definition of mech_used in the gss context to use gss_OID_desc.
This fixes problems on 64-bit machines when referencing the OID.
Also updates write_buffer function to use u_int rather than size_t when
doing calculations.
Steve Dickson [Sun, 2 Jul 2006 23:52:00 +0000 (09:52 +1000)]
Allow rpc.nfsd to suppress tcp or udp, and listen on a specific address.
-T - will suppressing listening for TCP connection.
-U - will suppress UDP
-H host - will only listen on that local address
-p port - will listen on that port.
This requires kernel patches which will hopefully be in 2.6.19 and possibly some
earlier test and vendor kernels.
Greg Banks [Tue, 27 Jun 2006 11:22:59 +0000 (21:22 +1000)]
Comment out the decades-old SCCS id strings from the original Sun
distribution. They cause compile warnings, there is no longer any
reason to try to build them into the binaries, and gcc seems to be
eliding some of them anyway.
Neil Brown [Fri, 23 Jun 2006 03:37:08 +0000 (13:37 +1000)]
Try to make sure that clientid used for NFSv4 is reliable.
We need to give an IP address to identify this client to the
server.
The current code does a gethostbyname of the hostname. One
some systems this returns 127.0.0.1 or similar, which is not useful.
Instead, use getsockname of the sock used to connect to the server
to confirm that the server is working. This gives the address on the
interface that was chosen to talk to that server, which is the
best address we can find (if there is a NAT in the way, it might
still not work, but in that case there is nothing we can do).