Commit graph

36 commits

Author SHA1 Message Date
Tobias Heinicke 53fb93e64a delete import, oexportfs src 2021-12-14 19:39:59 +00:00
amavect 0f58e47551 exportfs, oexportfs, iostats: make -d log to stderr
exportfs -d logs 9p traffic to /tmp/exportdb.
-f allows writing to a different file.
exportfs silently continues if it doesn't have
permissions to create or write to /tmp/exportdb.
These are poor behaviors.

A better default is to write to stderr, since it
is 9P debug info that is better immediately printed,
and not user info that is better handled by syslog().
As a result, -f is obsolete and thus removed.
Redirect responsibility is now on rc.
As a side effect, rc will fail if it doesn't
have permissions to write.

exportfs(4) is updated to reflect all changes
and with a better Synopsis.

oexportfs is changed to match exportfs.
oexportfs(4) is updated to reflect all changes.
The Synopsis is not changed due to the number of flags.

Removed -f from iostats.
iostats(4) is updated to reflect all changes.
---
2021-08-18 17:51:40 +00:00
Ori Bernstein b0ae37013c exportfs: revert e524e8d65a
It turns out that the '-f' flag was being used, and removing
it broke things.
2021-08-18 14:44:29 +00:00
amavect e524e8d65a exportfs: make -d log to stderr
exportfs -d logs 9p traffic to /tmp/exportdb.
-f allows writing to a different file.
exportfs silently continues if it doesn't have
permissions to create or write to /tmp/exportdb.
These are poor behaviors.

A better default is to write to stderr, since it
is 9P debug info that is better immediately printed,
and not user info that is better handled by syslog().
As a result, -f is obsolete and thus removed.
Redirect responsibility is now on rc.
As a side effect, rc will fail if it doesn't
have permissions to write.

exportfs(4) is updated to reflect all changes
and with a better Synopsis.
2021-08-14 19:50:23 +00:00
cinap_lenrek 27a83106f4 oexportfs: move legacy code for cpu and import to separate program
The initial protocol handling in exportfs for
cpu and import services is a huge mess.

Saparate the code out into its own program with
its own oexportfs(4) manpage.
2020-12-13 20:09:03 +01:00
kvik e5894dccea pre-lib9p servers: fix incorrect Tversion handling
version(5) says:

	If the server does not understand the client's version
	string, it should respond with an Rversion message (not
	Rerror) with the version string the 7 characters
	``unknown''.

Pre-lib9p file servers -- all except cwfs(4) -- do return Rerror.

lib9p(2) follows the above spec, although ignoring the next part
concerning comparison after period-stripping.  It assumes an
Fcall.version starting with "9P" is correctly formed and returns
the only supported version of the protocol, which seems alright.

This patch brings pre-lib9p servers in accordance with the spec.
2020-08-01 15:27:28 +02:00
cinap_lenrek ac88ce4f7f make bind(2) error handling consistent
The mount() and bind() syscalls return -1 on error,
and the mountid sequence number on success.

The manpage states that the mountid sequence number
is a positive integer, but the kernels implementation
currently uses a unsigned 32-bit integer and does not
guarantee that the mountid will not become negative.

Most code just cares about the error, so test for
the -1 error value only.
2020-05-02 17:32:01 +02:00
cinap_lenrek 71a1d11a81 cmd/ip/*: chown the network connection after authentication
for servers that handle incoming network connections and authentication,
change the owner of the network connection file to the authenticated user
after successfull authentication.

note that we set the permissions as well to 0660 because old devip used
to unconditionally set the bits.
2019-09-21 23:36:44 +02:00
cinap_lenrek 19166f2cf3 libc: add procsetname() 2018-09-26 14:56:23 +02:00
cinap_lenrek a0d4c5e208 make error handling in 9p service loops consistent
when we get eof, stop the loop immidiately and do not
rely on the read to eventually return an error.

when convM2S() fails to decode the message, error out
and stop the loop. there is no point in continuing.
2016-07-24 02:21:32 +02:00
cinap_lenrek 8c837c7bf6 exportfs: disallow ORCLOSE in readonly mode (charles forsyth) 2016-05-16 21:49:02 +02:00
cinap_lenrek 046e0ee259 exportfs: fix endless loop for eof/error on second read in localread9pmsg()
the ini buffer was not reset when we got eof in the message
body read causing a endless loop. instead of defining our
own read9pmsg() function, just handle the first read specially
when we consumed the first 4 bytes for the "impo" protocol
escape check.
2016-02-21 20:11:04 +01:00
cinap_lenrek 4fe7daeca4 exportfs: retry execing ourselfs as "/bin/exportfs" (argv0 might be relative path) 2016-02-14 04:49:48 +01:00
cinap_lenrek 232a064f3a exportfs: properly reply to chdir() error when we speak 9p
when we got a bad root tree, we should speak the right language
and return a Rerror response instead of crapping ascii into
the 9p conversation.
2016-02-14 04:48:48 +01:00
cinap_lenrek a8f8de1cde import/expoerfs: dont assert() fault when ai->secret is > 8 bytes, just use the first 8 bytes 2015-12-16 21:30:56 +01:00
cinap_lenrek a67d18ccf1 import: make aan (-p flag) work in ``backwards mode'' (-B)
in backwards mode, the roles of the aan filters need to be
reversed. add "-n address" option to import to override the
announce address for the aan server part (default tcp!*!0).
2014-08-14 00:11:14 +02:00
cinap_lenrek 5302e88796 exportfs: simplify freefile() code
remove impossible checks, rewrite as while loop.
2014-08-02 19:22:10 +02:00
cinap_lenrek b185d2fe5c exportfs: remove getsbuf() nil check, can't happen 2014-08-02 19:04:33 +02:00
cinap_lenrek 73d35f9c7d exportfs: cleanup 2014-08-02 15:07:29 +02:00
cinap_lenrek 1b70ab5979 exportfs: use argv0 instead of hardcoding "/bin/exportfs" in openmount(), dont use 0 for nil 2014-08-01 16:57:39 +02:00
cinap_lenrek eed4871674 exportfs: avoid closing netfd in filter()
netfd is initially zero (stdin), when filter() closes fd0,
fd0 is free to be reused. this causes problems with openmount()
that assumes sfd being >2.

instead, we dup the our pipe end over netfd, and close the pipe.
2014-03-11 07:03:15 +01:00
cinap_lenrek 40d71baf7f exportfs: bring back the changes, bug was due to rendezvous group being shared by listen
exportfs used pid of slave proc as rendezvous tag. when we
changed it to use Proc* memory address, there where tag
collisions because listen didnt fork the rendezvous group (bug!).

for now, just do rfork(RFREND) in main just in case.

will fix aux/listen in a follow up changeset.

--
cinap
2014-02-21 05:23:21 +01:00
cinap_lenrek 1281b234e8 exportfs: reverting previous changes
getting strange tag mismatches on some machines. needs
to be debugged. until then, reverting the change.
2014-02-21 01:02:32 +01:00
cinap_lenrek 9c40e15ba8 exportfs: fix flush races, proc sweeping 2014-02-18 22:15:06 +01:00
cinap_lenrek 35484945e2 exportfs: get rid of limits, cleanup
get rid of the service buffer limit. keep service buffers
on a global freelist protected by lock.

dont fatal when we hit the process limit. instead, just
abort the rpc with an error.

handle rendezvous() interrupts.
2013-12-15 07:49:53 +01:00
cinap_lenrek f72da96f28 exportfs: start filter in separate rendezvous group 2013-10-08 20:58:55 +02:00
cinap_lenrek ad1111cb3e exportfs: fix more filedescriptor leaks
just closing the pipe isnt enough, we have to
close all remaining file descriptors except sfd
before executing sub exportfs.
2013-10-07 23:18:37 +02:00
cinap_lenrek 6197758ec1 exportfs: fix openmount() rfork flags and filedescriptor leak, silence of on initstr error
fork child exportfs with new rendezvous group.
fix missing close of pipe filedescriptors on error.
fix missing close of other end of pipe in child.

dont bark when we get eof on the first init string read.
this condition can happen when unmount opens and
immidiately closes a exported srv file.
2013-10-06 04:42:46 +02:00
cinap_lenrek e36d9f5c4e make filesystem handling of read9pmsg() consistent 2013-06-16 06:26:31 +02:00
cinap_lenrek d5305dc199 exportfs: applying exportfs-chdir patch (from sources)
Fix the behavior of exportfs -r.

Check the return of chdir(srv) to prevent exporting accidentally
the current working directory when the directory specified
with option -r doesn't exist.

Also fix at the same time the missing trailing \n in error
messages printed just before exits().
2013-02-10 23:31:26 +01:00
cinap_lenrek 3787f721c1 9p message size too small
various fileservers do not check if the message size is too small
(they subtract IOHDRSZ later from it to calculate iounit) which
can overflow.
2013-01-30 06:28:42 +01:00
cinap_lenrek e9af32cc3a exportfs/import: cleanup 2012-06-25 16:52:59 +02:00
cinap_lenrek 8f67fae1a0 exportfs: fix bugs, error consistency, cleanup 2012-06-25 09:38:19 +02:00
cinap_lenrek d970ed6a5a bring manpage and debug code of exportfs -P closer to reality 2012-02-07 03:29:58 +01:00
Taru Karttunen a9060cc06b Import sources from 2011-03-30 iso image - lib 2011-03-30 19:35:09 +03:00
Taru Karttunen e5888a1ffd Import sources from 2011-03-30 iso image 2011-03-30 15:46:40 +03:00