Commit Graph

1082 Commits (libnfs-4.0.0-vitalif)

Author SHA1 Message Date
Vitaliy Filippov 22546a29e9 Add an opaque pointer argument to service_proc
Without this argument it's impossible to pass an object instance to procedure
callbacks which basically forces users to either use global variables or to
write additional boilerplate code and find object instances from rpc_context
pointer values.
2022-02-06 02:26:18 +03:00
Vitaliy Filippov 925d2a35ce Don't try to ZDR_DECODE strings into a pre-existing pointer
Otherwise it segfaults inside any string decoding inside rpc_process_call()
as it doesn't zero the allocated memory, so libnfs_zdr_string() may receive
non-zero *strp which is very easy to reproduce by writing a simple NFS server
example using libnfs :-)
2022-02-06 02:23:44 +03:00
Ronnie Sahlberg 030814506e new version 4.0.0
Fix the versioning in makerpms.sh
Fix some compile issues in the test programs.
NFSv3: skip commit on close if the file has not been written to.
Add nfs_umount() to NFSv3
Add nfs_statvfs64()
Fix invalid shift of pid_t when generating rpc->xid
Compile fixes for Mac OSX
Fix for dup2() on Windows
NFSv4 fix for directory handling
Improvements to configure/bulding

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2019-02-13 07:38:04 +10:00
Ronnie Sahlberg f141b31c59 Fix memory leak in nfs_close for NFSv3
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2019-02-13 07:38:04 +10:00
Ronnie Sahlberg f8b06ead8e use "git desribe --tags" in makerpms.sh
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2019-02-13 06:15:44 +10:00
Ronnie Sahlberg 9e031df11d check return for write() in one of the test tools
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2019-02-05 13:18:11 +10:00
Ronnie Sahlberg 38b62bcf87 nfsv3: skip commit if the file has not changed
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2019-01-05 06:53:33 +10:00
Ronnie Sahlberg 9e63589591 add nfs_umount() which will unregister the client from the mount daemon
This is only implemented for v3 since there is no mount protocol in v4.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-12-29 13:56:29 +10:00
Ronnie Sahlberg 56287de123 nfs_statvfs64() initialize/clear the nfs_statvs_64 structure.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-12-28 07:10:52 +10:00
Ronnie Sahlberg 48a559cb47 Add nfs_statvfs64()
Add a new function nfs_statvfs64() that returns a struct nfs_statvfs_64
where all fields are uint64_t.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-12-26 13:33:38 +10:00
Ronnie Sahlberg d21b48256e
Merge pull request #279 from david-y-lam/master
Fix invalid left-shift of pid_t type by casting to large enough type
2018-12-26 12:41:21 +10:00
David Lam 71ef9e3ee0 Fix invalid left-shift of pid_t type by casting to large enough type 2018-12-18 15:50:21 -08:00
Ronnie Sahlberg 84a4d97026
Merge pull request #275 from david-y-lam/master
Define MSG_NOSIGNAL to 0 on Mac OSX
2018-12-18 18:24:15 +10:00
David Lam b59ab34168 Define MSG_NOSIGNAL to 0 on Mac OSX 2018-12-17 23:34:53 -08:00
Ronnie Sahlberg 6dfc87d688
Merge pull request #271 from snoe925/master
Avoid redefinition of EXTERN macro
2018-10-11 05:52:16 +10:00
snoe925 f1ba956a77
Avoid redefinition of EXTERN macro
If an EXTERN macro is present then use it.
2018-10-10 10:32:31 -05:00
Ronnie Sahlberg 9454d9f4c1 Implement O_EXCL for NFSv4
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-09-15 08:42:44 +10:00
Ronnie Sahlberg 273182748d
Merge pull request #267 from hdornemann/master
fix for dup2 on windows
2018-09-14 14:40:30 +10:00
Hdornemann 6c6a640aef fix for dup2 on windows 2018-09-13 09:09:08 -04:00
Ronnie Sahlberg d86d5d1851 README: NFSv4 actually works now, update README to reflect this
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-09-04 18:12:20 +10:00
Ronnie Sahlberg 322148b016
Merge pull request #263 from pingerino/timeh
libnfs.c: include <time.h> in libnfs.c
2018-07-12 18:58:29 +10:00
Ronnie Sahlberg 2b93fcf28a Merge branch 'master' of github.com:sahlberg/libnfs 2018-07-12 18:43:47 +10:00
Ronnie Sahlberg 21e208b092 fix bug in nfsv4 opendir where it stripped off the final path component
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-07-12 18:42:44 +10:00
Anna Lyons 794a29f01f libnfs.c: include <time.h> in libnfs.c
time() is used in this file, which is from time.h. Fixes a warning.
2018-07-12 17:45:23 +10:00
Ronnie Sahlberg 3ba7c537c7
Merge pull request #261 from Polynomial-C/utils
configure.ac: fix --enable-utils
2018-07-07 18:44:31 +10:00
Lars Wendler 5a5a5c1e70
configure.ac: fix --enable-utils
Running "configure --enable-utils" _disables_ compilation/installation of
utils (and vice versa) while omitting the --(en|dis)able-utils option auto-
enables utils.
This patch fixes the logic when the option is given on command line but
keeps utils build enabled when the option was omitted.
2018-07-06 11:54:54 +02:00
Ronnie Sahlberg 37d49807ba Merge branch 'master' of github.com:sahlberg/libnfs 2018-07-03 18:58:50 +10:00
Ronnie Sahlberg 5c1444f391 conditionally include sys/time.h from libnfs.c
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-07-03 18:58:15 +10:00
Ronnie Sahlberg 9b5bb0b2f8
Merge pull request #260 from pingerino/sock_cloexec
Wrap use of SOCK_CLOEXEC with __linux__
2018-07-03 18:38:44 +10:00
Anna Lyons 118bee287c Wrap use of SOCK_CLOEXEC with __linux__
This guards against the case where your clibrary defines SOCK_CLOEXEC
but the underlying network library does not support it.
2018-07-03 09:08:22 +10:00
Ronnie Sahlberg fa6d63c936
Merge pull request #258 from pingerino/cmake-include
cmake: add include headers to libnfs
2018-06-25 12:41:39 +10:00
Anna Lyons ae6e708bf9 cmake: add include headers to libnfs
This change adds the main include dir to the include directories for
cmake such that when integrating libnfs with another project, this dir
is added to the include list.
2018-06-25 09:58:31 +10:00
Ronnie Sahlberg 695ac3b77b New version: 3.0.0
NFSv4 support.
lockf() support (NFSv4 only).
fcntl() support for locking (NFSv4 only).
Add CMake support.
URL arguments to select NFS version.
URL argument to set nfsport. This allows NFSv4 to work for
 servers without portmapper support.
URL argument to set he mount port.
NFSv4: use getpwnam to map NFSv4 (Ganesha) when passing uid/gid
 as a user/group name insead of as a uid/gid.
Added nfs-fh: a simle utility to print the filehandle for a nfs file.
Win32 build fixes.
Add a new open2() function that takes a mode argument.
Add a testsuite for libnfs.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-06-24 08:53:52 +10:00
Ronnie Sahlberg 6a33413b0f
Merge pull request #253 from Daniel-Abrecht/master
Define MSG_NOSIGNAL in windows if it doesn't exist
2018-04-30 06:24:19 +10:00
Daniel Abrecht eab4eac275 Define MSG_NOSIGNAL in windows if it doesn't exist. Windows doesn't have signals like SIGPIPE, so defining the flag as 0 is probably fine. 2018-04-29 12:02:08 +00:00
Ronnie Sahlberg 456e52507b Don't use portmapper to discover the port for NFSv4
Default to use port 2049. If server runs on a different port then
we must manually override this with the nfsport flag.
NFSv4 servers can run without any portmapper daemon at all and we
must be prepared for that.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-04-29 13:46:22 +10:00
Ronnie Sahlberg 9edb1078e6
Merge pull request #249 from shreyassiravara/nfs_opendir_cb_bug
nfs_opendir_cb should not queue a READDIR on error
2018-04-29 10:28:23 +10:00
Ronnie Sahlberg 63ba842be9
Merge pull request #252 from shreyassiravara/nfs-pagecache-export
Add & export a call to initialize the pagecache
2018-04-29 10:26:31 +10:00
Ronnie Sahlberg 40a8f13f0b
Merge pull request #250 from shreyassiravara/nfs_closedir_null
Allow nfs_closedir to accept a nullptr for the nfs context
2018-04-29 10:24:01 +10:00
Ronnie Sahlberg 9675d716ea
Merge pull request #248 from shreyassiravara/msg-nosignal
Use MSG_NOSIGNAL when calling send() to avoid SIGPIPE
2018-04-29 10:22:05 +10:00
Ronnie Sahlberg 5582eaede3
Merge pull request #247 from shreyassiravara/read-ahead-underflow
Avoid underflow in readahead when offset < NFS_BLKSIZE
2018-04-29 10:20:32 +10:00
Shreyas Siravara 1fff7707f2 Add & export a call to initialize the pagecache 2018-04-26 18:15:02 -07:00
Shreyas Siravara 286d13b4de Allow nfs_closedir to accept a nullptr for the nfs context
In the case where dircache is not enabled, we should be able to call
closedir without an nfs context.
2018-04-23 12:39:51 -07:00
Shreyas Siravara df72323c46 nfs_opendir_cb should not queue a READDIR on error
Explanation of the bug:
- nfs_opendir_cb() queues a READDIR when it receives RPC_STATUS_ERROR.
- rpc_purge_all_pdus() explicitly says that no further pdus should be
  queued when rpc_purge_all_pdus() is invoked and the outqueue is being
  cleared.
- Since nfs_opendir_cb() is called in rpc_purge_all_pdus() with
  status=RPC_STATUS_ERROR, this invariant is broken.

Fix:
- Invoke check_nfs3_error() which will invoke the appropriate
  callback with the right error.
- Disallow queueing a request in the if block
2018-04-23 12:33:29 -07:00
Shreyas Siravara e8a200483f Use MSG_NOSIGNAL when calling send() to avoid SIGPIPE 2018-04-23 12:29:59 -07:00
Shreyas Siravara 486b74f647 Avoid underflow in readahead when offset < NFS_BLKSIZE 2018-04-23 12:27:09 -07:00
Ronnie Sahlberg 8b064bf971
Merge pull request #245 from Daniel-Abrecht/move_win32_compat_header
Move win32/win32_compat.h to include/win32/win32_compat.h
2018-04-17 06:04:58 +10:00
Daniel Abrecht b3fd3ca7e4 Move win32/win32_compat.h to include/win32/win32_compat.h 2018-04-16 19:42:38 +00:00
Ronnie Sahlberg a488feedd9 Clarify status for the machine generated files
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-04-12 17:14:36 +10:00
Ronnie Sahlberg 319b0802fa Remove nfs4 licence boilerplate
and just reference the definitions come from that rfc.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-04-12 17:07:51 +10:00