deb_libnfs.git
10 years agoMerge pull request #72 from Memphiz/fixosxcompile
Ronnie Sahlberg [Fri, 11 Apr 2014 01:20:52 +0000 (18:20 -0700)] 
Merge pull request #72 from Memphiz/fixosxcompile

[osx] - fix compile

10 years ago[osx] - fix compile
Memphiz [Thu, 10 Apr 2014 18:31:25 +0000 (20:31 +0200)] 
[osx] - fix compile

10 years agoFix the file position handling of the read and write calls
Arne Redlich [Mon, 31 Mar 2014 21:40:26 +0000 (23:40 +0200)] 
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>
10 years agolibnfs-sync: nfs_{read,write}: use their _async counterparts internally
Arne Redlich [Mon, 31 Mar 2014 21:35:38 +0000 (23:35 +0200)] 
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>
10 years agonfs_lseek{,_async}: allow negative offsets and guard against file positions < 0
Arne Redlich [Mon, 31 Mar 2014 19:23:48 +0000 (21:23 +0200)] 
nfs_lseek{,_async}: allow negative offsets and guard against file positions < 0

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
10 years agoRPM: Fix the specfile
Ronnie Sahlberg [Sun, 23 Mar 2014 16:54:21 +0000 (09:54 -0700)] 
RPM: Fix the specfile

10 years agoINCLUDES: Don't install libnfs-provate.h or slist.h
Ronnie Sahlberg [Sun, 23 Mar 2014 16:54:05 +0000 (09:54 -0700)] 
INCLUDES: Don't install libnfs-provate.h or slist.h

10 years agoAUTOTOOLS: Add Makefile.am to utils
Ronnie Sahlberg [Sun, 23 Mar 2014 16:18:31 +0000 (09:18 -0700)] 
AUTOTOOLS: Add Makefile.am to utils

10 years agoSPECFILE: Fix syntax error in the spec file
Ronnie Sahlberg [Sun, 23 Mar 2014 16:18:13 +0000 (09:18 -0700)] 
SPECFILE: Fix syntax error in the spec file

10 years agoNFS-LS: Build nfs-ls as utils and make it install under bin
Ronnie Sahlberg [Sat, 22 Mar 2014 01:31:05 +0000 (18:31 -0700)] 
NFS-LS: Build nfs-ls as utils and make it install under bin

10 years agoDOC: Add manpage for nfs-ls
Ronnie Sahlberg [Sat, 22 Mar 2014 01:15:40 +0000 (18:15 -0700)] 
DOC: Add manpage for nfs-ls

10 years agoexamples/Makefile.am Remove stuff we do not need
Ronnie Sahlberg [Sat, 22 Mar 2014 00:33:14 +0000 (17:33 -0700)] 
examples/Makefile.am Remove stuff we do not need

10 years agoPORTMAP: Add some comments about the origin of definitions
Ronnie Sahlberg [Fri, 21 Mar 2014 00:32:19 +0000 (17:32 -0700)] 
PORTMAP: Add some comments about the origin of definitions

10 years agonfs_normalize_path: don't strip trailing slash from "/"
Arne Redlich [Sun, 9 Mar 2014 20:55:42 +0000 (21:55 +0100)] 
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>
10 years agonfs_opendir2_cb: plug potential memory leak
Arne Redlich [Tue, 18 Feb 2014 20:07:46 +0000 (21:07 +0100)] 
nfs_opendir2_cb: plug potential memory leak

Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
10 years agoPORTMAP client: Pass length as sockaddr_storage, not sockaddr_in6
Ronnie Sahlberg [Wed, 19 Mar 2014 03:31:17 +0000 (20:31 -0700)] 
PORTMAP client: Pass length as sockaddr_storage, not sockaddr_in6

10 years agoPORTMAP client: Parse and print the actual sockaddr that UADDR2TADDR returned
Ronnie Sahlberg [Wed, 19 Mar 2014 03:27:14 +0000 (20:27 -0700)] 
PORTMAP client: Parse and print the actual sockaddr that UADDR2TADDR returned

10 years agoIPV6: Update the README and specify ipv6 is supported
Ronnie Sahlberg [Wed, 19 Mar 2014 01:59:48 +0000 (18:59 -0700)] 
IPV6: Update the README and specify ipv6 is supported

10 years agoPORTMAP client: Add commands to send v3 SET/UNSET
Ronnie Sahlberg [Tue, 18 Mar 2014 13:56:12 +0000 (06:56 -0700)] 
PORTMAP client: Add commands to send v3 SET/UNSET

10 years agoPORTMAP: Rename pmap3_getaddr_result to pmap3_string_result
Ronnie Sahlberg [Tue, 18 Mar 2014 04:29:32 +0000 (21:29 -0700)] 
PORTMAP: Rename pmap3_getaddr_result to pmap3_string_result

10 years agoPORTMAP: Add support for v3 TADDR2UADDR
Ronnie Sahlberg [Tue, 18 Mar 2014 04:20:12 +0000 (21:20 -0700)] 
PORTMAP: Add support for v3 TADDR2UADDR

10 years agoPORTMAP: Add PMAP v3 UADDR2TADDR support
Ronnie Sahlberg [Tue, 18 Mar 2014 04:05:18 +0000 (21:05 -0700)] 
PORTMAP: Add PMAP v3 UADDR2TADDR support

10 years agoPORTMAP: Add support for PORTMAP v3 CALLIT
Ronnie Sahlberg [Tue, 18 Mar 2014 03:19:03 +0000 (20:19 -0700)] 
PORTMAP: Add support for PORTMAP v3 CALLIT

10 years agoPORTMAP: Add v3 GETTIME support
Ronnie Sahlberg [Tue, 18 Mar 2014 02:58:48 +0000 (19:58 -0700)] 
PORTMAP: Add v3 GETTIME support

10 years agoIPv6: If we use IPv6 then we need to use PMAP v3 GETADDR
Ronnie Sahlberg [Mon, 17 Mar 2014 00:48:35 +0000 (17:48 -0700)] 
IPv6: If we use IPv6 then we need to use PMAP v3 GETADDR

10 years agoPORTMAP: Add support for SET UNSET procedures
Ronnie Sahlberg [Sun, 16 Mar 2014 23:37:33 +0000 (16:37 -0700)] 
PORTMAP: Add support for SET UNSET procedures

10 years agoPORTMAP: Add support for PORTMAP v3 GETADDR
Ronnie Sahlberg [Sun, 16 Mar 2014 23:28:08 +0000 (16:28 -0700)] 
PORTMAP: Add support for PORTMAP v3 GETADDR

10 years agoPORTMAPv3: Add NULL and DUMP commands. Also add portmap example client.
Ronnie Sahlberg [Sun, 16 Mar 2014 23:03:19 +0000 (16:03 -0700)] 
PORTMAPv3: Add NULL and DUMP commands. Also add portmap example client.

10 years agoGETEXPORT: Use rpc_connect_program_async() flow during list exports
Ronnie Sahlberg [Sun, 16 Mar 2014 22:06:56 +0000 (15:06 -0700)] 
GETEXPORT: Use rpc_connect_program_async() flow during list exports

and get rid of several now redundant callbacks.

10 years agoRPC_CONNECT: Use the rpc_connect_program_async() flow during nfs_mount()
Ronnie Sahlberg [Sun, 16 Mar 2014 22:00:19 +0000 (15:00 -0700)] 
RPC_CONNECT:  Use the rpc_connect_program_async() flow during nfs_mount()

10 years agoPORTMAP: Rename the functions in PMAP to PMAP2 to desribe the version of PMAP we...
Ronnie Sahlberg [Sun, 16 Mar 2014 21:34:32 +0000 (14:34 -0700)] 
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.

10 years agoIPV6: Add basic IPv6 support
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

10 years agoNew version: 1.9.3
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?

10 years agoMerge pull request #69 from plieven/for-1.9.3
Ronnie Sahlberg [Tue, 18 Mar 2014 19:30:40 +0000 (12:30 -0700)] 
Merge pull request #69 from plieven/for-1.9.3

nfs_{pread,pwrite}_async: fix oom handling and comments

10 years agonfs_{pread,pwrite}_async: fix oom handling and comments
Peter Lieven [Tue, 18 Mar 2014 19:08:33 +0000 (20:08 +0100)] 
nfs_{pread,pwrite}_async: fix oom handling and comments

Signed-off-by: Peter Lieven <pl@kamp.de>
10 years agoMerge pull request #68 from plieven/for-1.9.3
Ronnie Sahlberg [Mon, 17 Mar 2014 17:29:43 +0000 (10:29 -0700)] 
Merge pull request #68 from plieven/for-1.9.3

examples/nfs-ls: fix summary output

10 years agoexamples/nfs-ls: fix summary output
Peter Lieven [Mon, 17 Mar 2014 17:05:15 +0000 (18:05 +0100)] 
examples/nfs-ls: fix summary output

Signed-off-by: Peter Lieven <pl@kamp.de>
10 years agoPORTMAP: Add support for V3 DUMP command
Ronnie Sahlberg [Sun, 16 Mar 2014 21:15:34 +0000 (14:15 -0700)] 
PORTMAP: Add support for V3 DUMP command

This implements the missing procedure from Issue #65

10 years agoMerge pull request #67 from plieven/for-1.9.3
Ronnie Sahlberg [Sun, 16 Mar 2014 20:43:04 +0000 (13:43 -0700)] 
Merge pull request #67 from plieven/for-1.9.3

For 1.9.3

10 years ago{pread,pwrite}_async: fix potential segfault in out of memory condition
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.

Signed-off-by: Peter Lieven <pl@kamp.de>
10 years agonfs_pread_async: handle short reads
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).

Signed-off-by: Peter Lieven <pl@kamp.de>
10 years agonfs_pwrite_async: handle short writes
Peter Lieven [Sat, 15 Mar 2014 15:22:03 +0000 (16:22 +0100)] 
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>
10 years agofix possible wrong cast to 32-bit unsigned
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.

Signed-off-by: Peter Lieven <pl@kamp.de>
10 years agointroduce nfs_fill_{READ,WRITE}3args
Peter Lieven [Sat, 15 Mar 2014 16:05:44 +0000 (17:05 +0100)] 
introduce nfs_fill_{READ,WRITE}3args

Signed-off-by: Peter Lieven <pl@kamp.de>
10 years agofix potential overflow in nfs_pread_mcb
Peter Lieven [Sat, 15 Mar 2014 13:20:29 +0000 (14:20 +0100)] 
fix potential overflow in nfs_pread_mcb

Signed-off-by: Peter Lieven <pl@kamp.de>
10 years agoImprove error messages when READDIRPLUS emulation fails.
Ronnie Sahlberg [Thu, 13 Mar 2014 13:30:31 +0000 (06:30 -0700)] 
Improve error messages when READDIRPLUS emulation fails.

This addresses issue #62

10 years agoDont check for NFS errors in the LOOKUP during READDIRPLUS emulation
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

10 years agoSet default uid/gid to 65534/nobody for ANDROID
Ronnie Sahlberg [Thu, 13 Mar 2014 02:31:20 +0000 (19:31 -0700)] 
Set default uid/gid to 65534/nobody for ANDROID

10 years agoWe only need to spend CPU computing a new error string IFF there was an error
Ronnie Sahlberg [Wed, 12 Mar 2014 12:54:38 +0000 (05:54 -0700)] 
We only need to spend CPU computing a new error string IFF there was an error
when unmarshalling the reply.

10 years agoImprove error reporting when unmarshalling of message headers fail.
Ronnie Sahlberg [Wed, 12 Mar 2014 01:52:48 +0000 (18:52 -0700)] 
Improve error reporting when unmarshalling of message headers fail.

10 years agoAdd a new nfs_stat64() function that operates on a always-64-bit stat structure
Ronnie Sahlberg [Wed, 5 Mar 2014 03:40:05 +0000 (19:40 -0800)] 
Add a new nfs_stat64() function that operates on a always-64-bit stat structure

10 years agonfs_pread_async: plug potential memleaks
Arne Redlich [Tue, 18 Feb 2014 19:56:24 +0000 (20:56 +0100)] 
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>
10 years agonfs_write_async: plug potential memory leaks
Arne Redlich [Tue, 18 Feb 2014 19:51:36 +0000 (20:51 +0100)] 
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>
10 years agorpc_read_from_socket: fix use-after-free due to missing return
Arne Redlich [Tue, 18 Feb 2014 19:22:11 +0000 (20:22 +0100)] 
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>
10 years agosocket.c: fix format string issues (too few arguments)
Arne Redlich [Mon, 17 Feb 2014 23:42:14 +0000 (00:42 +0100)] 
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>
10 years ago{nfs,rpc}_set_error: add __attribute__((format(printf))) annotations
Arne Redlich [Mon, 17 Feb 2014 23:41:05 +0000 (00:41 +0100)] 
{nfs,rpc}_set_error: add __attribute__((format(printf))) annotations

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
10 years agonfs_rename_continue_1_internal: fix use-after-free
Arne Redlich [Mon, 17 Feb 2014 23:32:10 +0000 (00:32 +0100)] 
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>
10 years agonfs_unlink_async: plug potential memory leak
Arne Redlich [Mon, 17 Feb 2014 23:22:45 +0000 (00:22 +0100)] 
nfs_unlink_async: plug potential memory leak

Spotted by clang analyzer

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
10 years agonfs_rmdir_async: fix potential memory leak
Arne Redlich [Mon, 17 Feb 2014 23:20:59 +0000 (00:20 +0100)] 
nfs_rmdir_async: fix potential memory leak

Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
10 years agonfs_mkdir_async: fix potential memory leak
Arne Redlich [Mon, 17 Feb 2014 23:19:23 +0000 (00:19 +0100)] 
nfs_mkdir_async: fix potential memory leak

Pointed out by clang analyzer

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
10 years agonfs_mknod_async: fix use-after-free
Arne Redlich [Mon, 17 Feb 2014 22:53:38 +0000 (23:53 +0100)] 
nfs_mknod_async: fix use-after-free

Spotted by clang analyzer

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
10 years agonfs_fchown_async: fix use-after-free
Arne Redlich [Mon, 17 Feb 2014 22:51:48 +0000 (23:51 +0100)] 
nfs_fchown_async: fix use-after-free

Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
10 years agonfs_fchmod_async: fix use-after-free
Arne Redlich [Mon, 17 Feb 2014 22:50:17 +0000 (23:50 +0100)] 
nfs_fchmod_async: fix use-after-free

Spotted by clang analyzer

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
10 years agonfs_opendir2_cb: plug potential memleaks
Arne Redlich [Mon, 17 Feb 2014 22:42:42 +0000 (23:42 +0100)] 
nfs_opendir2_cb: plug potential memleaks

Spotted by clang analyzer

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
10 years agofree_nfs_cb_data: make static and drop superfluous nullptr checks / assignments
Arne Redlich [Mon, 17 Feb 2014 22:34:18 +0000 (23:34 +0100)] 
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>
10 years agofree_nfs_cb_data: add assert(data->free_continue_data)
Arne Redlich [Mon, 17 Feb 2014 22:29:07 +0000 (23:29 +0100)] 
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>
10 years agonfs_fchown_async: fix nullptr dereference
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>
10 years agonfs_fchown_async: plug potential memleak
Arne Redlich [Mon, 17 Feb 2014 22:17:15 +0000 (23:17 +0100)] 
nfs_fchown_async: plug potential memleak

Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
10 years agonfs_creat_async: plug potential memleak
Arne Redlich [Mon, 17 Feb 2014 22:11:59 +0000 (23:11 +0100)] 
nfs_creat_async: plug potential memleak

Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
10 years agonfs_mknod_async: plug potential memory leak
Arne Redlich [Mon, 17 Feb 2014 22:09:31 +0000 (23:09 +0100)] 
nfs_mknod_async: plug potential memory leak

Pointed out by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
10 years agonfs_lookuppath_async: plug potential memleak
Arne Redlich [Mon, 17 Feb 2014 22:06:32 +0000 (23:06 +0100)] 
nfs_lookuppath_async: plug potential memleak

Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
10 years agonfs_opendir_cb: plug potential memory leak
Arne Redlich [Mon, 17 Feb 2014 21:44:47 +0000 (22:44 +0100)] 
nfs_opendir_cb: plug potential memory leak

Spotted by clang analyzer.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
10 years agolibnfs-raw.h: rename export -> exportname to avoid clash with C++ keyword
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>
10 years agolibnfs.h: wrap in extern "C" for C++ compatibility
Arne Redlich [Sun, 16 Feb 2014 20:36:17 +0000 (21:36 +0100)] 
libnfs.h: wrap in extern "C" for C++ compatibility

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
10 years agonfs_normalize_path: fix using the results of assignments in while loops
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>
10 years agolibnfs-zdr.h: wrap in extern "C" for C++ compatibility
Arne Redlich [Thu, 13 Feb 2014 21:29:11 +0000 (22:29 +0100)] 
libnfs-zdr.h: wrap in extern "C" for C++ compatibility

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
10 years agolibnfs-raw.h: wrap in extern "C" for C++ compatibility
Arne Redlich [Thu, 13 Feb 2014 21:28:54 +0000 (22:28 +0100)] 
libnfs-raw.h: wrap in extern "C" for C++ compatibility

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
10 years agolibnfs-private.h: wrap in extern "C" for C++ compatibility
Arne Redlich [Thu, 13 Feb 2014 21:27:57 +0000 (22:27 +0100)] 
libnfs-private.h: wrap in extern "C" for C++ compatibility

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
10 years agoslist.h: add include guards
Arne Redlich [Thu, 13 Feb 2014 21:20:00 +0000 (22:20 +0100)] 
slist.h: add include guards

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
10 years agolibnfs-private.h: add include guards
Arne Redlich [Thu, 13 Feb 2014 21:19:51 +0000 (22:19 +0100)] 
libnfs-private.h: add include guards

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
10 years agolibnfs-raw.h: remove trailing whitespace
Arne Redlich [Thu, 13 Feb 2014 21:17:31 +0000 (22:17 +0100)] 
libnfs-raw.h: remove trailing whitespace

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
10 years agolibnfs.h: add include guards
Arne Redlich [Thu, 13 Feb 2014 21:17:20 +0000 (22:17 +0100)] 
libnfs.h: add include guards

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
10 years agoChange license for the ld preload hack to gplv3
Ronnie Sahlberg [Wed, 12 Feb 2014 02:36:24 +0000 (18:36 -0800)] 
Change license for the ld preload hack to gplv3

10 years agoAdd a simple LD_PRELOAD toy to make cat and cp nfs-aware
Ronnie Sahlberg [Mon, 3 Feb 2014 02:03:50 +0000 (18:03 -0800)] 
Add a simple LD_PRELOAD toy to make cat and cp nfs-aware

10 years agoWe need to pass a filehandle back for open(O_TRUNC) or else the app will
Ronnie Sahlberg [Mon, 3 Feb 2014 01:39:04 +0000 (17:39 -0800)] 
We need to pass a filehandle back for open(O_TRUNC) or else the app will
be unhappy

10 years agoAdd support for O_TRUNC with nfs_open()
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)

10 years agoRename the nfs_open() argument from mode to flags
Ronnie Sahlberg [Sun, 2 Feb 2014 19:41:22 +0000 (11:41 -0800)] 
Rename the nfs_open() argument from mode to flags

10 years agoAdd a rpc_set_fd() fucntion which can be used to swap the underlying socket file...
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.

10 years agoEmpty paths are no longer an error. Translate it to '.' instead.
Ronnie Sahlberg [Sat, 1 Feb 2014 16:03:12 +0000 (08:03 -0800)] 
Empty paths are no longer an error. Translate it to '.' instead.

10 years agoAdd support for chdir and getcwd
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.

10 years agoRemove chdir changes for now. Needs more testing.
Ronnie Sahlberg [Fri, 31 Jan 2014 02:30:25 +0000 (18:30 -0800)] 
Remove chdir changes for now. Needs more testing.

10 years agoRevert "Add support for chdir and getcwd"
Ronnie Sahlberg [Fri, 31 Jan 2014 02:26:39 +0000 (18:26 -0800)] 
Revert "Add support for chdir and getcwd"

This reverts commit fb6f315257a8752c3a8b96a71261a5613a6f2069.

10 years agoNew version 1.9.1
Ronnie Sahlberg [Tue, 28 Jan 2014 14:41:31 +0000 (06:41 -0800)] 
New version  1.9.1

Add back the libnfs-raw-*.h headers to make install

10 years agoWe need the libnfs-raw-*.h files in include/Makefile.am
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.

10 years agoAdd support for chdir and getcwd
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.

10 years agoNew version : 1.9.0
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.

10 years agoMerge pull request #50 from asgeirn/master
Ronnie Sahlberg [Thu, 16 Jan 2014 14:25:35 +0000 (06:25 -0800)] 
Merge pull request #50 from asgeirn/master

Fixed SPEC file to work with Red Hat 6.3 x64.

10 years agoFixed SPEC file to work with Red Hat 6.3 x64.
Asgeir Storesund Nilsen [Thu, 16 Jan 2014 10:03:14 +0000 (10:03 +0000)] 
Fixed SPEC file to work with Red Hat 6.3 x64.

10 years agoMerge pull request #49 from Memphiz/win32fix4
Ronnie Sahlberg [Tue, 14 Jan 2014 02:14:19 +0000 (18:14 -0800)] 
Merge pull request #49 from Memphiz/win32fix4

Win32fix4

10 years ago[win32] - fix comilation by removing a unused "int i;" - though i have no
Memphiz [Mon, 13 Jan 2014 18:52:58 +0000 (19:52 +0100)] 
[win32] - fix comilation by removing a unused "int i;" - though i have no
clue why this fails with "';' missing before 'Typ'"