Arne Redlich
4b1ae88abb
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>
2014-02-19 18:41:34 -08:00
Ronnie Sahlberg
be7b4360ac
We need to pass a filehandle back for open(O_TRUNC) or else the app will
...
be unhappy
2014-02-02 17:39:04 -08:00
Ronnie Sahlberg
22a0f15bee
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)
2014-02-02 12:16:07 -08:00
Ronnie Sahlberg
3cea44dc54
Rename the nfs_open() argument from mode to flags
2014-02-02 11:41:22 -08:00
Ronnie Sahlberg
6ec481d3fa
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.
2014-02-02 08:45:21 -08:00
Ronnie Sahlberg
34edf264dc
Empty paths are no longer an error. Translate it to '.' instead.
2014-02-01 08:03:12 -08:00
Ronnie Sahlberg
f893b680f2
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.
2014-01-30 20:06:57 -08:00
Ronnie Sahlberg
0a63cc7258
Remove chdir changes for now. Needs more testing.
2014-01-30 18:30:25 -08:00
Ronnie Sahlberg
0df47959c4
Revert "Add support for chdir and getcwd"
...
This reverts commit fb6f315257
.
2014-01-30 18:26:39 -08:00
Ronnie Sahlberg
1d95217b2f
New version 1.9.1
...
Add back the libnfs-raw-*.h headers to make install
2014-01-28 06:41:31 -08:00
Ronnie Sahlberg
fb6f315257
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.
2014-01-27 20:54:59 -08:00
Ronnie Sahlberg
5392b1cfbc
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.
2014-01-27 20:47:24 -08:00
Ronnie Sahlberg
ecbd14a153
Make sure cookie is initialized before we use it.
2014-01-13 06:36:38 -08:00
Ronnie Sahlberg
9180287b27
Export the three new nfs_set_* functions from the windows library/dll
2014-01-13 06:30:43 -08:00
Peter Lieven
d43a8953f5
make adjustments for v6 of the qemu NFS driver
...
Signed-off-by: Peter Lieven <pl@kamp.de>
2014-01-13 11:22:21 +01:00
Ronnie Sahlberg
c9cc77a538
Merge pull request #47 from Memphiz/win32fix3
...
[win32] - fixed bad number casting when using libnfs on 64bit win8 syste...
2014-01-12 15:18:59 -08:00
Memphiz
be184101ca
[win32] - fixed bad number casting when using libnfs on 64bit win8 systems - force the usage of struct __stat64 as its done on other platforms implicitly
2014-01-12 14:42:56 +01:00
Maxim Koltsov
5581436f5f
Adjust Makefile.am's to support out-of-source builds
2014-01-08 12:36:09 +04:00
Ronnie Sahlberg
7bda8bad00
Add uid/gid to the stat data returned in the readdir directoryentry
...
We also get uid/gid for free when using READDIRPLU3 (and READDIRPLUS3 emulation)
so store these too so applications that needs to look at the uid/gid can avoid
the extra call to nfs_stat()
2013-12-31 16:25:01 -08:00
Ronnie Sahlberg
2452c57f9b
Assign the whole nfs_fh3 structure instead of element by element when possible
2013-12-31 16:11:11 -08:00
Ronnie Sahlberg
1a5b83c98c
Change rpc_nfs_readdirplus to rpc_nfs3_readdirplus
2013-12-31 15:58:59 -08:00
Ronnie Sahlberg
a64a16a2e9
Change rpc_nfs_readdir to rpc_nfs3_readir
2013-12-31 15:53:40 -08:00
Ronnie Sahlberg
7cd23ccc67
Change rpc_nfs_readlink to rpc_nfs3_readlink
2013-12-31 15:46:32 -08:00
Ronnie Sahlberg
87f81c853a
Change rpc_nfs_symlink to rpc_nfs3_symlink
2013-12-31 15:44:15 -08:00
Ronnie Sahlberg
560f94344d
Chane rpc_nfs_link to rpc_nfs3_link
2013-12-31 15:43:00 -08:00
Ronnie Sahlberg
5940c705a6
Change rpc_nfs_rename to rpc_nfs3_rename
2013-12-31 15:37:40 -08:00
Ronnie Sahlberg
b17cb0a255
Change rpc_nfs_mknod to rpc_nfs3_mknod
2013-12-31 15:33:36 -08:00
Ronnie Sahlberg
a0a5aa26f1
Change rpc_nfs_remove to rpc_nfs3_remove
2013-12-31 15:23:44 -08:00
Ronnie Sahlberg
789c3f1205
Change rpc_nfs_create to rpc_nfs3_create
2013-12-31 15:21:20 -08:00
Ronnie Sahlberg
bf817ee694
Change rpc_nfs_rmdir to rpc_nfs3_rmdir
2013-12-31 15:20:28 -08:00
Ronnie Sahlberg
acabd6bf14
Change rpc_nfs_mkdir to rpc_nfs3_mkdir
2013-12-31 15:17:16 -08:00
Ronnie Sahlberg
1a5636ffa7
Change rpc_nfs_commit to rpc_nfs3_commit
2013-12-31 15:16:02 -08:00
Ronnie Sahlberg
b701254d40
Change rpc_nfs_setattr to rpc_nfs3_setattr
2013-12-31 15:12:32 -08:00
Ronnie Sahlberg
0249c17be0
Change all calls to rpc_nfs_fsstat to rpc_nfs3_fsstat
2013-12-31 15:08:11 -08:00
Ronnie Sahlberg
c4ba61c51c
Change all calls to rpc_nfs_fsinfo to rpc_nfs3_fsinfo
2013-12-31 15:06:25 -08:00
Ronnie Sahlberg
8aab33e33c
Merge pull request #44 from plieven/master
...
fix 3 flaws detected by valgrind and bump version to intermediate version
2013-12-26 11:00:04 -08:00
Ronnie Sahlberg
3f30ac7800
Create SOCURRENT/SOREVISION/SOAGE in lib/Makefile.am
2013-12-26 10:52:43 -08:00
Ronnie Sahlberg
dc3ed8c3ab
Fix some compiler warnings and bugs
...
Add missing %s to two example programs and fix incorrect argument to
rpc_nfs3_fsinfo_async()
2013-12-26 10:40:37 -08:00
Ronnie Sahlberg
eda77ec3f3
Change rpc_mount_* to rpc_mount3_* and make it explicit which version of
...
the protocol we are using.
2013-12-26 09:11:05 -08:00
Ronnie Sahlberg
20d6926ed6
Change rpc_set_context_args to nfs_set_context_args and make it static
...
It only makes sense to pass url arguments to an nfs URL and thus a nfs context.
While some arguments may apply to the underlying raw rpc context (uid, gid,
tcp settings etc) some future arguments may need to apply to the nfs context
instead, such as selecting nfs version, whether or not to force sync writes
etc.
2013-12-26 09:08:26 -08:00
Peter Lieven
b70567b62c
nfs_parse_url: initialize memory
...
the urls struct was accidently left unitialized.
Signed-off-by: Peter Lieven <pl@kamp.de>
2013-12-26 12:48:21 +01:00
Peter Lieven
1f1b1c5c93
nfs_parse_url_incomplete: fix use after free in param parsing
...
if no server is specified flagsp points into urls->server.
Signed-off-by: Peter Lieven <pl@kamp.de>
2013-12-26 10:43:15 +01:00
Ronnie Sahlberg
36f488dc7a
Create a new function rpc_set_context_args where we parse and set the context
...
arguments.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2013-12-25 16:57:52 -08:00
Ronnie Sahlberg
b2a4b99ee9
Add the url parsing functions to libnfs-win32.def
2013-12-25 16:29:00 -08:00
Ronnie Sahlberg
6d89ace041
Merge pull request #43 from plieven/master
...
URL parsing functions and minor fixes + enhancements
2013-12-25 16:11:29 -08:00
Ronnie Sahlberg
35280fd7a4
Grow the marshalling buffer from 64k to 1M so we can marshall really large WRITE3s
2013-12-24 13:03:50 -08:00
Ronnie Sahlberg
04e9034165
MOUNT: Add RPC support for MOUNTv1
2013-12-24 12:20:41 -08:00
Ronnie Sahlberg
f38aacf8c9
Add NFSv2 RPC support
2013-12-24 11:28:56 -08:00
Ronnie Sahlberg
463d59bf8e
NFS: Add new function signatures for rpc_nfs3_ that takes *3args arguments
...
to match the XDR.
Leave the existing ad-hoc rpc_nfs_* functions for backward compatibility.
2013-12-24 11:16:21 -08:00
Ronnie Sahlberg
21668dcef4
Add missing symbols to libnfs-win32.def and make them EXTERN
2013-12-24 08:54:28 -08:00
Peter Lieven
6bdcd5b676
examples: add nfs-io example
...
this simple example tool allows to
- creat and unlink files
- mkdir and rmdir directories
- stat
Signed-off-by: Peter Lieven <pl@kamp.de>
2013-12-23 14:50:09 +01:00
Peter Lieven
9126c9c036
add uid and gid URL param to specify alternate uid and/or gid
...
This allows to connect with an alternate uid or gid than that
of the current user.
Example:
examples/nfs-ls nfs://10.0.0.1/export?uid=1000&gid=33
Signed-off-by: Peter Lieven <pl@kamp.de>
2013-12-23 14:03:26 +01:00
Peter Lieven
1c8b4547ce
add tcp-syncnt URL param to adjust TCP_SYNCNT sockopt
...
This allows indirect support for a configurable connect timeout.
Linux uses a exponential backoff for SYN retries starting
with 1 second.
This means for a value n for TCP_SYNCNT, the connect will
effectively timeout after 2^(n+1)-1 seconds.
Example:
examples/nfs-ls nfs://10.0.0.1/export?tcp-syncnt=1
Signed-off-by: Peter Lieven <pl@kamp.de>
2013-12-23 14:03:18 +01:00
Peter Lieven
d2ec73c75a
add URL parsing functions
...
this adds the following 4 functions. see libnfs.h for details.
struct nfs_url *nfs_parse_url_full(struct nfs_context *nfs, char *url);
struct nfs_url *nfs_parse_url_dir(struct nfs_context *nfs, char *url);
struct nfs_url *nfs_parse_url_incomplete(struct nfs_context *nfs, char *url);
void nfs_destroy_url(struct nfs_url *url);
Signed-off-by: Peter Lieven <pl@kamp.de>
2013-12-23 14:03:00 +01:00
Peter Lieven
1f3f0d5853
libnfs_zdr_opaque: make valgrind happy
...
valgrind complains about unitialized memory
Signed-off-by: Peter Lieven <pl@kamp.de>
2013-12-23 12:46:31 +01:00
Peter Lieven
fadbf8cf56
nfs_creat1_cb: fix memleak
...
data is not freed in case of a failure.
Signed-off-by: Peter Lieven <pl@kamp.de>
2013-12-17 11:50:00 +01:00
Peter Lieven
b554c8e8d2
libnfs_authunix_create: make valgrind happy
...
valgrind complains about uninitialized memory.
Signed-off-by: Peter Lieven <pl@kamp.de>
2013-12-17 11:47:59 +01:00
Ronnie Sahlberg
ed09b5676f
Initial support for NSM
2013-11-05 17:37:16 -08:00
Ronnie Sahlberg
558aefc736
New version 1.8
...
Fix nasty memory leak
2013-10-30 18:17:49 -07:00
Ronnie Sahlberg
751770fd43
Dont leak every single buffer we read from the socket.
2013-10-30 18:15:03 -07:00
Ronnie Sahlberg
8733f38d23
Add an async helper function to connect an rpc context to a program/version
2013-10-26 13:16:09 -07:00
Ronnie Sahlberg
3b943d2f68
Add a mechanism to control what the next XID value on a session will be.
...
This makes it possible for multiple processes/contexts to use the same
target and (with some synchronization) avoid XID collissions across processes/contexts.
2013-10-26 07:44:29 -07:00
Ronnie Sahlberg
6fda9871a0
Mix in the pid in the top 16 bits for the initial xid.
...
This helps for users which rapidly fork a lot of processes that then
immediately create a new context (I am looking at you dbench)
to awoid having lots of processes starting and using overlapping xid values.
2013-10-25 16:16:43 -07:00
Ronnie Sahlberg
e7f3a78172
Don't clamp write3 max to 32k
...
We use our own XDR and RPC layer nowadays and do not have
any external dependencies to XDR or RPC.
As such we no longer need to clamp the write size to max 32kb
since we never link to the system rpc/xdr libraries.
(and thus dont have to clamp in case the system library is broken for
pdu's > 32k)
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2013-10-23 19:18:41 -07:00
Volker Lendecke
cd67ec7d6b
Fix typos
2013-10-23 19:13:00 -07:00
Ronnie Sahlberg
b93082da2b
Make xid be a uint32_t and not either unsigned long or unsigned int
2013-10-21 19:15:11 -07:00
Ronnie Sahlberg
31820d2727
New version 1.7
...
- Allow nested eventloops so that a sync function can be called from a callback.
- Fix a bug in unmarshalling a uint64.
- Add PATHCONF support.
- WIN32/64 updates
- AROS updates
2013-10-20 16:31:32 -07:00
Ronnie Sahlberg
dd97d43aad
Reset the receive buffer processing the received PDU.
...
This allows us to have recursive eventloops and do synchronous
rpc calls from a callback.
2013-10-20 13:16:45 -07:00
Ronnie Sahlberg
c81e7d8921
Make sure the the value is unsigned before we OR it into the uint64_t
...
or else the sign might be extended.
2013-10-20 12:41:56 -07:00
Ronnie Sahlberg
7e66b28947
Merge branch 'master' of github.com:sahlberg/libnfs
2013-05-30 17:59:24 -07:00
Ronnie Sahlberg
4e019b25b5
On Windows, use 65534/65534 instead of 65535/65535 for the default uid/gid
2013-05-30 17:58:29 -07:00
Memphiz
292e2d9097
[win32] - add projects for examples to the solution and make them compile (all compile but nfsclient-bcast)
2013-05-29 18:41:31 +02:00
Ronnie Sahlberg
c5e346e15c
More AROS fixes. AROS compiles and works again.
2013-05-28 22:49:19 -07:00
Ronnie Sahlberg
0556ee05e1
Aros fixes
2013-05-28 22:41:54 -07:00
Ronnie Sahlberg
265276038a
AROS fixes
2013-05-28 22:13:08 -07:00
Ronnie Sahlberg
c022471e52
Add configure test for arpa/inet.h
2013-05-28 21:25:08 -07:00
Ronnie Sahlberg
833d5b9da1
Include ifdef cleanup
2013-05-28 21:20:00 -07:00
Ronnie Sahlberg
bff8fe460d
Some more configure checks for headers
2013-05-28 17:54:12 -07:00
Ronnie Sahlberg
7057e733c1
Add configure checks for sys/socket.h
2013-05-28 17:43:47 -07:00
Ronnie Sahlberg
728970051c
Add configure checks for whether netinet/in.h is available or not
2013-05-28 17:38:37 -07:00
Ronnie Sahlberg
cb5b8be2eb
Try making the initial port used a little more random
2013-05-28 17:22:28 -07:00
Ronnie Sahlberg
67a9f57e67
WIN32 fixes
2013-05-28 16:15:16 -07:00
Ronnie Sahlberg
a60caa0945
New version 1.6
...
Add AROS/Amiga support
Chose initial XID value better to reduce probability for collissions
Fix bug in the initial default credentials and use getgid() instead of -1
2013-05-27 21:35:26 -07:00
Ronnie Sahlberg
43e0e7a7e6
On unix systems, when creating the default authentication token
...
use getgid() as the group instead of -1.
Recent linux knfsd do not allow grp==-1
On windows there are no uid/gids in the traditional sense so there I still specify a default credential of uid==gid==-1 :
rpc->auth = authunix_create("LibNFS", 65535, 65535, 0, NULL);
This is I think the sanest/safest thing to do since most servers will have
special handing of -1 meaning 'nobody' or similar.
This should work on many/most servers and give the user the minimum available
access allowed for 'nobody'.
I think on windows (or AROS for that matter) applications will probably have
to invoke and set the credentials themself explicitely.
Those apps probably, unfortunately, also need to have a configuration
setting to select which uid/gid to use when talking to the server.
(or they could hardcode it)
rpc_set_auth(rpc, libnfs_authunix_create("hostname", uid, gid, 0, NULL))
should do the trick if they call immediately after creating the rpc/nfs context.
But dont set it to 0,0 root/root for uid/gid.
First of all, most servers have root-squash so they will re-map this uid/gid
to 'nobody' internally.
But, if the user uses a server that does not do root-squash, then setting this to 0,0 would mean that your app now access the nfs share as root which is probably not what you want.
2013-05-25 06:24:15 -07:00
Ronnie Sahlberg
0c1a9d7a6b
Fix a bug when returning the filehandle in creat() and return the filehandle
...
of the object we created and not the filehandle of the parent directory
2013-04-15 21:37:03 -07:00
Ronnie Sahlberg
73f4ae7cca
Allow nfs_lookuppath_async to have path[0]=='\0' this happens when we
...
want to create an object straight under the root directory of what we
mounted.
As always, the actual object to create is then a string starting after the \0 byte
2013-04-15 20:42:44 -07:00
Ronnie Sahlberg
4945f30750
we can always include netinet/in.h all platforms have it
2013-04-14 10:34:33 -07:00
Ronnie Sahlberg
108c622a95
more include cleanups it starts to look almost decent now
2013-04-14 10:32:01 -07:00
Ronnie Sahlberg
00748f36c5
more header include cleanups
2013-04-14 10:11:48 -07:00
Ronnie Sahlberg
2142af5d47
WIN32: More ifdef cleanups
2013-04-14 09:02:23 -07:00
Ronnie Sahlberg
622489d36e
WIN32: get rid of some ifdefs
2013-04-14 08:50:38 -07:00
Ronnie Sahlberg
099be710b6
SOCKET: Use recv/send for all socket io on all platforms
...
instead of only on windows and aros and read/write on the others
2013-04-14 08:43:59 -07:00
Ronnie Sahlberg
9a9126c3d9
AROS: add inet_pton emulation and make sure we use recv/send and not read/write
2013-04-13 07:40:46 -07:00
Ronnie Sahlberg
2cdf4fcb07
AROS: it is called IoctlSocket/CloseSocket and WaitSelect on AROS.
...
Additionally add a aros_init_socket() function to open the bsd socket library and set up networking
2013-04-12 06:12:58 -07:00
Ronnie Sahlberg
e77d093c37
AROS: getting closer to link. only a handful of missing symbols now
2013-04-11 18:37:05 -07:00
Ronnie Sahlberg
d7c6e9aaa9
Initial AROS support.
...
The test app doesnt link yet since we are missing a bunch of symbols
but it is a start
2013-04-10 20:28:40 -07:00
Steve Cai
a27561934c
randomize the initial rpc xid to avoid reply cache collision
2013-02-25 16:40:29 -08:00
Ronnie Sahlberg
8afcdc959f
New version 1.5
...
- Switch to our own builtin RPC/XDR replacement
- Android support
2012-12-03 06:38:18 -08:00
Ronnie Sahlberg
e803ae5760
Rearrange the header files.
...
Move the headers we install to ./include/nfsc
and start including nfsc/libnfs-zdr.h from all the other header files.
2012-11-28 20:21:53 -08:00
Cory Fields
252aa90dc8
[droid] Support building for android
...
These are the changes necessary to build for android. Working status is yet
untested.
2012-11-28 12:04:10 -05:00
Ronnie Sahlberg
f816bf4c76
Merge branch 'zdr'
...
Manually fixyp some merge conflicts in :
lib/init.c
lib/pdu.c
lib/socket.c
nfs/Makefile.am
nfs/nfs.x
nlm/Makefile.am
2012-11-27 18:22:27 -08:00
Ronnie Sahlberg
aab6538bbd
Implement 'rejected_reply' and switch to RFC5531 definitions
...
Switch to using fields and names from RFC5531. that is the standard
for RPC.
2012-11-26 19:42:10 -08:00
Ronnie Sahlberg
dedc4675ba
New version 1.4
...
- Add trackig of freed context and assert on using a context after it has been
freed.
- Windows x64 support and fixes.
- Switch to using our own version of xdr_int64() since the one in libtirpc
crashes on some platforms.
- Fix memory leak in an error path for addrinfo.
- Fix bug dereferencing a null pointer in the mount callback on error.
2012-11-25 07:57:40 -08:00
Ronnie Sahlberg
5f08d03e16
ZDR_ARRAYS: The sub-unmarshaller returns TRUE FALSE if there was an error, not TRUE
2012-11-24 09:01:00 -08:00
Ronnie Sahlberg
f3a7507806
Add an assert to track if we try to use an rpc_context after it has been destroyed
2012-11-24 08:18:54 -08:00
Ronnie Sahlberg
2811861b96
Dont leak addrinfo in error path
2012-11-24 08:14:12 -08:00
Ronnie Sahlberg
9b6d106414
MOUNT: when processing the mount response, check status before dereferencing data pointer
...
If status is non-zero in the mount callback, then the datapointer might be NULL
so we should not dereference it into an exports pointer before we have checked the status.
This would otherwise cause crashes.
2012-11-24 08:13:46 -08:00
Rudi Ihle
456c0b147a
Fixed errno processing for connect() on Windows.
2012-11-24 08:12:45 -08:00
Rudi Ihle
2521374f70
Modified mechanism to assign privileged ports and enable it for Windows as well
2012-11-24 08:12:31 -08:00
Ronnie Sahlberg
4a2b08768a
Add an assert to track if we try to use an rpc_context after it has been destroyed
2012-11-21 17:10:05 -08:00
Ronnie Sahlberg
be7f59339e
Dont leak addrinfo in error path
2012-11-17 10:14:19 -08:00
Ronnie Sahlberg
5ac848e908
MOUNT: when processing the mount response, check status before dereferencing data pointer
...
If status is non-zero in the mount callback, then the datapointer might be NULL
so we should not dereference it into an exports pointer before we have checked the status.
This would otherwise cause crashes.
2012-11-04 15:55:05 -08:00
Rudi Ihle
f96b24fada
Fixed errno processing for connect() on Windows.
2012-09-18 08:33:41 +02:00
Rudi Ihle
ac559609a3
Modified mechanism to assign privileged ports and enable it for Windows as well
2012-09-18 08:32:40 +02:00
Ronnie Sahlberg
b14062764e
ZDR: we need to include both arpa/inet.h and time.h
2012-07-05 21:17:45 +10:00
Ronnie Sahlberg
442b829a05
Dont just cast *enum_t to *uint32_t
...
go via a temporary variable in case these scalars are different size
2012-07-05 21:13:04 +10:00
Ronnie Sahlberg
67ba2239cb
Get rid of AUTH completely and replace all uses with 'struct AUTH'
2012-07-05 10:23:19 +10:00
Ronnie Sahlberg
45670bd0d6
fix compiler warnings
2012-07-05 07:37:37 +10:00
Ronnie Sahlberg
020f172895
fix compiler warning
2012-07-05 07:35:04 +10:00
Ronnie Sahlberg
d14e28387f
squelch compiler warnings in socket.c about integer sizes
2012-07-05 07:21:48 +10:00
Ronnie Sahlberg
574095b960
Change a size variable from uint64 to uint32 to squelch a warning
2012-07-05 07:12:11 +10:00
Ronnie Sahlberg
10a0ceaaa3
librpc_rpc_call_body() should return TRUE is successful
2012-07-05 07:09:00 +10:00
Ronnie Sahlberg
242b81cfbf
setpos returns a boolean, set it to always return TRUE
2012-07-05 07:06:33 +10:00
Ronnie Sahlberg
763cd6e3e2
ZDR: New builtin replacement for RPC/XDR called ZDR
...
This patch switches libnfs over to use precompiled rpcgen files
and using ZDR. ZDR is a trivial reimplementation of XDR that is built in
into libnfs.
This removes the dependencies of rpc/xdr completely and allow us to build on any
system, even systems where rpcgen and librpc/libxdr are not generally available.
2012-07-04 16:53:12 +10:00
Ronnie Sahlberg
6916a66546
NLM: initial support for NLM
2012-03-10 20:46:03 +11:00
Ronnie Sahlberg
fa3c25beee
NFSACL: Add support for SETACL3
2012-03-08 21:25:21 +11:00
Ronnie Sahlberg
47e5a2c740
new version 1.3
2012-03-03 19:04:58 +11:00
Ronnie Sahlberg
8e25581668
change rpc_nfs_symlink_async to take a full SYMLINK3args as parameter
2012-01-14 08:18:19 +11:00
Ronnie Sahlberg
16104b27bd
make low level readlink_async function take READLINK3args as argument
2012-01-14 08:11:09 +11:00
Ronnie Sahlberg
7edc9026db
make mkdir_async take a full MKDIR3args argument
2012-01-12 16:02:32 +11:00
Ronnie Sahlberg
c985c015f2
change crate_async low level function to take a full RATE3args structure as argument instead of just name and mode
2012-01-12 15:31:49 +11:00
Ronnie Sahlberg
8724c83390
Add function to get root filehandle from a nfs context
2012-01-11 07:04:01 +11:00
Ronnie Sahlberg
e6cac86f77
Try to rotate the ports we assign when root better so we dont reuse
...
a port htat is in time-wait too frequently
2012-01-03 07:25:25 +11:00
Ronnie Sahlberg
59f298f5bf
Improve an error message to show the errno value
2012-01-03 07:18:56 +11:00
Ronnie Sahlberg
5c6b1176c2
PMAP: allow to ask for tcp/udp port, dont assume users only ever want the tcp port
2011-12-31 14:24:20 +11:00
Ronnie Sahlberg
345422a2e3
New version 1.2
2011-12-06 18:02:34 +11:00
Ronnie Sahlberg
d7ec001f1a
Set IFREG from file type, dont assume mode bits contain it
...
Needed for HaneWin which does not set S_IFMT in the modebits returned
2011-12-05 13:54:21 +11:00
Ronnie Sahlberg
183451cff5
Remove all [s]size_t / off_t and replace with [u]int64_t making libnfs 64-bit pure
2011-11-27 14:49:08 +11:00
Ronnie Sahlberg
1ec6b50aef
Add MKNOD command support
...
Add support for raw nfs3 mknod and sync and async posixlike api
2011-11-27 14:08:24 +11:00
Ronnie Sahlberg
86ef491004
New version 1.1
2011-11-27 11:20:57 +11:00
Ronnie Sahlberg
14a062eb59
Everytime we use rpc_connect_async() internally, make sure we clear the ->connect_cb so that we dont have a callback function and "private data" being invoked long after the "private data" structure has been free()d.
2011-10-09 19:47:07 +11:00
Ronnie Sahlberg
a3d44462cb
Sync API: Once the sync nfs_mount() functions is finished we have to clear rpc->connect_cb.
...
Otherwise we get a crash once the connect_cb callback is invoked the second time.
2011-10-09 19:10:18 +11:00
Ronnie Sahlberg
b990de23c6
Only call the "connect callback" if the callback is set to non-NULL
2011-10-09 19:00:24 +11:00
Ronnie Sahlberg
8704724f83
Change remaining "struct AUTH *" to "AUTH *"
2011-10-09 15:22:05 +11:00
Memphiz
fa33813ed4
[fix] - fix improper definition of struct AUTH from osx (caution - API change - not clear if typedef is there on all plattforms...)
2011-10-08 18:10:06 +02:00
Ronnie Sahlberg
acf31bb24d
Bump version to 1.0.0
2011-10-04 18:30:15 +11:00
Ronnie Sahlberg
d678b73e4d
Fragment reassembly. Add reassembly of fragmented RPC PDUs
2011-10-04 12:31:56 +11:00
Ronnie Sahlberg
1744ef9011
Autoreconnect: autoreconnect was completely broken. Reimplement it so that it reconnects properly on session failure.
2011-10-04 11:25:10 +11:00
Ronnie Sahlberg
fb69c64c02
READDIRPLUS emulation: Some embedded servers do not support READDIRPLUS,
...
so try to trap this and emulate it with READDIR + a LOOKUP loop to get the attributes.
Since we are fully async we can do all the lookups in concurrently so it should not be that very exopensive compared to the cheaper READDIRPLUS call.
2011-10-03 10:55:42 +11:00
Memphiz
fcc42bfe85
[win32] - completed win32 port
2011-09-12 19:53:33 +02:00
Ronnie Sahlberg
4e9dcb7665
remove debug message
2011-09-12 22:20:56 +10:00
Ronnie Sahlberg
07fd0cbc65
when creating a socket, spin over a number of low-numbered ports
...
and try to bind to a system port in case the user is root or the
binary has the CAP_NET_BIND_SERVICE capability
this removes the need to use 'insecure' on the server
2011-09-12 22:14:26 +10:00
Ronnie Sahlberg
18c27b73ff
Large-Writes: just like for large-reads, chop large writes up into the smallest
...
of 32kb and what the server responded as the max write size and send them out in parallell to the server.
32kb is a common limitation in XDR libraries so even if the server says IT can handle writes larget than that, our XDR library might not.
2011-09-11 22:13:28 +10:00
Ronnie Sahlberg
83aa785d92
Add a call to find the queue-length so we can see how many I/O we have in flight from the application layer.
2011-09-11 21:32:48 +10:00
unknown
4b0e8df9a9
[fix] - fix connect for win32 - return values are inverted
2011-09-03 15:31:56 +10:00
unknown
99c14c9b81
[add] - implement set_non_blocking for socket
2011-09-03 15:30:01 +10:00
Memphiz
a8a1b85846
[win32] - make it compile on win32
2011-09-03 15:08:48 +10:00
Ronnie Sahlberg
4b1097cde2
remove old libnfs.def and update the buildscript to the new name libnfs-win32.def
2011-09-03 14:53:10 +10:00
Memphiz
7f7993883c
[add] - win32 compat stuff
2011-09-03 14:51:54 +10:00
Ronnie Sahlberg
db4ea5dd80
Revert "Rename libnfs.def to libnfs-win32.def"
...
This reverts commit a3d6cf111e
.
2011-09-03 14:51:48 +10:00
Ronnie Sahlberg
ea98629aef
memset() is posix, bzero() is not change bzero into memset
2011-09-03 14:11:22 +10:00
Ronnie Sahlberg
a3d6cf111e
Rename libnfs.def to libnfs-win32.def
2011-09-03 13:29:39 +10:00
Ronnie Sahlberg
565369e0b2
remove some includes that dont exist on windows
2011-09-03 11:30:10 +10:00
Ronnie Sahlberg
bb4e9ed6a8
cast to char * to avoid compiler warnings for get/setsockopt
2011-09-03 11:25:50 +10:00
Ronnie Sahlberg
4ed97718b3
Merge branch 'master' into win32-3
2011-09-03 11:11:36 +10:00
Ronnie Sahlberg
42f43e48cc
cast the pointer to char * for all calls to bzero
2011-09-03 11:08:58 +10:00
Ronnie Sahlberg
41d82d7d82
Merge branch 'win32' into win32-3
2011-09-03 10:57:42 +10:00
Ronnie Sahlberg
0804e67d7a
using READDIRPLUS3 we get some extra fields for the direentry structure for free, such as type, mode, size, timestamps
2011-09-02 20:45:30 +10:00
Ronnie Sahlberg
f390f18157
nfs_opendir() switch to using READDIRPLUS3 instead of READDIR3 when reading directories.
2011-09-02 20:27:01 +10:00
Ronnie Sahlberg
647d2ea11c
add support for opensolaris
2011-09-01 19:48:42 +10:00
Ronnie Sahlberg
427d71c0a7
Win32: add a libnfs.def file so we can build libraries/dlls
2011-08-30 15:54:29 +10:00
Ronnie Sahlberg
b85c7de2f7
use vsnprintf() on all platforms, dont special case win32 for vsnprintf and all other platforms use vasprintf
2011-08-29 19:59:36 +10:00
Ronnie Sahlberg
2606f9bb3d
Win32: add workaround for lack of vasprintf() and use vsnprintf() on windows on a fixed size buffer
2011-08-29 18:00:09 +10:00
Ronnie Sahlberg
0ad9a1f134
WIN32: win32 does not have poll()
...
add trivial replacement function
2011-08-28 19:48:01 +10:00
Ronnie Sahlberg
f4442bec27
wondows dont have vasprintf()
...
disable for now and reimplement later
2011-08-28 19:45:00 +10:00
Ronnie Sahlberg
6874f61e24
Win32: more win32 adaptations
2011-08-28 19:43:33 +10:00
Ronnie Sahlberg
fb6510bb68
VC10 dont like ';;'
2011-08-28 19:30:10 +10:00
Ronnie Sahlberg
d8143ff7d7
Win32: the stat structure on win32 does not have blocks or blocksize
2011-08-28 19:29:08 +10:00
Ronnie Sahlberg
93e9306f80
replace index/rindex with modern equivalents
2011-08-28 19:27:57 +10:00
Ronnie Sahlberg
a671a46510
replace index/rindex with modern equivalents
2011-08-28 19:27:23 +10:00
Ronnie Sahlberg
9896c7155c
nfs_set_auth() is a void and does not return anything
2011-08-28 19:26:07 +10:00
Ronnie Sahlberg
be337389bf
nfs_set_auth() is a void and does not return anything
2011-08-28 19:25:20 +10:00
Ronnie Sahlberg
eecdc4f3cd
Win32 changes, include files we need when compiling under win32
...
and some socket ops are slightly different
2011-08-28 19:24:18 +10:00
Ronnie Sahlberg
11ef53a2e6
callit_cb() : dont return a value from avoid function
2011-08-28 19:00:04 +10:00
Ronnie Sahlberg
b3740e09de
callit_cb() : dont return a value from avoid function
2011-08-28 18:59:13 +10:00
Ronnie Sahlberg
963c2f83be
Initialize the rootfh handle when creating the nfs context or else
...
we will try to free a wild pointer if the mount failed
and we proceed to call nfs_destroy_context();
2011-07-31 10:59:46 +10:00
Ronnie Sahlberg
b077fdeb65
Add automatic reconnect after TCP session failure for the sync interface.
...
Once a NFS TCP connection has been idle for a very long time, say
10-15 minutes, it is common that NFS servers will tear down the TCP connection.
So add code to re-connect to the NFS server and re-issue any i/o that might have been in flight (unlikely unless the server has hung)
While it is sufficient to just reconnect to tcp port 2049, it was much simplet to just utilize the nfs_mount() function.
This means that instead of just reconnecting TCP port 2049, we do a full blown
nfs mount via portmapper and mountd protocols.
2011-07-31 10:49:47 +10:00
Ronnie Sahlberg
8c27363e21
since UDP is unreliable, send the CALLIT broadcasts 3 times, one second apart when probing for local NFS servers
2011-07-16 17:30:44 +10:00
Ronnie Sahlberg
e5964ef905
break out the loop for sending a NFSd probe bcast on every interface into a separate function
2011-07-16 17:27:12 +10:00
Memphiz
41a6209bef
[fix] - fix allocation of if list for osx
...
- removed one unneeded header in examples/nfsclient-bcast.c which was breaking build under osx
2011-07-11 19:16:13 +02:00
Ronnie Sahlberg
9a96dd46d2
We have to include config.h when testing for precense of sockaddr sa_len
2011-07-10 08:50:36 +10:00
Ronnie Sahlberg
1be803ce7f
On OSX and other systems where we have sockaddr_in, SIOCGIFCONF returns a packed list of ifreq structures, so we can not just index them as (struct ifreq *)[i]
...
Instead we have to compute the offset into the buffer for where the next record starts (this offset might or might not be sizeof(struct ifreq)
2011-07-10 08:39:54 +10:00
Trent Nelson
56320c681f
Fix out-of-tree (VPATH) builds
2011-07-06 16:38:38 -04:00
Ronnie Sahlberg
1ad6f93185
when ioctl() for getting the broadcast address fails, continue the loop to the next entry instead of exiting out
2011-07-04 08:46:19 +10:00
Memphiz
b989ca9c36
- fixed missing include for osx
2011-07-03 15:25:48 +02:00
Ronnie Sahlberg
f7f931c7e3
add back a check for sa_len in sockaddr structure.
2011-07-03 07:41:15 +10:00
Ronnie Sahlberg
1b9917b886
With broadcast PDUs we can receive multiple replies so must make sure we
...
delete the previuous unmarshalling buffer when we start over and
process the second pdu to the initial call.
Or else we will leak memory very slowly when processing broadcast RPC replies
2011-07-02 12:16:37 +10:00
Ronnie Sahlberg
2e4db0d145
Merge remote branch 't-nelson/automake'
2011-07-02 11:10:36 +10:00
Ronnie Sahlberg
552c766578
add example for sync interface to probe for all local servers
2011-07-02 10:30:16 +10:00
Trent Nelson
fc01d2a961
Fix compile error on solaris.
...
Include sys/filio.h explicitly as solaris doesn't define BSD_COMP and
thus doesn't pull this header via sys/ioctl.h. Needed for FIONREAD.
2011-06-29 14:15:23 -04:00