| Commit message (Collapse) | Author | Age |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We now create a per-command socket pair in the command handler and use the
permanent server-afs socket to pass one end of the pair from the command
handler to the afs process.
With this approach only the command handlers can possibly talk to the
afs process, so we don't need to worry about malicious or bogus connections
arriving at the local socket.
Consequently, we may remove the socket cookie and employ blocking I/O for the
shared memory identifiers that are transferred through the per-command socket.
Connections are now dispatched in one go, obviating the need to keep track
of connected clients. So remove struct afs_client and the client list.
|
| |
|
|
|
|
|
|
| |
Generated with
sed -i 's|Copyright.*Andre Noll.*|SPDX-License-Identifier: GPL-2.0 */|g' *.c *.h
followed by manually tweaking the result a bit. No license change intended.
|
| |
|
|
|
| |
These just clutter the generated documentation, particularly the list of
global variables.
|
| |
|
|
| |
Command handlers only need to read this structure.
|
| |
|
|
| |
It is initialized in handle_connect() but never used.
|
| |
|
|
|
|
|
|
|
|
|
| |
Command handlers should not look at the argv[] vector directly
but only use the lopsub library functions to access the parsed
command line.
In fact, the only function which accesses the argv vector is
run_command(). Defining argc and argv as local variables in this
function allows to drop the two members from the command context
structure.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently the server commands are divided into two group: those
commands which are handled by the server process and those which
communicate with the afs process. This commit converts the commands of
the former group and the corresponding completers for para_client to
the lopsub suite format while the afs commands will be converted in
subsequent commits. After this change para_server needs to be linked
with -llopsub.
To this aim the options and help texts of of the server commands are
transferred from server.cmd to the new server_cmd.suite.m4, enabling
long-style options in the progress. Moreover, an introduction is added
at the beginning of the list of server commands which describes how
server commands are executed.
Command permissions are now handled by making use of the aux_info
feature of lopsub. To keep those commands working which do not
have any permission bit set, we need to add a new identifier
NO_PERMISSION_REQUIRED to enum server_command_permissions of
user_list.h. The value of this identifier is zero of course.
Naturally the bulk of the change takes place in command.c where all
server commands are implemented. The command handlers are modified
to take a pointer to a struct lls_parse result as an additional
argument. A new helper, send_errctx(), is introduced to avoid code
duplication.
Since command.h now refers to a lopsub parse result, all files which
include command.h, including those which implement only afs commands,
need to include the system header lopsub.h.
To keep afs commands working, some compatibility code in run_command()
is added. This will go away after all commands have been converted.
A couple of macros in command.h ease the handling of the long symbolic
constants exposed by the generated lopsub header file.
Although only the non-afs commands are converted, the change allows
for a couple of cleanups:
* The E_BAD_COMMAND error code is no longer needed and has been
removed.
* cmd_perms_itohuman() has become unused and is removed.
* The server_cmds[] array is empty and can be removed, along
with the loop in send_list_of_commands() which iterated over
the array.
The patch also adjusts tests t0004 and t0005 since the help output
format changed slightly, breaking the expectations of these tests.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Command handlers should not know about this implementation detail.
This commit also changes parse_sb_command() to not only parse the
command line but to actually run the command in case the caller has
sufficient permissions. The function is renamed to run_command()
to reflect this change.
We use the opportunity to clean up the allocation and freeing of
the command buffer and the argument vector. Both are now freed in
the same function they were allocated, which is considered good
programming practice.
|
| |
|
|
|
|
|
| |
This structure is only needed in command.c, so we can make it local
to this file. As structures defined in .c files are not included
in doxygen, the reference to struct server_command in server.h must
be removed.
|
| |
|
|
|
| |
The fields of struct server command never need to be modified so they
can be const.
|
| |
|
|
|
| |
Now that non-client sideband connection attempts are rejected up-front,
we may get rid of all the non-sideband code.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
There are many places in various command handlers where the error path
contains code like
sc_send_va_buffer(&cc->scc, "%s\n", para_strerror(-ret));
to send an error message to the client. This patch simplifies all
these places by introducing the public function send_strerror() which
takes a command context structure and an error code, and executes the
above statement. All places where this was open-coded are changed
to call the new function instead.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds the new source files sideband.[ch] to the repository and
links the corresponding object file into para_server, para_audiod
and para_client.
The sideband API enables the command handlers of para_server to send a
multiplexed output stream. The client side (para_client or para_audiod)
demultiplex the received stream afterwards.
The design is as simple as it can be: Each data buffer is preceded
by a 5-byte header containing the length and the band designator,
a one-byte number which specifies the type of the data which follows.
The server-side and the client-side implement their own variant of the
send_sb() and recv_sb() functions for sending and receiving sideband
packets. Two implementations are necessary because the underlying
file descriptor is blocking on the server side (command handlers of
para_server) while it is non-blocking on the client side (para_client
and para_audiod).
The sideband API allows to optionally filter all data (including the
sideband header) through an arbitrary transformation. This patch adds
a suitable transformation as a new public function performs RC4 to
the crypto API.
To keep the patch within reasonable size, this commit does not contain
any users of the new sideband API yet. Subsequent commits will teach
the authentication handshake code and the command handlers to send
and receive data as sideband packets.
|
| |
|
|
|
|
|
|
|
|
| |
The server announces a list of supported features and the client may
request any subset of features.
The only supported feature is "sideband". It has no effect at the
moment but this will change in subsequent patches.
TODO: Documentation, remove "foo" feature.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This exposes a couple of variables which were previously local to
handle_connect() to the command handlers, allowing them to make use
of the full command context.
All newly exposed variables are stored in an instance of the new
structure, and the command handlers now take a pointer to such
a structure.
The patch is large but also straight forward.
|
| |
|
|
|
|
|
| |
This only changes the name structures and functions. Unfortunately,
the patch is rather large since it requires to fixup all callers
of the affected functions. However, each change is either a simple
rename or a trivial documentation adjustment.
|
|
|
The old code used a rather fancy way to (de)activate encryption on
a per fd basis: In net.c there was an array of rc4 keys, indexed by fd.
This is rather wastful because the array size is determined by the
highest fd for which encryption is activated.
It's also hard to comprehend and it's easy to get strange results if
one forgets to deactivate the encryption after the fd is closed.
This patch introduces a new structure, rc4_context, which consists of
an fd and the needed rc4 keys. Users explicitly call the new rc4 variants
of the receving/sending functions which take a pointer to a struct
rc4_context instead of a file descriptor but are otherwise identical.
Keep crypt simple!
|