Commit Graph

382 Commits (49eaca0c42a15e1053355af4c96a4bee11cd4be3)

Author SHA1 Message Date
Ronnie Sahlberg 080d231129 New version 1.9.6
- Add O_TRUNC support for nfs_create
 - Handle OOM during create
 - Return more stats fields as part of readdir since we get these for "free"
   when we use READDIRPLUS
 - Follow symlinks during path resolution
 - Add lchown, lstat and lutimes
 - Replace all [u_]quad types with [u]int types in our RPC layer
 - Solaris build fixes

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-11-25 06:47:55 -08:00
Ross Lagerwall 23b10e1f18 libnfs: Add access2()
Add nfs_access2(), like nfs_access() but it returns the individual
statuses of R_OK, W_OK and X_OK rather than a single success or failure
status.  This saves the latency and overhead of multiple lookups if an
application tries to determine the status of each of R_OK, W_OK and
X_OK.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-09-14 15:41:04 +01:00
Ross Lagerwall c50173cf0d libnfs: Give correct access() results for directories
Map ACCESS3_{MODIFY,EXTEND,DELETE} to W_OK and ACCESS3_{LOOKUP,EXECUTE}
to X_OK so that nfs_access() gives sensible results for directories.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-09-14 15:38:57 +01:00
Ronnie Sahlberg bce63d849c types: remove the [u_]quad type and replace with [u]int64
All current platforms have a quad type that maps to a 64bit scalar.
But there are platforms where quad maps to a 64bit non-scalar.

Replace quad with int64 in the protocol definitions and the ZDR layer
so that these fields will map to a 64 bit scalar also on those platforms
where quad can not be used.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-08-16 14:51:53 -07:00
Ronnie Sahlberg cc3e372de4 socket.c: we need netinet/in.h on some platforms 2014-08-14 18:56:39 -07:00
Ronnie Sahlberg a8c840e834 Merge pull request #97 from rosslagerwall/read-close-crash
libnfs: Don't perform operations on nfsfh after user callback
2014-08-11 06:15:16 -07:00
Mike Frysinger e48cfe9622 fix implicit decls of rpc_{g,s}et_error
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2014-08-11 06:08:33 -07:00
Mike Frysinger 8d4559dc14 fix typo in chmod funcs
These were accidentally calling chown instead of chmod.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2014-08-11 06:08:33 -07:00
Mike Frysinger 10a1a78115 fix implicit decl warnings
Include the proper headers to fix warnings like:
libnfs-sync.c:1529:3: warning: implicit declaration of function 'gettimeofday' [-Wimplicit-function-declaration]
libnfs-zdr.c:506:2: warning: implicit declaration of function 'getuid' [-Wimplicit-function-declaration]

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

sys/time.h needs to be protected with an ifdef

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-08-11 06:08:05 -07:00
Ross Lagerwall 9cac8a6340 libnfs: Don't perform operations on nfsfh after user callback
Since the user callback may perform operations on the nfsfh (e.g. it
might close it), all updates should be done before the user callback is
called.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-08-10 12:18:56 +01:00
Ross Lagerwall 408cd870b8 libnfs: Fix segfault if O_TRUNC fails when creating
Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-08-07 20:45:42 +01:00
Ross Lagerwall 8d59066720 libnfs: Add lchmod
Add lchmod which is like chmod but operates on the symbolic link itself
if the destination is a symbolic link.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-07-27 21:26:54 +01:00
Ross Lagerwall 6505b53967 libnfs: Add lutimes
Add lutimes which is like utimes but operates on the symbolic link
itself if the destination is a symbolic link.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-07-27 21:26:54 +01:00
Ross Lagerwall bf769f960d libnfs: Add lstat
Add lstat which is like stat but operates on the symbolic link itself if
the destination is a symbolic link.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-07-27 21:26:54 +01:00
Ross Lagerwall 5935a28a0e libnfs: Add lchown
Add lchown which is like chown but operates on the symbolic link itself
if the destination is a symbolic link.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-07-27 21:26:54 +01:00
Ross Lagerwall 1d15199152 libnfs.c: Follow symlinks during path resolution
Follow symlinks during path resolution.  If the symlink points outside
the mount, -ENOENT is returned.  This is slightly different behavior
from the in-kernel NFS client where symlinks pointing outside the mount
get resolved to local paths.

The algorithm for symlink resolution is simple and stupid.  If a symlink
is encountered, the path is rewritten and path resolution begins again
from the root filehandle.  A count is kept to prevent loops.  This is
not particularly efficient but it is good enough for now.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-07-27 21:24:17 +01:00
Ross Lagerwall c4d5f5b874 libnfs.c: Fix a warning
Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-07-27 21:22:34 +01:00
Ronnie Sahlberg 42f916635d Merge pull request #90 from rosslagerwall/stat-improvements
Stat improvements
2014-07-23 17:30:13 -07:00
Ross Lagerwall 3e020c15fd libnfs: Add fstat64, analagous to stat64
Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-07-20 23:13:16 +01:00
Ross Lagerwall fc08ac459c libnfs: Set as much stat information as possible
Set as much stat information as possible for stat, stat64, fstat and
readdir.

Fill in dev to the given fsid.
Fill in rdev to the given major and minor numbers.
Set the file type bits in the mode from the type returned by the server.
Set the number of blocks used based on the number of bytes used in
blocks of size 512 (which is what stat(2) uses), rounded up.
Fill in the nanosecond timestamps.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-07-20 22:06:34 +01:00
Ross Lagerwall ece11036ff libnfs.c: Handle OOM condition
Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-07-20 08:13:45 +01:00
Ross Lagerwall 370c59e351 libnfs.c: Support use of O_TRUNC with nfs_create
Simplify usage for application programmers by supporting the use of
O_TRUNC with nfs_create.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-07-20 08:08:39 +01:00
Ronnie Sahlberg 8dea7c3e2d Merge pull request #88 from rosslagerwall/76-no-autoreconnect
libnfs.c: Fix autoreconnect
2014-07-19 16:01:13 -07:00
Ronnie Sahlberg fda800dc02 Merge pull request #86 from rosslagerwall/75-create
libnfs.c: add nfs_create
2014-07-19 15:58:30 -07:00
Ronnie Sahlberg e591967437 Merge pull request #87 from rbalint/master
Use sockaddr_in6 on FreeBSD
2014-07-19 15:56:59 -07:00
Ronnie Sahlberg b9e5039f49 New version 1.9.5
This version removes old ONC-RPC symbols and automatically includes the
RPC/ZDR layer include from the raw low level headers.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-07-19 15:47:35 -07:00
Petr Salinger 18c94b4633 Use sockaddr_in6 instead of sockaddr6_in 2014-07-19 18:07:13 +02:00
Ross Lagerwall 28ee9de2e4 libnfs.c: Fix autoreconnect
Since rpc_connect_async sets autoreconnect to 0, turn autoreconnect on
after the connection has completed, not before.

This fixes #76.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
2014-07-19 11:35:23 +01:00
Ross Lagerwall 037a1061dd libnfs.c: add nfs_create
Add a new family of functions, nfs_create, like nfs_creat but takes an
additional flags argument which allows extra flags like O_SYNC, O_EXCL
and O_APPEND to be specified.
2014-07-17 22:32:09 +01:00
Ronnie Sahlberg 3c769bb1bd New version 1.9.4
New version of libnfs:

- IPv6 support
- Support for Portmapper version 3 and an example portmap client.
- Directory caching top make repeated opendir() calls faster
- Readahead support
- Build manpages for the utilities (==nfs-ls)
- Support for O_APPEND
- Rename the list macros to avoid collission on *BSD

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-06-29 14:57:45 -07:00
Ronnie Sahlberg 07d06b250c libnfs.c: Change the directory cache to a smaller more reasonable value
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-06-29 14:42:28 -07:00
Ronnie Sahlberg be243cfa9b Merge pull request #82 from plieven/readahead
add readahead support
2014-06-29 14:41:28 -07:00
Peter Lieven 3ca2aac9a4 add readahead support
This patch add support for an internal readahead machanism. The maximum readahead
size can be specified via URL parameter readahead. This should significantly
speed up small sequential reads.

Signed-off-by: Peter Lieven <pl@kamp.de>
2014-06-23 16:31:32 +02:00
Ronnie Sahlberg 390ff38ad1 libnfs.c: add nlink to nfsdirent so we can get it for 'free'
update the nfs-ls utility to just use nfsdirent as is instead of having to
stat the files.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-06-08 11:40:35 -07:00
Ronnie Sahlberg 56e96539ef libnfs.c: add a simple dircache to libnfs
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-06-08 11:24:18 -07:00
Ronnie Sahlberg 20379f03fc libnfs.c: always pass the attributes to the callback for recursive lookups
Always pass a fattr3 structure to the callbacks for the internal function
to perform recursive lookups : nfs_lookuppath_async().
This will allow us to access for example the mtime for an object before we
start performing any expensive functions.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-06-08 11:24:09 -07:00
Ronnie Sahlberg f0888d12d9 init.c: fixup the mangled lgplv2.1 boilerplate
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-06-08 07:34:54 -07:00
Ronnie Sahlberg 1a6ec3ee76 init.c: use list macro when removing pdus from the wait list
Use the macro when removing the pdus in the wait list from the queues.
Also make sure to remove them from the right queue, from waitqueue and not
the outqueue for PDUs we have already sent out.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-06-08 07:21:43 -07:00
Peter Lieven 7a750aea1c socket: fix broken connect for non broadcast traffic
commit 1c1e09a completely broke connects for non broadcast
traffic since it forgot to copy the server address into
the socket_storage struct.

Signed-off-by: Peter Lieven <pl@kamp.de>
2014-06-08 14:20:12 +02:00
Ronnie Sahlberg 8a52596b74 slist.h: Change SLIST_* to LIBNFS_LIST_* to avoid name clash on *BSD
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-05-14 19:11:03 -07:00
Ronnie Sahlberg 548e2bea4b nfs_open: add support for O_APPEND 2014-04-18 09:32:01 -07:00
Ronnie Sahlberg a87bb233a8 Merge branch 'xid-hash' 2014-04-10 19:59:28 -07:00
Ronnie Sahlberg 0275da678b Merge pull request #71 from Memphiz/nolinger
[socket] - disable linger by setting SO_LINGER to 0 seconds
2014-04-10 18:21:13 -07:00
Memphiz bd2f43c8a6 [osx] - fix compile 2014-04-10 20:35:44 +02:00
Memphiz 74b037ec46 [socket] - disable linger by setting SO_LINGER to 0 seconds 2014-04-10 20:34:11 +02:00
Arne Redlich 567a94d937 Fix the file position handling of the read and write calls
Since the interface is modelled after the libc calls we should try to match
their behaviour to avoid unpleasant surprises:
* read / write (sync and async flavours) update the file position
* pread / pwrite (sync and async flavours) do not update the file position
.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-04-03 18:05:32 -07:00
Arne Redlich 9e6ac3d4ee libnfs-sync: nfs_{read,write}: use their _async counterparts internally
Previously nfs_read and nfs_write used to use nfs_pread and nfs_pwrite respectively.
In preparation of getting the file position handling right this has to be detangled.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-04-03 18:04:41 -07:00
Arne Redlich 1f1b6cb0a7 nfs_lseek{,_async}: allow negative offsets and guard against file positions < 0
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-04-03 18:03:21 -07:00
Mark Hills 63f36a0923 Track waiting requests in a hash table, by xid
NFS servers can respond to requests in any order, and they do. In our
tests there is also some clustering to the responses; it could be
because eg. requests are served synchronously if the data is in the cache.

Introduce a hash table so that we are able to find the pdu quickly in
all cases, assuming random distribution of the responses.
2014-04-03 17:52:21 -07:00
Mark Hills d46c3d622b Ensure the next pointer is correct
Fixes a bug where the next pointer was not being explicitly set. We
were ok much of the time due to zero-filled memory, and also we need
this if the same pdu is re-queued.
2014-04-03 17:51:56 -07:00
Mark Hills aec45c6274 Optimisations to the pdu queues
When making many concurrent requests (as is likely in any performance
criticial application), the use of SLIST_REMOVE and SLIST_ADD_END are
a severe bottleneck because of their linear search.

I considered using a double-linked list but it was unnecessary to
allocate the additional memory for each list entry.

Instead, continue to use a single-linked list but retain:

* a pointer to the end of the list; and
* a pointer to the previous entry during a linear search.

The former would makes append operations O(1) time, and the latter
does the same for removal. We can do this because removal only happens
within the linear search, and there is no random access to the queue.
2014-04-03 17:51:04 -07:00
Arne Redlich d5f7880641 nfs_normalize_path: don't strip trailing slash from "/"
Otherwise end up with a null string which is not permitted (RFC 1813, 3.2;
the code checks for it right after the now fixed nullification of "/").

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-03-20 16:58:32 -07:00
Arne Redlich b644665077 nfs_opendir2_cb: plug potential memory leak
Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-03-20 16:52:53 -07:00
Ronnie Sahlberg 24f45c5452 PORTMAP: Rename pmap3_getaddr_result to pmap3_string_result 2014-03-19 18:25:50 -07:00
Ronnie Sahlberg 29258a73c0 PORTMAP: Add support for v3 TADDR2UADDR 2014-03-19 18:25:50 -07:00
Ronnie Sahlberg 729266a796 PORTMAP: Add PMAP v3 UADDR2TADDR support 2014-03-19 18:25:50 -07:00
Ronnie Sahlberg b71f7e8291 PORTMAP: Add support for PORTMAP v3 CALLIT 2014-03-19 18:25:50 -07:00
Ronnie Sahlberg 5245608a65 PORTMAP: Add v3 GETTIME support 2014-03-19 18:25:50 -07:00
Ronnie Sahlberg 6c60e2822f IPv6: If we use IPv6 then we need to use PMAP v3 GETADDR 2014-03-19 18:25:50 -07:00
Ronnie Sahlberg 7fbedfdefd PORTMAP: Add support for PORTMAP v3 GETADDR 2014-03-19 18:25:50 -07:00
Ronnie Sahlberg 2a32a899ca GETEXPORT: Use rpc_connect_program_async() flow during list exports
and get rid of several now redundant callbacks.
2014-03-19 18:25:50 -07:00
Ronnie Sahlberg f694a287ae RPC_CONNECT: Use the rpc_connect_program_async() flow during nfs_mount() 2014-03-19 18:25:50 -07:00
Ronnie Sahlberg 0f0e352f49 PORTMAP: Rename the functions in PMAP to PMAP2 to desribe the version of PMAP we use.
Future patches will add PMAP3 which we will need for IPv6 support.
2014-03-19 18:25:49 -07:00
Ronnie Sahlberg 1c1e09ad51 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
2014-03-19 18:25:49 -07:00
Ronnie Sahlberg 7058971155 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?
2014-03-19 18:12:45 -07:00
Ronnie Sahlberg c44c3ff364 Merge pull request #69 from plieven/for-1.9.3
nfs_{pread,pwrite}_async: fix oom handling and comments
2014-03-18 12:30:40 -07:00
Peter Lieven 40a4373ab8 nfs_{pread,pwrite}_async: fix oom handling and comments
Signed-off-by: Peter Lieven <pl@kamp.de>
2014-03-18 20:08:33 +01:00
Ronnie Sahlberg 8ae943f608 PORTMAP: Add support for V3 DUMP command
This implements the missing procedure from Issue #65
2014-03-16 14:17:06 -07:00
Peter Lieven ae8168b3eb {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.

Signed-off-by: Peter Lieven <pl@kamp.de>
2014-03-16 20:16:07 +01:00
Peter Lieven 1eb4be3150 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).

Signed-off-by: Peter Lieven <pl@kamp.de>
2014-03-16 20:15:48 +01:00
Peter Lieven 027a767eca nfs_pwrite_async: handle short writes
the RFC allows the server to write less bytes than requested.
this patch implements a reissue logic for the reminder of the
write request(s).

Signed-off-by: Peter Lieven <pl@kamp.de>
2014-03-16 20:07:59 +01:00
Peter Lieven d485997ad3 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.

Signed-off-by: Peter Lieven <pl@kamp.de>
2014-03-16 20:07:52 +01:00
Peter Lieven 2449d3f787 introduce nfs_fill_{READ,WRITE}3args
Signed-off-by: Peter Lieven <pl@kamp.de>
2014-03-16 20:07:44 +01:00
Peter Lieven 4d2f9f1132 fix potential overflow in nfs_pread_mcb
Signed-off-by: Peter Lieven <pl@kamp.de>
2014-03-16 20:07:39 +01:00
Ronnie Sahlberg 9a9566a3ee Improve error messages when READDIRPLUS emulation fails.
This addresses issue #62
2014-03-13 06:30:31 -07:00
Ronnie Sahlberg f66ff9931d 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
2014-03-12 21:00:08 -07:00
Ronnie Sahlberg 3af0c02237 Set default uid/gid to 65534/nobody for ANDROID 2014-03-12 19:31:20 -07:00
Ronnie Sahlberg b25c3aedde We only need to spend CPU computing a new error string IFF there was an error
when unmarshalling the reply.
2014-03-12 05:54:38 -07:00
Ronnie Sahlberg f0cb804219 Improve error reporting when unmarshalling of message headers fail. 2014-03-11 18:52:48 -07:00
Ronnie Sahlberg 479302f729 Add a new nfs_stat64() function that operates on a always-64-bit stat structure 2014-03-04 19:40:05 -08:00
Arne Redlich c8f0bac1bb nfs_pread_async: plug potential memleaks
Spotted by clang analyzer.

This also introduces asserts to help clang analyzer avoid reporting
false positives.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 19:00:47 -08:00
Arne Redlich 63d4a0583d nfs_write_async: plug potential memory leaks
Spotted by clang analyzer.

This also introduces asserts to help clang analyzer avoid
reporting false positives.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 19:00:19 -08:00
Arne Redlich 60af7e19d1 rpc_read_from_socket: fix use-after-free due to missing return
Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:59:44 -08:00
Arne Redlich 8907aea9eb socket.c: fix format string issues (too few arguments)
These were uncovered by the previously added __attribute__((format(printf))).

Emacs also removed trailing whitespace while at it.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:59:17 -08:00
Arne Redlich 766bb4af75 nfs_rename_continue_1_internal: fix use-after-free
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>
2014-02-19 18:58:02 -08:00
Arne Redlich bcbb21cdbb nfs_unlink_async: plug potential memory leak
Spotted by clang analyzer

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:57:28 -08:00
Arne Redlich 2257433dd4 nfs_rmdir_async: fix potential memory leak
Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:55:42 -08:00
Arne Redlich b1a197f5b2 nfs_mkdir_async: fix potential memory leak
Pointed out by clang analyzer

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:55:22 -08:00
Arne Redlich ecc656491a nfs_mknod_async: fix use-after-free
Spotted by clang analyzer

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:54:58 -08:00
Arne Redlich b41762c0d8 nfs_fchown_async: fix use-after-free
Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:54:37 -08:00
Arne Redlich faa15589f1 nfs_fchmod_async: fix use-after-free
Spotted by clang analyzer

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:53:22 -08:00
Arne Redlich a26bebefce nfs_opendir2_cb: plug potential memleaks
Spotted by clang analyzer

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:52:34 -08:00
Arne Redlich 2fa14f9b97 free_nfs_cb_data: make static and drop superfluous nullptr checks / assignments
free() can cope with nullptrs and there's no point in null-ing free'd members
as the containing struct is free'd as well.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:52:05 -08:00
Arne Redlich 206a2ff644 free_nfs_cb_data: add assert(data->free_continue_data)
Non-debug builds will trip over the nullptr too - do we rather
want to leak the memory there?

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:50:09 -08:00
Arne Redlich 6b1f14ca01 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>
2014-02-19 18:49:03 -08:00
Arne Redlich b6619d88e6 nfs_fchown_async: plug potential memleak
Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:47:50 -08:00
Arne Redlich a128749648 nfs_creat_async: plug potential memleak
Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:47:27 -08:00
Arne Redlich feb2fc2f92 nfs_mknod_async: plug potential memory leak
Pointed out by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:47:02 -08:00
Arne Redlich e59193c9f9 nfs_lookuppath_async: plug potential memleak
Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:46:09 -08:00
Arne Redlich b2fc5c54d9 nfs_opendir_cb: plug potential memory leak
Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2014-02-19 18:45:33 -08:00