aboutsummaryrefslogtreecommitdiff
path: root/server.c (unfollow)
Commit message (Collapse)AuthorLines
2020-02-20slave: prefix argv[0] with a '-' when spawning a login-shellDaniel Eklöf-1/+4
2020-01-10Revert "server: use edge-triggered FDM handler for the client connections"Daniel Eklöf-13/+13
This reverts commit 9141b8a6573f973f97aa1615a8cc0c488cfd77e7.
2020-01-10server: use edge-triggered FDM handler for the client connectionsDaniel Eklöf-13/+13
2020-01-10server: be more resilient against bad behaving clientsDaniel Eklöf-3/+16
Make both the server listening socket and the connecting client sockets non-blocking. Then, when reading the initial length of the setup packet, handle read errors from partial reads separately. Assume the client writes all four bytes of the 'length' field at once, and bail out if we are unable to read those 4 bytes. Limit the maximum setup packet size to 128K. This is to prevent clients from pretending the setup packet is insanely large, causing us to fail to malloc.
2019-12-21server: verify CWD string length matches the indicated lengthDaniel Eklöf-0/+6
2019-12-21server: move forward the indicated number of TERM bytesDaniel Eklöf-1/+1
2019-12-21server: bug: move forward 2 bytes, not whatever the client sentDaniel Eklöf-1/+1
2019-12-21term: term_init: add 'cwd' argumentDaniel Eklöf-1/+1
This is used when spawning the slave, to set its current working directory just before we exec() the client. In a regular foot instance, we set the cwd from getcwd(). In a foot server instance, each connecting client sends its cwd to the server, and we use that.
2019-12-21client/server: client sends its CWD to serverDaniel Eklöf-1/+8
2019-12-21term: term_spawn_new: always spawn foot/footclient from PATHDaniel Eklöf-1/+1
2019-12-21term: term_spawn_new(): new function, spawns a new foot/footclient processDaniel Eklöf-1/+1
Bind ctrl+shift+return to it
2019-12-14server: use socket-path from configDaniel Eklöf-19/+2
2019-12-13server: log socket packetDaniel Eklöf-1/+3
2019-12-01Add missing includesDaniel Eklöf-0/+1
2019-11-17tllist: is now an external "library", so use <> includesDaniel Eklöf-1/+2
2019-11-05server: disable debug outputDaniel Eklöf-1/+1
2019-11-05server/client: harden reading of initialization data, and make asyncDaniel Eklöf-31/+90
* Client terminal initialization data is now received asynchronously. To facilitate this, a couple of minor changes to the protocol was made: - The client now starts with sending a 4-byte unsigned integer with the *total* size of the initialization data (*not* including the size field itself. - Strings (TERM variable + argv) are now sent NULL-terminated * The server allocates a single buffer, and fills it asynchronously. When full (as indicated by the initial 'total size' integer), we parse it (taking care not to read outside boundaries etc, and verifies the lengths (of the TERM variable and argv array) indicated by the client matches the actual lengths of the strings received. * The server now ignores 'unexpected' data received from the client, after the terminal has been instantiated.
2019-11-05server: workaround evil clientsDaniel Eklöf-0/+6
If the clients attempt to send more data after we've instantiated the terminal, just consume the data but ignore it.
2019-11-05server: don't cache argc/argv in client contextDaniel Eklöf-17/+18
2019-11-03Remove unneeded includeDaniel Eklöf-1/+0
2019-11-03server: set CLOEXEC | NONBLOCK directly in socket() callDaniel Eklöf-17/+2
2019-11-03server: FD_CLOEXEC is a file descriptor flag, not a file status flagDaniel Eklöf-1/+1
2019-11-02misc: fdm already logs failuresDaniel Eklöf-4/+1
2019-11-02server: server_destroy(): unlink UNIX socketDaniel Eklöf-0/+2
2019-11-02server: use a non-blocking socket when trying to connectDaniel Eklöf-4/+23
When checking of a 'foot --server' instance is already running, we try to connect to the UNIX socket we're planning on listening on. In most cases, this will fail hard and fast. But under certain circumstances, we can get stuck in connect() waiting for a connection timeout. Since it should be possible to establish a connection immediately *if* there's someone actually listening on the socket, rely on the fact that connect() will fail with a EINPROGRESS if a connection can *not* be established immediately (and thus no one is listening on it).
2019-11-02server: don't get stuck in read() if TERM length is 0Daniel Eklöf-2/+4
2019-11-02server: don't get stuck in read() if length of argv argument is 0Daniel Eklöf-0/+3
2019-11-01server: purge shm buffers when terminal is destroyedDaniel Eklöf-0/+6
2019-11-01server: add debug logging of client argc/argvDaniel Eklöf-0/+4
2019-11-01client/server: add -t,--term to footclientDaniel Eklöf-1/+15
2019-11-01term_init(): initialize slave TERM from term_init() argumentDaniel Eklöf-2/+2
2019-11-01server: implement a --server modeDaniel Eklöf-0/+310
In this mode, foot listens on a UNIX socket and creates terminal windows when clients connect. A connecting client sends argc/argv to the server, and the server instantiates a new terminal window. When the terminal window is closed, the exit code is sent back to the client.