Commit Graph

135 Commits (master)

Author SHA1 Message Date
Vitaliy Filippov 45430b3c38 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:29:39 +03:00
Ronnie Sahlberg 29b4cea00f multithreading: make nfs_get_error() work for multithreaded applications
This mostly consists of creating one slave nfs_context  for each nfs
thread to track the error-string.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2022-01-28 10:38:32 +10:00
Ronnie Sahlberg efa9085cfa add support for nfsv3 getacl
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-12-31 11:42:48 +10:00
Ronnie Sahlberg c851f458a0 multithreading: fix race for waking blocked worker threads
We must make sure that we prepare and process all the returned data
before we wake the thread that is waiting for the i/o to complete
or else we will have a race between waking the thread and copying
the returned data in the service thread.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-12-31 08:28:20 +10:00
Ronnie Sahlberg f55637619e initial pthread support
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-10-14 16:31:26 +10:00
Ronnie Sahlberg 965b1914ef Allow setting max read/write size from the api
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-08-10 16:29:42 +10:00
Ronnie Sahlberg cdb377532a acl: add support and helpers to read nfsv4 acls
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-07-17 20:11:56 +10:00
Ronnie Sahlberg 1cdc8657de nfs-io: stat, print sStT bits properly
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2021-07-17 20:11:46 +10:00
Dirk Meister 1336b5280e Fix NFS4 behavior of chmod/chown/utimes
This patch fixes various issues around chmod/chown/utimes:
- The chmod/chown/utimes approach uses open_async_internal, which only works
  for files. This patch uses lookup_path so that chmod/chown is also
  possible on directories.
- Implements SET_TO_SERVER for utimes

I never succeeded in getting all tests passing even without
these changes. Nor did I succeed in getting the CMake compilation to
work. Sorry. The patch includes extra unit tests for these calls.
We use the libary as part of a test harness to test an NFS server
implementation, so I am reasonably confident that the changes work.
They are also manually tested against the Linux Kernel NFS Server.
2020-05-18 20:50:01 -07:00
crusader-mike 6564abaa1f fixed CMake build on windows, few trivial fixes 2019-09-12 15:07:35 -05: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
Daniel Abrecht b3fd3ca7e4 Move win32/win32_compat.h to include/win32/win32_compat.h 2018-04-16 19:42:38 +00: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
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
Lukas Rusak 7969c78291
add cmake build system support 2017-10-02 13:00:33 -07:00
Ronnie Sahlberg 24064e96d2 Add example util for nfs_link()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2017-05-02 17:36:27 -07:00
Ronnie Sahlberg 0a4f9cd8a8 EXAMPLE: nfs4-cat-talloc
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-12-17 17:42:35 -08:00
Ronnie Sahlberg 85aca36e02 EXAMPLE: portmapper server
Example showing how to build a RPC server using libnfs.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-12-17 10:44:12 -08:00
Ronnie Sahlberg 2cffb48c9d Add PMAP2 UNSET support to the portmapper client
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-12-17 10:44:12 -08:00
Ronnie Sahlberg 34926e9d94 Add support for PMAP2 SET operation to the portmapper client
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-12-17 10:44:12 -08:00
Ronnie Sahlberg 6d397028ba EXAMPLE: Add nfs4-cat example
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-12-17 10:44:12 -08:00
Ronnie Sahlberg 4cc09b972a Fix crash in nfs_truncate due to dereference of uninitialized data
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-06-21 19:25:27 -07:00
Ronnie Sahlberg b3c4106022 Add win32 magics to example programs
Some examples lack win32 socket magic. Add it.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-04-27 19:32:16 -07:00
Diego Elio Pettenò 6b5b09dbc1 build: avoid abusing AM_LDFLAGS.
This fixes build with options such as --as-needed that require correct positional argument passing. They also ensure that the right dependency library is used.
2016-01-08 23:43:06 +01:00
Jean-Baptiste Kempf 3ca22dcfdd Win32: Add win32_compat.h include 2016-01-08 23:23:00 +01:00
Ronnie Sahlberg dc8d86628d Remove FUSE NFS filesystem
Remove the fuse module from the examples subdirectory.
This module is now a standalone repo :
https://github.com/sahlberg/fuse-nfs

And it comes with proper build rules, documentation etc etc.
It is a useful module and it has now graduated to become its own
repo.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-10-19 18:59:38 -07:00
Alexander Graf 883f660430 fuse_nfs: Add fsync
Libnfs already has exports for fsync, hook them up to the fuse example.

Signed-off-by: Alexander Graf <agraf@suse.de>
2015-09-11 11:24:47 +02:00
Alexander Graf 9439361243 fuse_nfs: Add truncate
Libnfs already has exports for truncate, hook them up to the fuse example.

Signed-off-by: Alexander Graf <agraf@suse.de>
2015-09-11 11:24:09 +02:00
Alexander Graf b66121610d fuse_nfs: Add chown
Libnfs already has exports for chown, hook them up to the fuse example.

Signed-off-by: Alexander Graf <agraf@suse.de>
2015-09-11 11:23:35 +02:00
Alexander Graf 315112b923 fuse_nfs: Add chmod
Libnfs already has exports for chmod, hook them up to the fuse example.

Signed-off-by: Alexander Graf <agraf@suse.de>
2015-09-11 11:23:03 +02:00
Alexander Graf d1709ab573 fuse_nfs: Add link
Libnfs already has exports for link, hook them up to the fuse example.

Signed-off-by: Alexander Graf <agraf@suse.de>
2015-09-11 11:22:29 +02:00
Alexander Graf 37fd16ee08 fuse_nfs: Add rename
Libnfs already has exports for rename, hook them up to the fuse example.

Signed-off-by: Alexander Graf <agraf@suse.de>
2015-09-11 11:21:31 +02:00
Alexander Graf 50aabd0729 fuse_nfs: Add symlink
Libnfs already has exports for symlink, hook them up to the fuse example.

Signed-off-by: Alexander Graf <agraf@suse.de>
2015-09-11 11:20:49 +02:00
Alexander Graf 618b6ea030 fuse_nfs: Add mknod
Libnfs already has exports for mknod, hook them up to the fuse example.

Signed-off-by: Alexander Graf <agraf@suse.de>
2015-09-11 11:19:52 +02:00
Alexander Graf 39d1f3693c fuse_nfs: Add symlink support
The fuse framework allows us to directly expose symlinks from NFS to the user,
just like a real NFS mount would. All we need to do is call lstat rather
than stat and implement a readlink function.

With this patch I can successfully chroot into a rootfs mounted using
fuse_nfs.

Signed-off-by: Alexander Graf <agraf@suse.de>
2015-09-11 00:23:48 +02:00
Alexander Graf e81f9e23ab fuse_nfs: Consider st_.tim as struct timespec
At least in my version of glibc the members st_mtim, st_ctim and st_atim
are defined as struct timespec rather than struct timeval, thus
containing a tv_nsec field rather than tv_usec.

Use the proper struct fields instead, fixing compilation on Linux.

Signed-off-by: Alexander Graf <agraf@suse.de>
2015-09-11 00:22:09 +02:00
Peter Lieven beaa838637 fix some compiler warnings
Signed-off-by: Peter Lieven <pl@kamp.de>
2015-06-19 13:49:17 +02:00
Ronnie Sahlberg 08ea9a3138 UTILS: move nfs-cp from examples to utils
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-05-24 07:50:43 -07:00
Ronnie Sahlberg ec3a3afeae EXAMPLES: convert remaining nfs_[f]stat to nfs_[f]stat64
The old nfs_[f]stat calls are deprecated. Convert to the newer
nfs_[f]stat64 call that takes struct nfs_stat_64

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-05-24 07:38:17 -07:00
Ronnie Sahlberg 6f2727468d FUSE: use nfs_stat64() not nfs_stat()
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2015-05-24 07:19:01 -07:00
Alexander Graf a5042b9857 fuse_nfs: Disable multithreading
If we blindly spawn new threads based on existing open NFS shares, all
threads will concurrently still run on the same file descriptors for NFS
traffic, colliding sooner or later.

This is what happens with the fuse-nfs example program. To steer us back
into safety, we can just tell fuse to not do multi-threading which this
patch does.

This patch fixes random connection aborts with fuse_nfs for me.

Signed-off-by: Alexander Graf <agraf@suse.de>
2015-02-15 01:49:23 +01:00
Marlies Heijkoop 7e967f4de2 Print usage when missing mandatory arguments 2014-08-16 16:38:25 +02:00
Marlies Heijkoop 6a88df2924 Fix usage message to match expected arguments 2014-08-16 16:26:17 +02:00
Ronnie Sahlberg 2db42ce2fc ZDR: remove dependency on zdr.h from the examples and nfs-ls
Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
2014-07-05 12:44:18 -07:00
Ronnie Sahlberg c7ddf2e5cb NFS-LS: Build nfs-ls as utils and make it install under bin 2014-03-21 18:31:05 -07:00
Ronnie Sahlberg a562a7f5fb examples/Makefile.am Remove stuff we do not need 2014-03-21 17:33:14 -07:00
Ronnie Sahlberg 1f8134ebe4 PORTMAP client: Pass length as sockaddr_storage, not sockaddr_in6 2014-03-19 18:25:50 -07:00
Ronnie Sahlberg ea20b4ec24 PORTMAP client: Parse and print the actual sockaddr that UADDR2TADDR returned 2014-03-19 18:25:50 -07:00