Ronnie Sahlberg [Sun, 16 Mar 2014 16:12:49 +0000 (09:12 -0700)]
IPV6: Add basic IPv6 support
This adds basic IPv6 support to libnfs.
Since libnfs currently only support PORTMAPPER protocol up to version 2
the IPv6 support only works if the server runs Both MOUNT and NFS protocols
on the same ports for IPv6 as for IPv4.
To get full IPv6 support we need to add support for PORTMAPPER version 3
and use it for discovery when using IPv6
Ronnie Sahlberg [Thu, 20 Mar 2014 01:12:45 +0000 (18:12 -0700)]
New version: 1.9.3
Wed Mar 19 2014: Version 1.9.3
- Add O_TRUNC support to nfs_open()
- Add a simple but incomplete LD_PRELOAD tool
- Fixes for some memory leaks and C++ compile support
- Make ANDROID default uid/gid to 65534
- Allow the READDIRPLUS emulation to still work if some objects
in the direcotry can not be lookedup (NFSv4 ACL denying READ-ATTRIBUTES)
- Have libnfs retry any read/write operations where the server responds
with a short read/write. Some servers do this when they are overloaded?
Peter Lieven [Sat, 15 Mar 2014 16:11:27 +0000 (17:11 +0100)]
{pread,pwrite}_async: fix potential segfault in out of memory condition
if there are already requests in flight we cannot return with an error immediately
from the functions since the caller will likely tidy up his data structures directly
and later on we call his callback with private_data that has likely already
been freed.
Peter Lieven [Sun, 16 Mar 2014 19:15:48 +0000 (20:15 +0100)]
nfs_pread_async: handle short reads
the RFC allows the server to read less bytes than requested even
if not at the EOF.
this patch implements a reissue logic for the reminder of the
read request(s).
Peter Lieven [Sat, 15 Mar 2014 14:58:08 +0000 (15:58 +0100)]
fix possible wrong cast to 32-bit unsigned
when calculation the max_offset the (unsigned) leads to a cast
to a 32-bit unsigned integer depending on the platform. as a result
we update the max_offset everytime when it grows beyond 2^32.
this leads to a wrong return max_offset value if the callbacks
are received out of order.
Ronnie Sahlberg [Thu, 13 Mar 2014 04:00:08 +0000 (21:00 -0700)]
Dont check for NFS errors in the LOOKUP during READDIRPLUS emulation
On servers with extended attributes, a server copuld be set up to
deny READ-ATTRIBUTES for the libnfs user.
This means that READDIRPLUS will no longer work since it will need to
stat() and thus READ-ATTRIBUTE in order to prepare the response.
Libnfs has READDIRPLUS emulation for the cases where this command fails
by switching to old READDIR to scan all the file names and then a LOOKUP loop for getting the file attributes.
Most of the time the purpose for this emulation is to handle the case where the server simply does not support READDIRPLUS at all, which sometimes is the case for embedded systems with userspace nfs servers.
In this case, where files just have READ-ATTRIBUTE deny for the libnfs user,
this will also fail and trigger the fallback to READDIR + LOOKUP-loop.
If the LOOKUP fails for this loop, then just ignore trying to update the attributes we have for this object, but do not fail the actual READDIRPLUS emulation.
This addresses a permissions issue reported by a XBMC user in issue #60
Spotted by clang analyzer.
This introduces another allocation to create a copy of the target path
of a rename in case it needs to be reported via rpc_set_error - it might
be a better idea to avoid the allocation and have a slightly less informative
error message?
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
Arne Redlich [Mon, 17 Feb 2014 22:22:02 +0000 (23:22 +0100)]
nfs_fchown_async: fix nullptr dereference
nfs_chown_data is hooked up under nfs_cb_data->continue_data but
no ->free_continue_data is configured, so once free_nfs_cb_data is
invoked it will trip over a nullptr.
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
Arne Redlich [Mon, 17 Feb 2014 21:17:04 +0000 (22:17 +0100)]
libnfs-raw.h: rename export -> exportname to avoid clash with C++ keyword
From http://en.cppreference.com/w/cpp/keyword/export :
Until C++11:
"Used to mark a template definition exported, which allows the same
template to be declared, but not defined, in other translation units."
Since C++11:
"The keyword is unused and reserved."
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
Arne Redlich [Thu, 13 Feb 2014 21:36:54 +0000 (22:36 +0100)]
nfs_normalize_path: fix using the results of assignments in while loops
Spotted by clang:
../../libnfs.git/lib/libnfs.c:1002:13: warning: using the result of an assignment as a condition without parentheses
[-Wparentheses]
while (str = strstr(path, "//")) {
~~~~^~~~~~~~~~~~~~~~~~~~
../../libnfs.git/lib/libnfs.c:1002:13: note: place parentheses around the assignment to silence this warning
while (str = strstr(path, "//")) {
^
( )
../../libnfs.git/lib/libnfs.c:1002:13: note: use '==' to turn this assignment into an equality comparison
while (str = strstr(path, "//")) {
^
==
Make the intent clear by adding extra parentheses, and also
remove trailing whitespace from libnfs.c while at it.
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
Ronnie Sahlberg [Sun, 2 Feb 2014 20:16:07 +0000 (12:16 -0800)]
Add support for O_TRUNC with nfs_open()
O_TRUNC will attempt to truncate the file when opened with O_RDWR
or O_WRONLY.
Normal posix open(O_RDONLY|O_TRUNC) is undefined.
libnfs nfs_open() only uses the O_TRUNC flag when used in combination with either O_RDWR or O_WRONLY.
When O_TRUNC is used together with O_RDONLY libnfs will silently ignore the O_TRUNC flag.
Libnfs nfs_open(O_RDONLY|O_TRUNC) is thus the same as nfs_open(O_RDONLY)
Ronnie Sahlberg [Sun, 2 Feb 2014 16:45:21 +0000 (08:45 -0800)]
Add a rpc_set_fd() fucntion which can be used to swap the underlying socket file descriptor
This is mainly needed when having to track and control the file descriptors that are used by libnfs, for example when trying to emulate dup2() ontop
of libnfs.
Ronnie Sahlberg [Tue, 28 Jan 2014 04:54:14 +0000 (20:54 -0800)]
Add support for chdir and getcwd
Add chdir and getcwd and store cwd in the nfs_context.
Add functions to process the paths specified and normalize them
by performing the transforms :
// -> /
/./ -> /
^/../ -> error
^[^/] -> error
/string/../ -> /
/$ -> \0
/.$ -> \0
^/..$ -> error
/string/..$ -> /
Update the path lookup function to allow specifying relative paths based on
cwd for all functions.
Ronnie Sahlberg [Tue, 28 Jan 2014 14:35:52 +0000 (06:35 -0800)]
We need the libnfs-raw-*.h files in include/Makefile.am
or else the autotools (which I dont really understand how it works)
will not install the headers.
Ronnie Sahlberg [Tue, 28 Jan 2014 04:54:14 +0000 (20:54 -0800)]
Add support for chdir and getcwd
Add chdir and getcwd and store cwd in the nfs_context.
Add functions to process the paths specified and normalize them
by performing the transforms :
// -> /
/./ -> /
^/../ -> error
^[^/] -> error
/string/../ -> /
/$ -> \0
/.$ -> \0
^/..$ -> error
/string/..$ -> /
Update the path lookup function to allow specifying relative paths based on
cwd for all functions.
Ronnie Sahlberg [Tue, 28 Jan 2014 04:47:24 +0000 (20:47 -0800)]
New version : 1.9.0
- Use _stat64 on windows so file sizes become 64bit always.
- Increase default marshalling buffer so we can marshall large PDUs.
- RPC layer support for NFSv2
- Win32 updates and fixes
- Add URL parsing functions and URL argument support.
- New utility: nfs-io
- nfs-ls enhancements
- RPC layer support for NSM
- Add example FUSE filesystem.
- Minor fixes.
Memphiz [Sun, 12 Jan 2014 13:42:56 +0000 (14:42 +0100)]
[win32] - fixed bad number casting when using libnfs on 64bit win8 systems - force the usage of struct __stat64 as its done on other platforms implicitly