Commit Graph

1194 Commits (master)

Author SHA1 Message Date
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
Ronnie Sahlberg 61584229d5
Merge pull request #243 from Daniel-Abrecht/master
The check for getpwnam wrongly succeeded on some systems
2018-04-08 17:04:39 +10:00
Ronnie Sahlberg b54fc96e00 Add nfsport/mountport arguments
Add two arguments to set which port to use for MOUNT (only used in NFSv3)
as well as for the NFS protocols.
When set to non-zero libnfs will connect directly to that port and bypass
the use of portmapper completely.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-04-08 14:36:37 +10:00
Daniel Abrecht 24ca14101f The check for getpwnam wrongly succeeded on some systems.
It didn't fail if pwd.h is missing because #includes must be seperated with a newline, a comma won't work.
The compile works anyway because the "struct passwd *pwd" implicitly declares an anonymus struct type "passwd"
and using an undeclared function is an implicit function declaration. Here's the output of configure in that case:

  configure:13381: checking whether getpwnam() is available
  configure:13396: i686-w64-mingw32-gcc -c -I/home/daniel/fsetmp/dokany/src/dokan_fuse/include/  -I/home/daniel/fsetmp/dokany/src/dokan_fuse/include/  conftest.c >&5
  conftest.c:23:23: warning: extra tokens at end of #include directive
   #include <sys/types.h>, #include <pwd.h>
                         ^
  conftest.c: In function 'main':
  conftest.c:28:30: warning: implicit declaration of function 'getpwnam' [-Wimplicit-function-declaration]
           struct passwd *pwd = getpwnam("nobody");
                                ^~~~~~~~
  conftest.c:28:30: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
  configure:13396: $? = 0
  configure:13403: result: yes
2018-04-07 16:40:44 +00:00
Ronnie Sahlberg 54405d994e don't log an error if we cailed the name to uid/gid mapping
we already convert this into "65534" anyway so there is no point in
also logging an error if we failed the name to uid/gid mapping.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-02-16 11:43:04 +10:00
Ronnie Sahlberg c23ab1637d Merge branch 'master' of github.com:sahlberg/libnfs 2018-02-16 08:27:21 +10:00
Ronnie Sahlberg c5eca214fc add conditional support for getpwnam()
Some nfsv4 servers return a user/group name in the attributes instead
of a uid/gid number. At least for the "nobody" user.

For those, try to use getpwnam() where available to map the string back
to a uid/gid or return uid/gid==65534 (common value for nobody)
if not available or failing.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-02-16 08:24:26 +10:00
Ronnie Sahlberg b16a2ec93d
Merge pull request #240 from cosmoer/master
status variable for the callback function is error
2018-02-16 07:48:10 +10:00
cosmoer 8cef36c7f3 When a function fails, its status for the callback function should be passed RPC_STATUS_ERROR,because the original status variable is RPC_STATUS_SUCCESS.
Signed-off-by: cosmoer <cosmoer@qq.com>
2018-02-03 14:50:28 +08:00
Ronnie Sahlberg ca0291022a improve error string for rpc_connect_program_async failures
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-02-02 14:23:57 +10:00
Ronnie Sahlberg 086c2ec138 improve error strings for rpc_connect_program_async() failures.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-02-01 13:28:05 +10:00
Ronnie Sahlberg f6e51c34ba
Merge pull request #236 from Daniel-Abrecht/master
Define F_RDLCK for windows builds
2018-01-14 11:21:46 +10:00
Daniel Abrecht 6f7e12bc5d Define F_RDLCK for windows builds 2018-01-13 13:39:38 +00:00
Ronnie Sahlberg 4dda1f87a4 nfsv4: add support for utime()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-01-10 17:09:14 +10:00
Ronnie Sahlberg 50068b8432 NFSv4: add support for fcntl locking
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-01-08 14:38:30 +10:00
Ronnie Sahlberg 09f8a621fb nfsv4: lock_owner is by client, not by filehandle
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-01-07 10:54:09 +10:00
Ronnie Sahlberg 208dd08039 NFSv4: add lockf emulation
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-01-07 08:35:42 +10:00
Ronnie Sahlberg f5ccc53679 add an example program that prints the NFS filehandle of a URL
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2018-01-06 03:15:22 +10:00
Ronnie Sahlberg 82b341168e
Merge pull request #233 from lnv42/master
examples/ld_nfs.c improvements
2017-11-27 09:55:45 +10:00
Yann GASCUEL 53e3c86c58 examples/ld_nfs.c: feature: faking uid and gid
add the possiblity of faking the uid and the gid in the nfs context.
uid and gid value are read from env variables LD_NFS_UID and LD_NFS_GID.
This can be useful on "insecure" enabled NFS share to make the server
trust you as a root.

Few lines added to the README to document the feature.
2017-11-26 16:24:03 +01:00
Yann GASCUEL a3b793342b examples/ld_nfs.c : add hook for chmod and chown
add hook on : __fxstatat(), __fxstatat64(), fchmodat(), fchown(),
chown(), fchownat() to support new implementation of chmod and to add
support for chown
2017-11-26 16:23:40 +01:00
Yann GASCUEL fc568809d5 examples/ld_nfs.c : fix: removing usec from fxstat
usec are not anymore supported in recent implementations of stat_t
(and they are not very usefull in that program btw)
2017-11-26 16:23:11 +01:00
Ronnie Sahlberg 7c68a3d891 Merge branch 'master' of github.com:sahlberg/libnfs 2017-10-30 08:17:36 +10:00
Ronnie Sahlberg 2fcb14cf62 Fix typo in header file
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-10-30 07:44:40 +10:00
Ronnie Sahlberg 5bc77e9ea9 Merge pull request #230 from Daniel-Abrecht/rpc_timeout_scan-queue-tail-fix
set rpc_queue tails to NULL after removing last item in rpc_timeout_scan
2017-10-15 07:00:34 +10:00
Ronnie Sahlberg 8aca95fbef Merge pull request #229 from Daniel-Abrecht/mingw-check-for-defines
Add a check if S_IRWXG is already defined
2017-10-15 06:59:47 +10:00
Daniel Abrecht 51476e50e1 rpc_timeout_scan uses the LIBNFS_LIST_REMOVE macro to remove items from rpc_queues, but doesn't set the queue.tail to NULL if every item in the queue was removed. 2017-10-14 13:46:19 +00:00
Daniel Abrecht e1c3c5f2b9 Add a check if S_IRWXG is already defined. msys2 mingw-w64 added the defines for S_IRWXG, S_IRGRP, etc. in sys/stat.h in commit f713f639f6f017371c5176f4deab07d1a92473b4 2017-10-14 13:36:04 +00:00
Ronnie Sahlberg 2911afe9d0 Merge pull request #228 from lrusak/cmake
fix copy paste error
2017-10-04 10:36:08 +10:00
Lukas Rusak 2d8ab07f24
fix copy paste error 2017-10-03 17:02:55 -07:00
Ronnie Sahlberg c516a59e91 Merge pull request #227 from lrusak/cmake
add cmake build system support
2017-10-04 07:44:41 +10:00
Lukas Rusak 7969c78291
add cmake build system support 2017-10-02 13:00:33 -07:00
Ronnie Sahlberg 3ba2a2c1fd NFSv3: Fix compiler warning
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-09-05 19:18:07 +10:00
Ronnie Sahlberg 1da019ad71 NFSv4: Fix some compiler warnings
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-09-04 08:51:20 +10:00
Ronnie Sahlberg 8489557694 NFSv4: add utimes/lutimes support
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-09-03 06:25:55 +10:00
Ronnie Sahlberg 5ebd10f54c NFSv4: Add access()/access2()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-09-03 05:43:04 +10:00
Ronnie Sahlberg 4c6d19b3b8 NFSv4: Add support for chown/lchown/fchown
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-09-02 06:42:59 +10:00
Ronnie Sahlberg 6c034223fd NFSv4: Add support for chmod/lchmod/fchmod
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-09-01 14:02:43 +10:00
Ronnie Sahlberg c7655f90ca NFSv4: Add support for statvfs()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-08-27 07:56:19 +10:00