]> git.tuebingen.mpg.de Git - paraslash.git/log
paraslash.git
7 years agoserver: Convert com_setatt() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:22:01 +0000 (21:22 +0000)]
server: Convert com_setatt() to lopsub.

Introduces ->input_skip for struct pattern_match data. The setatt
command uses this to strip the attribute modifies off the unnamed
arguments in the lopsub parse result. The remaining arguments are
the patterns which are to be matched against each file in the audio
file table.

7 years agoserver: Convert com_lsatt() to lopsub.
Andre Noll [Sun, 20 Mar 2016 18:40:19 +0000 (18:40 +0000)]
server: Convert com_lsatt() to lopsub.

This is the first afs subcommand which needs to pass a pattern list
to its callback. The new send_lls_callback_request() provides this
functionality. It serializes the parse result into a buffer and passes
this buffer to the callback.

Since there are non-lopsub commands which also pass a pattern list,
action_if_pattern_matches() is patched to receive the pattern
list either from the serialized parse result or in the old way via
pmd->data. To achieve this, a parse result pointer is added to struct
pattern_match_data. If this pointer is not NULL, we are dealing with
a subcommand that has been converted.

Since the ls subcommand has not been converted yet, lopsub will
regard "ls" as a uniqe abbreviation of the lsatt command, which
breaks t0004. To work around this, we deactivate prefix matching by
only accepting exact matches in run_command(). This workaround can
be removed after com_ls() has been converted.

7 years agoserver: Convert com_init() to lopsub.
Andre Noll [Fri, 2 Oct 2015 21:23:54 +0000 (21:23 +0000)]
server: Convert com_init() to lopsub.

No change necessary for the callback as the init command does
not have any options. The only information that must travel from the
command handler to the callback is the set of tables to create. The
corresponding bitmask is passed without serializing the parse result.

7 years agoserver: Convert com_add() to lopsub.
Andre Noll [Sun, 15 May 2016 16:53:50 +0000 (18:53 +0200)]
server: Convert com_add() to lopsub.

In the callback structure for the add command, replace the flags
field by the serialized callback result. This way the callback
has access to the full parse result structure.

7 years agoserver: Convert non-afs commands to lopsub.
Andre Noll [Sun, 12 Jun 2016 13:36:21 +0000 (15:36 +0200)]
server: Convert non-afs commands to lopsub.

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.

7 years agoConvert audiod commands to lopsub.
Andre Noll [Sat, 7 May 2016 08:59:01 +0000 (10:59 +0200)]
Convert audiod commands to lopsub.

The four command lists (server, afs, audiod, play) and all executables
will be converted to the long option parser library (lopsub). This
first patch converts the audiod commands (on, off, cycle...) and adds
the necessary infrastructure to the build system. The option parser
for para_audiod is still generated by gengetopt and will be converted
in a subsequent patch.

The build system is updated to include an autoconf test which
checks for the lopsub library and the lopsubgen executable. If the
check fails, it prints instructions on how to download the lopsub
package. Moreover, a section on lopsub is added to the INSTALL file
and the library is listed as a required tool in the manual.

The options and help texts of all audiod commands are moved from
audiod.cmd to the new file audiod_cmd.suite.m4. Until all command
lists are converted, man_util.bash needs an ugly hack to deal with
the two kinds of files.

The help texts have been reworked slightly, but no syntactical
changes were performed. However, one side effect of the change is
that options to audiod commands now accept short and long options,
and that short options may be combined in the usual way.

The error subsystem of paraslash is extended to treat lopsub errors
analogous to errors from the osl libary: we reserve a new bit for
error codes returned from lopsub library functions and a lls() wrapper
function that must be used for all lopsub functions which return a
lopsub error code on failure. The E_INVALID_AUDIOD_CMD error code
can be removed since invalid commands are now detected by the lopsub
library, which returns its own error code in this case.

As a result of the conversion, struct audiod_command can be removed.
Command handlers now take a pointer to a lopsub parse result instead
of the (argc, argv) pair.

The patch also changes the completers for audiod commands in
audioc.c. to use the information in the generated audioc_cmd.lsg.h
header file instead of duplicating this information.

With the patch applied, para_audiod and para_audioc need to be linked
with -llopsub.

We still need to include ggo.h from audiod_command.c until receivers,
filters and writers have been converted as well.

7 years agowmadec: Use read_u32_be().
Andre Noll [Sat, 28 Jan 2017 17:02:33 +0000 (18:02 +0100)]
wmadec: Use read_u32_be().

The shift operation in show_bits() was buggy because p[0] is promoted
to int, and the shift p[0] << 24 results in undefined behavior,
causing the sanitizer of gcc to complain:

bitstream.h:40:21: runtime error: left shift of 230 by 24 places cannot be represented in type 'int'

read_u32_be() gets this right.

7 years agowma_afh.c: Remove condition which is always true.
Andre Noll [Sun, 8 Jan 2017 17:05:31 +0000 (18:05 +0100)]
wma_afh.c: Remove condition which is always true.

The single caller of count_frames() never passes a NULL pointer.

7 years agoimdct.c: Replace pointless macro PASS.
Andre Noll [Sat, 7 Jan 2017 15:12:05 +0000 (16:12 +0100)]
imdct.c: Replace pointless macro PASS.

The macro defines pass(), a function with only a single caller. We
may as well define the function directly, improving readability and
enabling proper syntax colors.

7 years agowma_common.c: Remove pointless assignment.
Andre Noll [Fri, 6 Jan 2017 00:04:23 +0000 (01:04 +0100)]
wma_common.c: Remove pointless assignment.

7 years agowma_afh.c: Use DIV_ROUND_UP().
Andre Noll [Fri, 6 Jan 2017 00:03:29 +0000 (01:03 +0100)]
wma_afh.c: Use DIV_ROUND_UP().

This kills another open-coded instance of DIV_ROUND_UP().

7 years agoaacdec: Decode only one frame per iteration.
Andre Noll [Fri, 18 Apr 2014 00:13:08 +0000 (00:13 +0000)]
aacdec: Decode only one frame per iteration.

This improves latency and helps to avoid buffer underruns on slow
machines.

7 years agoaacdec: Combine aac_open() and aacdec_open().
Andre Noll [Fri, 18 Apr 2014 00:12:40 +0000 (00:12 +0000)]
aacdec: Combine aac_open() and aacdec_open().

Both functions are short, and they are only called once at
startup. Thus, there is no reason to spread out the initialization
over two functions, so let's combine them.

7 years agoaacdec: Make "initialized" a boolean.
Andre Noll [Thu, 17 Apr 2014 23:53:17 +0000 (23:53 +0000)]
aacdec: Make "initialized" a boolean.

It improves code readability, they say.

7 years agoaacdec: Make frame_info local to ->post_select().
Andre Noll [Thu, 17 Apr 2014 23:52:14 +0000 (23:52 +0000)]
aacdec: Make frame_info local to ->post_select().

We don't need to preserve this value across multiple calls to
->post_select().

7 years agoaacdec: Remove pointless assignment.
Andre Noll [Thu, 17 Apr 2014 23:45:19 +0000 (23:45 +0000)]
aacdec: Remove pointless assignment.

No need to set "ret" here as the jump to "next_buffer" overwrites
its content anyway.

7 years agoaacdec: Remove pointless check and improve comment.
Andre Noll [Thu, 17 Apr 2014 23:38:19 +0000 (23:38 +0000)]
aacdec: Remove pointless check and improve comment.

"consumed" is always less than "len" here because of the check a few
lines earlier.

7 years agoaacdec: Rename buffer variables.
Andre Noll [Thu, 17 Apr 2014 23:35:58 +0000 (23:35 +0000)]
aacdec: Rename buffer variables.

The naming of the three buffers was inconsistent. This patch unifies
the names.

7 years agoaacdec: Remove pointless variable p.
Andre Noll [Thu, 17 Apr 2014 23:34:04 +0000 (23:34 +0000)]
aacdec: Remove pointless variable p.

7 years agoaacdec: Remove check which is always true.
Andre Noll [Thu, 17 Apr 2014 23:11:05 +0000 (23:11 +0000)]
aacdec: Remove check which is always true.

Just prior to the test we set ret to consumed, so it is known to
be non-negative.

7 years agoaacdec: Kill pointless label.
Andre Noll [Thu, 17 Apr 2014 23:10:21 +0000 (23:10 +0000)]
aacdec: Kill pointless label.

The "out" and "err" labels are equivalent if ret is negative, which
is the case for the only jump to "out".

7 years agoaacdec: Remove superfluous assignment.
Andre Noll [Thu, 17 Apr 2014 23:06:37 +0000 (23:06 +0000)]
aacdec: Remove superfluous assignment.

Jumping to the success label sets ret to consumed. ret is not used if
there are samples available, so this is safe.

7 years agoaacdec: Improve and silence error message.
Andre Noll [Sat, 24 Dec 2016 16:41:00 +0000 (17:41 +0100)]
aacdec: Improve and silence error message.

Most errors from NeAACDecDecode() can be handled gracefully. This
patch downgrades the severity level of the corresponding log messages
from ERROR to NOTICE and explains the meaning of the three numbers
of the second log message.

7 years agoaacdec: Prefer NeAACDecInit() over NeAACDecInit2().
Andre Noll [Sat, 31 Dec 2016 01:39:16 +0000 (02:39 +0100)]
aacdec: Prefer NeAACDecInit() over NeAACDecInit2().

The aac decoder tries to parse the length of the decoder configuration
from the esds atom and passes this information to NeAACDecInit2(). If
we can not figure out the length, we fall back to NeAACDecInit(),
which does not receive the decoder length as a parameter. This is
unnecessary because NeAACDecInit2() is only necessary for decoding
mp4 files, while both para_afh and para_server feed demultiplexed
aac frames to the decoder.

Calling NeAACDecInit() unconditionally allows to get rid of the
code which detects and parses the esds atom.

7 years agoaacdec: Don't eat full buffer on errors.
Andre Noll [Sun, 6 Apr 2014 10:13:10 +0000 (12:13 +0200)]
aacdec: Don't eat full buffer on errors.

On decoding errors, if the call to NeAACDecDecode() did not consume
anything from the input buffer, we currently throw away the full
buffer. This does not necessarily improve matters, so let's just eat
one byte and hope that subsequent calls succeed.

7 years agoCombine aacdec and aac_common.
Andre Noll [Thu, 17 Mar 2016 20:59:52 +0000 (21:59 +0100)]
Combine aacdec and aac_common.

With the server side switched to libmp4ff, only the aac decoder needs
the public functions in aac_common. This patch moves this file into
aacdec_filter.c, makes the functions static and removes the aac.h
header file which only contained the prototypes of the previously
public functions.

Makefile.real, configure.ac and error.h need small adjustments due
to the removal of aac_common.c.

7 years agoConvert the aac audio format handler to libmp4ff.
Andre Noll [Sat, 24 Dec 2016 15:02:44 +0000 (16:02 +0100)]
Convert the aac audio format handler to libmp4ff.

This changes the aac audio format handler to call the primitives
provided by the mp4ff library. This allows to remove the atom parsing
code from aac_afh.c.

After this change para_server, para_afh, and para_recv no longer
depend on aac_common.c and on the mp4v2 library.  The autoconf tests
for libmp4v2 are removed from configure.ac. A subsequent commit will
deal with aac_common.c.

7 years agoaac_afh: Don't create chunk tables any more.
Andre Noll [Sat, 24 Dec 2016 15:02:36 +0000 (16:02 +0100)]
aac_afh: Don't create chunk tables any more.

A previous commit activated dynamic chunks for the aac audio format
handler, so the virtual streaming system no longer consults the chunk
table stored in the audio file table of the osl database.

However, the code to open or add an audio file still assumes that
there is a chunk table and bails out if it can't find it. This patch
changes aft.c to do without a chunk table if the audio format handler
supports dynamic chunks. The afh_supports_dynamic_chunks() helper
needs to be made public because of this.

With chunk tables being optional, the ->get_file_info method of the
audio format handler can safely set ->chunk_table to NULL. It still
needs to compute the maximum chunk size though.

7 years agoafh: Dynamic chunks.
Andre Noll [Wed, 21 Dec 2016 23:57:15 +0000 (00:57 +0100)]
afh: Dynamic chunks.

paraslash chunk tables were designed long ago with the idea that the
full audio file, with the exception of a potential header, is going
to be sent to the client. This allows to store a sequence of offsets
as the chunk table. Each chunk is defined as the contiguous region
of the file given by two consecutive offsets.

For most audio formats, however, not every part of the file corresponds
to encoded audio. We work around this on the client side by letting
the filters detect and skip those parts which can not be fed to
the decoder.

This works generally well, but for the aac decoder we have a rather
ugly hack that skips over any non aac decoded data of its input. This
hack was never very reliable, and the concept of dynamic chunks
finally allows to get rid of it.

Dynamic chunks work as follows. Each audio format handler signifies
support by defining the new ->get_chunk method. In this case
afh_get_chunk() no longer consults the chunk table at all but calls
the new method instead in order to obtain a reference to the chunk.

This comes with a certain overhead at runtime because we need to call
into the functions of the mp4ff library (ships together with faad)
rather looking up the offset in the chunk table.

Only the aac audio format handler supports dynamic chunks per this
commit. To keep the patch size relatively small, this commit does not
touch ->get_file_info() of the aac audio format handler. Therefore,
when a new m4a file is added to the database, the aac audio format
handler still creates the chunk table. A subsequent commit will turn
off this unnecessary operation.

The documentation is updated to mention that mp4ff is now required
for the aac audio format handler. The configure script now checks
for the mp4ff header and the library and deactivates aac support if
it was not found.

7 years agoserver: Store max chunk size in database.
Andre Noll [Fri, 23 Dec 2016 16:18:21 +0000 (17:18 +0100)]
server: Store max chunk size in database.

This number is needed up-front for the initialization of the fec data
structures.  Currently we recompute it from the chunk table each time
the file is opened for streaming.

We can only get rid of the chunk table concept if we tell the VSS by
other means how to obtain this information.

Fortunately there is an unused 4-byte field in the on-disk afhi
structure, which is always zero at the moment. This patch starts to
use this field to store the maximal chunk size.

For backwards compatibility, when the afhi structure is loaded from
disk at stream time, we check if the field is zero and recompute the
max chunk size as before in this case.

Although the maximal chunk size is generally only needed on the
server side, for consistence we expose it though a new status item
along with chunk_tv and friends.

7 years agoserver: Move ->size from mmd to struct vss_task.
Andre Noll [Wed, 21 Dec 2016 12:58:28 +0000 (13:58 +0100)]
server: Move ->size from mmd to struct vss_task.

This field stores the size of the memory mapping of the current audio
file, if any. No command handler ever changes the value, and the
value is not read from com_stat(), so there is no reason for ->size
to be part of the mmd shared memory area.

Unlike ->size, the pointer to the mapping is stored in struct vss_task.
Given that vss.c is the only file which reads ->map or ->size, it
makes sense to store both values together in the vss task struct.

7 years agoaac_afh.c: Remove duplicate check for samplingFrequency.
Andre Noll [Thu, 22 Dec 2016 14:50:54 +0000 (15:50 +0100)]
aac_afh.c: Remove duplicate check for samplingFrequency.

aac_set_chunk_tv() is called after we checked that the sampling
frequency is non-zero. No need to check it again.

7 years agoload_chunk_table(): Don't trust afhi->chunks_total.
Andre Noll [Mon, 26 Dec 2016 22:50:34 +0000 (23:50 +0100)]
load_chunk_table(): Don't trust afhi->chunks_total.

Both callers pass a buffer to load_chunk_table() to initialize
afhi->chunk_table. The function does not check the size of the passed
buffer but relies on afhi->chunks_total to tell how many values to
copy from the buffer.

In other words, the buffer size gives an upper bound for the number of
chunks in the chunk table, but this bould is not checked. This patch
makes the code more robust by adding a suitable check. To this aim,
load_chunk_table() is changed to receive a pointer to an osl object
(which contains the buffer size) rather than only the buffer.

One caller, load_afd(), initializes the chunk table from a shared
memory area buffer. It does not know or care about the buffer size
so far. We introduce the the new IPC helper shm_size() to let it tell
the size of the area and pass it to load_chunk_table().

7 years agopara_server: Never read past the end of the chunk table.
Andre Noll [Thu, 22 Dec 2016 01:38:05 +0000 (02:38 +0100)]
para_server: Never read past the end of the chunk table.

If the server command "ls" is executed with the -c option to print
the chunk table, we assume that afhi->chunks_total many chunks are
stored in the osl disk object that represents the chunk table.

This should be true in general, but since we also know the size of
the osl object, it does not hurt to check this bound as well and
break out of the loop if the next read would access memory beyond
the end of the object.

7 years agot0001: Prefer shasum over sha1sum.
Andre Noll [Sun, 8 Jan 2017 16:21:04 +0000 (17:21 +0100)]
t0001: Prefer shasum over sha1sum.

Both programs reliably find mismatches, and the latter is not installed
on FreeBSD.

7 years agoMerge branch 'maint'
Andre Noll [Sun, 19 Mar 2017 15:30:33 +0000 (16:30 +0100)]
Merge branch 'maint'

Two fixes that have been cooking in for-maint for a while.

* maint:
  i9e: Restore file status flags on exit.
  NEWS,md: Add introductory text for v0.5.7.

7 years agoi9e: Restore file status flags on exit.
Andre Noll [Sat, 28 Jan 2017 18:33:26 +0000 (19:33 +0100)]
i9e: Restore file status flags on exit.

The i9e subsystem sets the stdin and stdout fds passed to i9e_open()
to nonblocking mode but misses to restore the original flags in
i9e_close(). This causes terminal applications like dialog to fail
if they are started in the same terminal after e.g. para_play was
executed.

This commit modifies i9e_open() to fetch and save the file status
flags before setting the O_NONBLOCK flag, and i9e_close() to restore
the original value. STDERR is not affected.

7 years agoNEWS,md: Add introductory text for v0.5.7.
Andre Noll [Sun, 22 Jan 2017 22:01:43 +0000 (23:01 +0100)]
NEWS,md: Add introductory text for v0.5.7.

Of course this text should have been added before v0.5.7 was released,
but somehow it got lost.

7 years agoafh.h: Fix typo in prototype of ->get_file_info().
Andre Noll [Wed, 21 Dec 2016 13:27:27 +0000 (14:27 +0100)]
afh.h: Fix typo in prototype of ->get_file_info().

The structure is called afhi throughout the tree.

7 years agoogg_afh_common.c: Remove pointless variable.
Andre Noll [Sun, 25 Dec 2016 23:55:02 +0000 (00:55 +0100)]
ogg_afh_common.c: Remove pointless variable.

The "len" variable is initialized once and never changes.

7 years agoRemove compatibility code for abstract unix domain sockets.
Andre Noll [Mon, 18 Jul 2016 21:35:48 +0000 (23:35 +0200)]
Remove compatibility code for abstract unix domain sockets.

Abstract sockets were introduced in paraslash-0.5.5 (2015-09-20). For
backwards compatibility, create_local_socket() was modified to create
an abtract socket *and* an ordinary pathname socket so that old audiod
clients (which connect to the pathname socket) would still work.

This patch breaks compatibility by going back to a single socket,
either abstract (Linux) or pathname (all other systems), as determined
in the first call to create_local_socket(). This allows to drop the
"abstract" argument of init_unix_addr() and the "mode" argument of
create_local_socket().

The code in net.c and the callers get quite a bit shorter since it
has to deal with only a single file descriptor and one type of socket.

7 years agoRemove unused E_PUBLIC_KEY.
Andre Noll [Sun, 8 Jan 2017 20:45:15 +0000 (21:45 +0100)]
Remove unused E_PUBLIC_KEY.

This should have been done in commit d9f54f43, which removed the
last user of this error code.

7 years agobuild: Add target "check" as a synonym for "test".
Andre Noll [Mon, 22 Aug 2016 15:36:05 +0000 (17:36 +0200)]
build: Add target "check" as a synonym for "test".

make check seems to be more common than make test, and "check" is the
recommended name according to the GNU standards. This patch teaches
the build system to support both targets. It also marks the test-clean,
check and test targets as phony.

7 years agobuild: Rename target "tarball" to "dist".
Andre Noll [Mon, 18 Jul 2016 18:02:49 +0000 (20:02 +0200)]
build: Rename target "tarball" to "dist".

This is the name suggested in the make manual.  We keep "tarball"
target for a while though to not break existing scripts.

7 years agobuild: Do not strip installed executables by default.
Andre Noll [Mon, 18 Jul 2016 16:49:31 +0000 (18:49 +0200)]
build: Do not strip installed executables by default.

The "install" target currently strips all executables while installing
them, which is not recommended according to GNU conventions. Instead,
there should exist the "install-strip" target for this purpose.

Moreover, the current install target assumes the GNU variant of
the install utility because we call install with --strip-program,
an option which is not available on *BSD.

This patch addresses both issues. It removes the autoconf check and
lets the user directly define the path to the install executable by
setting INSTALL, INSTALL_PROGRAM, INSTALL_DATA, as recommended by the
GNU project. These variables are used in the commands to be executed
when the install target is made. They have reasonable and portable
defaults, so not setting them at all should be fine on all supported
platforms, addressing the issue with --strip-program.

The new phony target install-strip runs install -s but does not try
to be smart about how to tell the install implementation which strip
program to use.

The cross compiling example can be simplified to reflect the fact
that CROSS_COMPILE is no longer used in the Makefile.

7 years agobuild: Support $(DESTDIR).
Andre Noll [Sun, 17 Jul 2016 19:27:12 +0000 (21:27 +0200)]
build: Support $(DESTDIR).

The DESTDIR feature is orthogonal to the existing --prefix option
to configure, and the GNU make manual strongly recommends to support
the feature, so this patch implements it.

The feature works as follows. The content of the DESTDIR make variable
is prepended to each installed target file. It is not set at all in
the Makefile, so files are installed into their expected locations by
default. For example, with the patch applied, one may say

make DESTDIR=/tmp/stage install

to install in /tmp/stage/usr/local.

Other than that, specifying DESTDIR has no effect and the value is
not included in any file contents.

7 years agobuild: Rename clean targets.
Andre Noll [Tue, 12 Jul 2016 19:56:13 +0000 (21:56 +0200)]
build: Rename clean targets.

The documentation of gnu make recommends to have targets called
mostlyclean, clean, distclean and maintainer-clean while we have clean,
clean2, distclean and maintainer clean.

This patch adds mostlyclean and removes clean2. The former target
removes the executables and all object files, clean additionally
removes the whole build directory and distclean removes, on top of
that, all files created by autoconf. Finally, maintainer-clean removes
the tarball and the files created by doxygen and global.

7 years agocrypt: Remove RC4 support.
Andre Noll [Wed, 24 Aug 2016 13:12:53 +0000 (15:12 +0200)]
crypt: Remove RC4 support.

Multiple vulnerabilities have been discovered in the RC4 stream cipher,
rendering it insecure. paraslash stopped using RC4 as the default
stream cipher since version 0.5.2 (2014-04-11), but server and client
still supported the broken cipher for backward compatibility. This
commit removes the compatibility code from both the openssl and
the libgcrypt code base, leaving aes_ctr128 as the only remaining
stream cipher.

The server still announces the aes_ctr128 feature, although it is now
mandatory because the server will enable aes_ctr128 unconditionally,
no matter whether it was requested by the client or not. The client,
on the other hand, still requests this feature, regardless of whether
it was announced by the server or not. This keeps unpatched clients =>
0.5.2 working with new servers and vice versa.

Regarding the public crypto API, sc_new() loses its boolean use_aes
parameter. Otherwise the API remains the same.

The patch also rewrites the crypto section of the manual to not
mention RC4 any more.

7 years agogcrypt: Simplify init_random_seed_or_die().
Andre Noll [Sun, 10 Jul 2016 14:43:02 +0000 (16:43 +0200)]
gcrypt: Simplify init_random_seed_or_die().

Trivial equivalent transformation which gets rid of a local variable and
one level of indentation.

7 years agogcrypt: Rename E_OEAP to E_RSA_DECODE.
Andre Noll [Sun, 10 Jul 2016 14:32:39 +0000 (16:32 +0200)]
gcrypt: Rename E_OEAP to E_RSA_DECODE.

This error code was misleading since gcry_sexp_nth_data() can fail
for other reasons as well. The patch also removes a pointless error
message.

7 years agogcrypt: Remove open-coded OAEP padding.
Andre Noll [Sun, 10 Jul 2016 14:15:37 +0000 (16:15 +0200)]
gcrypt: Remove open-coded OAEP padding.

The open-coded OAEP padding implementaton of gcrypt.c was necessary to
support old libgcrypt versions which do not have the oaep flag. These
days, everybody ought to have moved on to 1.5.0 (released 2011)
or later, so lets require this version from now on.

decode_rsa() used its key_size parameter only for old gcrypt versions,
so the parameter can be removed. Also, the E_MPI_PRINT error code
has become unused and can be removed from error.h.

Since rsa_decrypt_sexp is now constant, there is no need to have a
variable for this, so we can make it a preprocessor definition instead.

7 years agocrypt.c: Combine load_key() and get_private_key().
Andre Noll [Fri, 6 Jan 2017 17:52:13 +0000 (18:52 +0100)]
crypt.c: Combine load_key() and get_private_key().

Both functions are short and the former is only called by the latter.

7 years agocrypto: Remove support for ASN public keys.
Andre Noll [Tue, 12 Jul 2016 17:54:19 +0000 (19:54 +0200)]
crypto: Remove support for ASN public keys.

These have been deprecated for some years in favor of ssh keys
generated with ssh-keygen(1). Removing support for the deprecated
format allows to get rid of quite some ugly ASN parsing code.

Private ASN keys, however, still need to be parsed in case
libgcrypt is employed as the crypto API. So the parser in
find_privkey_bignum_offset() needs to stay.

7 years agocrypto: Simplify asymetric key handling.
Andre Noll [Sun, 10 Jul 2016 20:23:45 +0000 (22:23 +0200)]
crypto: Simplify asymetric key handling.

get_asymmetric_key() and free_asymmetric_key() are public because
para_server maintains a copy to the public key of each user so that
the keys need to be loaded only once. On the other hand, for private
keys (used in para_client) key allocation and freeing is performed
implicitly in priv_decrypt(), and no reference to the key is ever
returned. So the crypto API can be simplified by exposing the interface
only for public keys.

Hence this patch renames get_asymmetric_key() to get_public_key()
and drops the "private" argument. Similarly, free_asymmetric_key()
is renamed to free_public_key().

7 years agocrypto: Rename check_key_file() -> check_private_key_file().
Andre Noll [Sun, 10 Jul 2016 19:46:00 +0000 (21:46 +0200)]
crypto: Rename check_key_file() -> check_private_key_file().

For public keys the function only called stat(2), which is unnecessary
because only an error from the subsequent open(2) call requires to
fail the operation.

The stat() call is needed for loading private keys though, to make
sure permissions are restrictive enough.

This commit renames the function as indicated in the subject and
drops the second parameter. In crypt.c we now call this function for
private keys only.

7 years agogcrypt.c: Always initialize result pointer in get_private_key().
Andre Noll [Sun, 10 Jul 2016 20:20:03 +0000 (22:20 +0200)]
gcrypt.c: Always initialize result pointer in get_private_key().

This should not matter since the only caller, priv_decrypt(), returns
without investigating the result pointer on errors, but let's be
conservative here.

7 years agoMerge branch 'maint'
Andre Noll [Fri, 6 Jan 2017 15:18:15 +0000 (16:18 +0100)]
Merge branch 'maint'

* maint:
  base64: Remove an unused variable.

7 years agobuild: Remove compatibility check for clock_gettime().
Andre Noll [Mon, 26 Dec 2016 15:16:36 +0000 (16:16 +0100)]
build: Remove compatibility check for clock_gettime().

Only Mac OS (which is no longer supported) did not have it. Moreover,
on Linux we used to check whether one needs to link with -lrt to
obtain clock_gettime(), which is necessary for glibc versions 2.16
and earlier (released in 2012). All distributions should have moved
on to newer glibc versions by now, so let's get rid of the check.

7 years agoDrop support for Mac OS.
Andre Noll [Mon, 18 Jul 2016 18:50:41 +0000 (20:50 +0200)]
Drop support for Mac OS.

This software hasn't been tested on Mac OS for years, so Mac OS
support is most likely already broken.

This commit removes the osx writer and the autoconf tests for core
audio, and adjusts the documentation to not mention Mac OS anymore. It
also effectively reverts commit be1074b4 which introduced an ugly
workaround in interactive.c that was only needed on Mac OS.

7 years agobase64: Remove an unused variable.
Andre Noll [Wed, 4 Jan 2017 20:58:12 +0000 (21:58 +0100)]
base64: Remove an unused variable.

This is only reported on gcc-6 or newer. Not a serious issue, but
still annoying.

7 years agoMerge branch 'maint'
Andre Noll [Sun, 1 Jan 2017 01:24:17 +0000 (02:24 +0100)]
Merge branch 'maint'

* maint:
  Update copyright year to 2017.

7 years agoUpdate copyright year to 2017.
Andre Noll [Sun, 1 Jan 2017 01:21:36 +0000 (02:21 +0100)]
Update copyright year to 2017.

7 years agoparaslash 0.5.7 v0.5.7
Andre Noll [Sat, 31 Dec 2016 20:49:52 +0000 (21:49 +0100)]
paraslash 0.5.7

7 years agoMerge branch 'maint'
Andre Noll [Sat, 31 Dec 2016 20:12:33 +0000 (21:12 +0100)]
Merge branch 'maint'

A trivial conflict in configure.ac and remove/modify conflicts in
web/index.in.html and NEWS. The last file has been renamed to NEWS.md
in master. The conflict was resolved by copying the new text of the
NEWS file from maint (the release notes for v0.4.14) to NEWS.md and
to adjust the formatting to markdown syntax.

7 years agoparaslash 0.4.14 v0.4.14
Andre Noll [Sat, 31 Dec 2016 19:40:51 +0000 (20:40 +0100)]
paraslash 0.4.14

7 years agoMerge branch 'refs/heads/t/simple_error_codes'
Andre Noll [Sat, 31 Dec 2016 15:50:02 +0000 (16:50 +0100)]
Merge branch 'refs/heads/t/simple_error_codes'

Two patches which get rid of the concept of per-subsystem error
codes. The host-compiled error2.c program can be removed, configure.ac
and error.h simplified.

The merge conflicted because both sides modified error.h, but this
was easy to resolve.

* refs/heads/t/simple_error_codes:
  Sort errors alphabetically.
  Simplify the error subsystem, get rid of error2.[ch].

7 years agoMerge branch 'refs/heads/t/doc'
Andre Noll [Sat, 31 Dec 2016 15:43:01 +0000 (16:43 +0100)]
Merge branch 'refs/heads/t/doc'

The contributing section for the user manual and a few other
documentation updates.

* refs/heads/t/doc:
  signal.h: Add documentation of signal_pre_select().
  manual: Fix kernel coding style link.
  user manual: Add section on contributing.

7 years agoMerge branch 'refs/heads/t/invalid-ids'
Andre Noll [Fri, 30 Dec 2016 14:58:41 +0000 (15:58 +0100)]
Merge branch 'refs/heads/t/invalid-ids'

A single patch that was in misc for a while, and two follow up fixups
that were detected after the branch was merged into next.

* refs/heads/t/invalid-ids (cooking for two weeks):
  Makefile: Don't compile with -Wformat-signedness unconditionally.
  aft.c: Use correct format string for error output.
  touch: Refuse to set an invalid image or lyrics ID.

7 years agoMakefile: Don't compile with -Wformat-signedness unconditionally.
Andre Noll [Fri, 30 Dec 2016 14:49:59 +0000 (15:49 +0100)]
Makefile: Don't compile with -Wformat-signedness unconditionally.

This went in by mistake in the previous patch.

7 years agosignal.h: Add documentation of signal_pre_select().
Andre Noll [Tue, 27 Dec 2016 01:01:55 +0000 (02:01 +0100)]
signal.h: Add documentation of signal_pre_select().

It is a public function which should be annotated.

7 years agomanual: Fix kernel coding style link.
Andre Noll [Mon, 26 Dec 2016 20:37:26 +0000 (21:37 +0100)]
manual: Fix kernel coding style link.

The location of the coding style document for the linux kernel
has moved.

7 years agouser manual: Add section on contributing.
Andre Noll [Mon, 26 Dec 2016 16:13:28 +0000 (17:13 +0100)]
user manual: Add section on contributing.

7 years agot0004: Specify proper options for ls commands.
Andre Noll [Wed, 28 Dec 2016 20:40:42 +0000 (21:40 +0100)]
t0004: Specify proper options for ls commands.

The -p option is deprecated, and the default behaviour (if none of -p,
-F and -b is given) will change in v0.6.0. Although the tests succeed
at the moment, it seems prudent to switch to the modern syntax to
make sure the tests won't break when -p is removed and the default
behaviour is changed.

7 years agoMerge branch 'refs/heads/t/format-signedness'
Andre Noll [Wed, 28 Dec 2016 19:38:34 +0000 (20:38 +0100)]
Merge branch 'refs/heads/t/format-signedness'

This series fixes all warnings produced by compiling with
-Wformat-signedness and adds the flag to CFLAGS if the compiler
supports it.

* refs/heads/t/format-signedness (cooking for ~2 weeks):
  gcrypt: Fix a few format-signedness issues.
  Compile with -Wformat-signedness if possible.
  Fix signedness issues in format strings.

7 years agoresample: Simplify initialization().
Andre Noll [Tue, 27 Dec 2016 18:29:38 +0000 (19:29 +0100)]
resample: Simplify initialization().

In resample_init(), the first check removed in this commit was bogus
because in case there is no parent buffer tree node, we must only
abort if there is no input pending either.

In resample_post_select(), we move up the check of the node status
so that we now call resample_init() only after we know that there
is input available. This makes the second check in resample_init()
pointless as the condition can never be true.

7 years agoafh: Make sure we never return a negative chunk number.
Andre Noll [Tue, 20 Dec 2016 20:18:27 +0000 (21:18 +0100)]
afh: Make sure we never return a negative chunk number.

With the old code this could happen if chunk zero is empty.

7 years agofade: Add documentation for main() and include it in doxygen.
Andre Noll [Wed, 28 Dec 2016 01:08:54 +0000 (02:08 +0100)]
fade: Add documentation for main() and include it in doxygen.

The two mixer implementations for OSS and ALSA are also included,
both of which are only used by para_fade. So it makes sense to include
para_fade as well. main() is the only a non-static function, so let's
doxify that.

7 years agosched: Log task termination status.
Andre Noll [Sat, 29 Oct 2016 20:23:14 +0000 (22:23 +0200)]
sched: Log task termination status.

This is generally useful information, so let's include it in the
log message.

7 years agoMerge branch 'refs/heads/t/wma_fixes'
Andre Noll [Wed, 28 Dec 2016 12:05:34 +0000 (13:05 +0100)]
Merge branch 'refs/heads/t/wma_fixes'

The series also contains a fix for a silly bug which causes the decoder
to abort on empty output sizes, and a couple of cosmetic cleanups.

* refs/heads/t/wma_fixes (cooking for two weeks):
  wmadec: Remove two pointless variables.
  wmadec: Remove a pointless cast.
  wmadec: Set data size to 0 if nothing was decoded.
  wma: Fix packet size calculation.
  wmadec: Properly handle empty outputs.
  wma_common: Fix typo in log message.

7 years agoMerge branch 'refs/heads/t/openssl-1.1'
Andre Noll [Tue, 27 Dec 2016 15:29:29 +0000 (16:29 +0100)]
Merge branch 'refs/heads/t/openssl-1.1'

In openssl-1.1 several structures have been made opaque, breaking both
the stream cipher and the public key functions in crypt.c. This series
deals with these issues, trying to minimize the ifdeffery.

* refs/heads/t/openssl-1.1 (cooking for three months):
  openssl: RSA fixes for openssl-1.1.
  openssl: Use EVP API for AES.

7 years agoMerge branch 'refs/heads/t/ls-p_deprecation'
Andre Noll [Mon, 26 Dec 2016 12:27:01 +0000 (13:27 +0100)]
Merge branch 'refs/heads/t/ls-p_deprecation'

Preparation for changing the semantics of the -p option to com_ls()
of para_server. Cooking for four months.

* refs/heads/t/ls-p_deprecation:
  server: Deprecate ls -p.

7 years agoweb: Fix link to git branches.
Andre Noll [Sun, 25 Dec 2016 21:47:14 +0000 (22:47 +0100)]
web: Fix link to git branches.

The link broke several months ago in commit a2c5e36 which converted
the manual to markdown.

7 years agoafh.h: Trivial whitespace fix.
Andre Noll [Sun, 25 Dec 2016 15:02:26 +0000 (16:02 +0100)]
afh.h: Trivial whitespace fix.

Git complains about this: "space before tab in indent".

7 years agoMerge branch 'refs/heads/t/daemonize-fix'
Andre Noll [Sat, 24 Dec 2016 22:25:54 +0000 (23:25 +0100)]
Merge branch 'refs/heads/t/daemonize-fix'

Two bug fixes for race conditions during server startup, and an
improved log message. Cooking for two months.

* refs/heads/t/daemonize-fix:
  server: Fix race condition in afs startup.
  daemon: Fix race condition in daemonize().
  daemon: Improve "daemonizing" log message.

7 years agoportable_io.h: Provide big-endian versions and use them for aac.
Andre Noll [Mon, 16 Dec 2013 21:18:27 +0000 (22:18 +0100)]
portable_io.h: Provide big-endian versions and use them for aac.

The aac audio format handler code contains some instances that read a
big-endian encoded 32 or 64 bit number from a buffer. While for the
32 bit case there is a helper function aac_read_int32(), the 64 bit
case is open-coded.

We already have similar functions for the conversion of little-endian
entities. This patch adds their big endian counterparts as inline
functions to portable_io.h and changes the callers to use those.

The patch also gets rid of two fprintf() statements in write_portable()
which were commented out for ages.

7 years agoaac: Switch from unsigned char to char.
Andre Noll [Mon, 16 Dec 2013 21:06:44 +0000 (22:06 +0100)]
aac: Switch from unsigned char to char.

The faad library functions take unsigned char pointers while most of
the paraslash code prefers plain char *. It's easier to use char *
in all paraslash functions and cast the arguments of the faad library
function calls than to have a mix of both types.

7 years agoplay: Minor log message improvements.
Andre Noll [Tue, 31 Mar 2015 01:33:11 +0000 (01:33 +0000)]
play: Minor log message improvements.

open_new_file() returns an error code on failure, so it should not print
the corresponding strerror text.

The patch also adds messages which logs the active decoder and the
buffer tree with loglevel INFO.

7 years agoSort errors alphabetically.
Andre Noll [Sun, 28 Aug 2016 17:00:11 +0000 (19:00 +0200)]
Sort errors alphabetically.

Keeping the list sorted minimizes the potential for merge conflicts in the
common case where two branches introduce new error codes.

7 years agoSimplify the error subsystem, get rid of error2.[ch].
Andre Noll [Sun, 28 Aug 2016 16:46:22 +0000 (18:46 +0200)]
Simplify the error subsystem, get rid of error2.[ch].

This commit removes error2.c and the surrounding infrastructure of
the build system, getting rid of ~600 LOC.

After the change there are no more subsystems for error codes, and we
don't need to host-compile error2.c any more. Since all executables
now contain the text of every error code, the change has some impact
on the sizes of the (stripped) executables:

     Before:                         After:

 64K para_afh               71K para_afh
 43K para_audioc            47K para_audioc
256K para_audiod           259K para_audiod
 64K para_client            71K para_client
 39K para_fade              47K para_fade
141K para_filter           144K para_filter
 51K para_gui               59K para_gui
252K para_play             255K para_play
 97K para_recv             104K para_recv
227K para_server           230K para_server
 60K para_write             67K para_write

This increase in size is justified by the major simplification.

7 years agoMerge branch 'refs/heads/t/base64'
Andre Noll [Tue, 20 Dec 2016 14:40:09 +0000 (15:40 +0100)]
Merge branch 'refs/heads/t/base64'

A couple of patches which move the base64 code to a separate file,
and improve on it. Was cooking for several months.

* refs/heads/t/base64:
  base64: Speed up decoder by using a table.
  base64: Use para_isspace() everywhere.
  base64: Trivial whitespace fixes.
  base64: Replace Pad64 variable by macro.
  base64: Remove unnecessary overflow checks.
  base64: Saner semantics for base64_decode() and uudecode().
  Move base64 implementation to own file.

7 years agoaft.c: Use correct format string for error output.
Andre Noll [Mon, 19 Dec 2016 23:12:19 +0000 (00:12 +0100)]
aft.c: Use correct format string for error output.

Both ->image_id and ->lyrics_id are of signed type.

7 years agoMerge branch 'refs/heads/t/rm_source_browser'
Andre Noll [Mon, 19 Dec 2016 17:06:52 +0000 (18:06 +0100)]
Merge branch 'refs/heads/t/rm_source_browser'

Cooking for five months.

A single patch which gets rid of the source browser generated with
global, reducing the size of the web pages considerably.

* refs/heads/t/rm_source_browser:
  web: Remove extra source browser.

7 years agowmadec: Remove two pointless variables.
Andre Noll [Thu, 8 Dec 2016 23:22:57 +0000 (00:22 +0100)]
wmadec: Remove two pointless variables.

The local variables n and incr of wma_decode_frame() shadow the
values of their counterparts in struct private_wmadec_data, and they
remain constant within the function. Referring directly to the private
structure instead makes the code shorter and improves readability.

7 years agowmadec: Remove a pointless cast.
Andre Noll [Thu, 8 Dec 2016 22:59:26 +0000 (23:59 +0100)]
wmadec: Remove a pointless cast.

The address of "in" is already of type char **.

7 years agowmadec: Set data size to 0 if nothing was decoded.
Andre Noll [Thu, 8 Dec 2016 20:32:32 +0000 (21:32 +0100)]
wmadec: Set data size to 0 if nothing was decoded.

Without this, we might feed uninitialized data into the output stream.

7 years agowma: Fix packet size calculation.
Andre Noll [Tue, 1 Nov 2016 10:44:53 +0000 (11:44 +0100)]
wma: Fix packet size calculation.

Usually the (fixed) packet size of a wma file equals the block align
value plus WMA_FRAME_SKIP. However, this is not true in general,
and if the two values differ, we fail to decode the file and bail
out with an "incoherent block length" error.

This patch adds code to read the correct packet size from the file
properties object and uses this value in the decoder and the audio
format handler.

7 years agogcrypt: Fix a few format-signedness issues.
Andre Noll [Sun, 11 Dec 2016 10:55:31 +0000 (11:55 +0100)]
gcrypt: Fix a few format-signedness issues.

These were missed in the first batch because gcrypt.c is not compiled
in unless --enable-cryptolib=gcrypt is given.

7 years agowmadec: Properly handle empty outputs.
Andre Noll [Tue, 1 Nov 2016 05:10:00 +0000 (06:10 +0100)]
wmadec: Properly handle empty outputs.

If out_size is zero we try to shrink the buffer to size zero. POSIX
says that the behavior is implementation-defined in this case, and
para_realloc() aborts due to an assert() statement that checks for
size zero. This patch makes sure the wma decoder never calls realloc()
with a zero size argument.

7 years agowma_common: Fix typo in log message.
Andre Noll [Sun, 30 Oct 2016 16:51:50 +0000 (17:51 +0100)]
wma_common: Fix typo in log message.

7 years agoCompile with -Wformat-signedness if possible.
Andre Noll [Wed, 23 Nov 2016 22:17:10 +0000 (23:17 +0100)]
Compile with -Wformat-signedness if possible.

We can't activate this warning unconditionally because it is not
supported on older compilers, including clang. Therefore we introduce
a build time check and add the option only if the compiler supports it.