]> git.tuebingen.mpg.de Git - paraslash.git/log
paraslash.git
6 years agoMerge branch 'refs/heads/t/portable_io'
Andre Noll [Sun, 3 Sep 2017 08:28:30 +0000 (10:28 +0200)]
Merge branch 'refs/heads/t/portable_io'

A small series with no user-visible impact. After this is merged,
no more casts are necessary for pointers passed to read_u*() and
write_u*() and their big-endian counterparts.

Cooking for five weeks.

* refs/heads/t/portable_io:
  blob: Remove some unnecessary casts for arguments to read_u32().
  crypt: Remove read_ssh_u32().
  Let helpers in portable_io.h receive void * arguments.

6 years agoMerge branch 'refs/heads/t/si_conversion'
Andre Noll [Sun, 27 Aug 2017 10:11:22 +0000 (12:11 +0200)]
Merge branch 'refs/heads/t/si_conversion'

A single patch which moves the list of status items from configure.ac
to para.h.

Cooking for five weeks.

* refs/heads/t/si_conversion:
  Define status items in para.h.

6 years agomanual: Fix typo.
Andre Noll [Sat, 26 Aug 2017 18:44:24 +0000 (20:44 +0200)]
manual: Fix typo.

6 years agomanual: Update URLs which give 301.
Andre Noll [Sat, 26 Aug 2017 18:40:08 +0000 (20:40 +0200)]
manual: Update URLs which give 301.

The link to the discount page is missing a trailing slash. For all
others the URL is redirected permanently to the https variant.

Found by the w3m link checker.

6 years agomanual: Fix typo in link.
Andre Noll [Sat, 26 Aug 2017 18:31:41 +0000 (20:31 +0200)]
manual: Fix typo in link.

The leading slash results in a "Missing fragment" error. Found by
the w3m link checker.

6 years agofilter: Simplify FOR_EACH_FILTER().
Andre Noll [Mon, 14 Aug 2017 00:00:33 +0000 (02:00 +0200)]
filter: Simplify FOR_EACH_FILTER().

Use the FILTER_CMD() macro rather than open-coding it.

6 years agofd.c: Remove para_fchdir().
Andre Noll [Sun, 13 Aug 2017 01:59:35 +0000 (03:59 +0200)]
fd.c: Remove para_fchdir().

It was a trivial wrapper which was used only in
for_each_file_in_dir(). Just open-code it there.

6 years agoaudiod: Add log message for receiver errors.
Andre Noll [Fri, 11 Aug 2017 10:18:26 +0000 (12:18 +0200)]
audiod: Add log message for receiver errors.

If the receiver could not be opened, we return negative from
open_receiver() and audiod prints an error message which contains the
error string. However, this message is confusing because it does not
say that the error came from open_receiver(), much less which receiver
caused the error. The new log message should clarify this.

6 years agoMerge branch 'refs/heads/t/si_update'
Andre Noll [Sun, 20 Aug 2017 13:54:25 +0000 (15:54 +0200)]
Merge branch 'refs/heads/t/si_update'

A single patch which teaches the afs event handler to trigger a status
item update when the image or lyrics table changes. This patch had a
bug which was only noticed after the branch had been merged to next.
Therefore the series contains a fixup commit.

Cooking for almost two months.

* refs/heads/t/si_update:
  server: Avoid NULL pointer dereference in make_status_items().
  Update status items on blob events.

6 years agoserver: Fix typo in comment.
Andre Noll [Sat, 12 Aug 2017 23:13:38 +0000 (01:13 +0200)]
server: Fix typo in comment.

Introduced in the lopsub conversion patch.

6 years agoserver: Fix typo in comment for init_user_list().
Andre Noll [Sat, 12 Aug 2017 22:54:15 +0000 (00:54 +0200)]
server: Fix typo in comment for init_user_list().

6 years agoForce status item update on mood/playlist changes.
Andre Noll [Sun, 30 Jul 2017 00:25:26 +0000 (02:25 +0200)]
Force status item update on mood/playlist changes.

This patch increments the mmd event counter whenever a new playlist
or mood is loaded. This instructs the stat command handlers to resend
the list of status items to all connected stat clients.

6 years agoafs: Use correct error code for com_select().
Andre Noll [Sun, 30 Jul 2017 00:04:47 +0000 (02:04 +0200)]
afs: Use correct error code for com_select().

If the argument does not start with "m/" or "p/" we have an invalid
argument rather than a syntax error. This removes the last user of
E_AFS_SYNTAX, so the error code can be removed as well.

6 years agomood.c: Don't try twice to activate an invalid mood.
Andre Noll [Sun, 9 Jul 2017 21:31:43 +0000 (23:31 +0200)]
mood.c: Don't try twice to activate an invalid mood.

(Re-)loading a mood by executing the "select" server command fails
if the mood definition is invalid. In this case we first try to
switch back to the old mood, and if this also fails, fall back to
the dummy mood.

If the mood which is currently active has been replaced by an invalid
mood, switching back to the old mood is pointless because this will
try to load the same invalid mood again.

This commit modifies the select callback to load the old mood only
if it is different from the new mood.

6 years agoaft: Make get_audio_file_path_of_row() more robust.
Andre Noll [Sun, 9 Jul 2017 13:05:53 +0000 (15:05 +0200)]
aft: Make get_audio_file_path_of_row() more robust.

On errors we used to leave the path pointer uninitialized. This
commit sets it to NULL in this case.

6 years agoafs: Improve error diagnostics.
Andre Noll [Sun, 9 Jul 2017 11:57:47 +0000 (13:57 +0200)]
afs: Improve error diagnostics.

If the given mood or playlist could not be opened, we silently switch
to the dummy mood. Let's tell the user what has happened, and why.

6 years agomood.c: Remove some superfluous includes.
Andre Noll [Sat, 8 Jul 2017 22:39:57 +0000 (00:39 +0200)]
mood.c: Remove some superfluous includes.

mood.c does not use any of the ipc, sideband, sched subsystems
directly.

6 years agovss: Remove self-made prefaulting.
Andre Noll [Sun, 6 Aug 2017 12:05:36 +0000 (14:05 +0200)]
vss: Remove self-made prefaulting.

It used to help a bit on a very old laptop with broken IDE hardware,
see commit 7bba6232 (vss: Mmap audio files using MAP_POPULATE) from
six years ago. But even there it did not eliminate buffer underruns
completely. Our prefault code is too ugly to live, and its benefits
are questionable at best, so let's get rid of it.

We still map the audio file with MAP_POPOLATE, which should be enough
get the full audio file cached before chunks are sent.

6 years agobuild: Prefer AC_CHECK_TYPE() over AC_LINK_IFELSE().
Andre Noll [Sat, 5 Aug 2017 16:01:41 +0000 (18:01 +0200)]
build: Prefer AC_CHECK_TYPE() over AC_LINK_IFELSE().

Both invocations of AC_LINK_IFELSE() check if a C structure is
defined. We don't need to run the linker for that, saving a few cycles
on Linux systems where both structures are defined.

6 years agoserver: Get rid of a dead store.
Andre Noll [Sun, 6 Aug 2017 11:36:51 +0000 (13:36 +0200)]
server: Get rid of a dead store.

We jump to the success label which sets ret no a non-negative value.
Found by the clang static analyzer.

6 years agowma_afh: Add some assert() statements.
Andre Noll [Sun, 6 Aug 2017 13:13:04 +0000 (15:13 +0200)]
wma_afh: Add some assert() statements.

The clang static analyzer seems to have a hard time proving that if
convert_utf8_to_utf16() returns non-negative, the destination pointer
is non-null. This patch should help it.

6 years agoMerge branch 'maint'
Andre Noll [Fri, 11 Aug 2017 12:05:09 +0000 (14:05 +0200)]
Merge branch 'maint'

* maint:
  server: Perform hostname lookup in client process.
  server: Fix memory leak in com_check().

6 years agoserver: Perform hostname lookup in client process.
Andre Noll [Sun, 6 Aug 2017 20:50:15 +0000 (22:50 +0200)]
server: Perform hostname lookup in client process.

When a connection arrives at the TCP command socket, the server process
looks up the remote name before it forks the child process. This is bad
because the server process can not afford to sleep, but name lookup may
take some time, for example if a DNS server is currently unavailable.

We may as well look up the hostname after the fork in the child
process, where blocking operations are not a problem.

6 years agoserver: Fix memory leak in com_check().
Andre Noll [Sun, 6 Aug 2017 19:24:03 +0000 (21:24 +0200)]
server: Fix memory leak in com_check().

parse_mood_line() is called by the select command to set up a mood
item structure for each line of the mood definition. The item is stored
in one of the three lists of the mood structure provided by the caller.

The check command also calls parse_mood_line() to verify the mood
definitions. However, since it does not create a new mood, it does
not allocate a mood structure and passes a null pointer instead.

parse_mood_line() frees the mood item in the error case, but misses
to do so if a successfully parsed mood line was not added to any of
the three lists because the mood pointer is NULL, leaking the mood
item. This commit plugs the leak by adjusting the condition on which
to free the mood item.

This bug was introduced 10 years ago when mood checking was implemented
in commit 02baea14. It was found by code inspection.

6 years agoserver: Rename init_vss_task() to vss_init().
Andre Noll [Mon, 7 Aug 2017 17:51:15 +0000 (19:51 +0200)]
server: Rename init_vss_task() to vss_init().

The function not only initializes the vss task but also the three
senders. Moreover, all other public functions of vss.c are also
prefixed with vss_. Finally, the new name is shorter.

6 years agoserver: Remove unused ->peer from struct command_context.
Andre Noll [Sun, 6 Aug 2017 20:40:05 +0000 (22:40 +0200)]
server: Remove unused ->peer from struct command_context.

It is initialized in handle_connect() but never used.

6 years agoserver: Fix comment of empty_status_items().
Andre Noll [Mon, 7 Aug 2017 21:01:16 +0000 (23:01 +0200)]
server: Fix comment of empty_status_items().

The function is not "used by vss", it is not even visible from vss.c
as it is a static function defined in command.c. De-doxyfy the comment
while at it.

6 years agoserver: Kill two pointless variables in vss.c.
Andre Noll [Mon, 7 Aug 2017 17:17:42 +0000 (19:17 +0200)]
server: Kill two pointless variables in vss.c.

Both variables are set but never used. The two variables were
introduced back in the CVS days and have been pointless for the whole
git history since 2006.

6 years agovss: Make fec_active a bool.
Andre Noll [Sun, 6 Aug 2017 14:22:29 +0000 (16:22 +0200)]
vss: Make fec_active a bool.

It's used as a boolean, so don't declare it as integer.

6 years agovss: Improve comment about sending empty chunks.
Andre Noll [Sun, 6 Aug 2017 14:36:17 +0000 (16:36 +0200)]
vss: Improve comment about sending empty chunks.

The old comment was misplaced, and "they" referred to the chunks,
while "senders" was intended.

6 years agovss: Fix trivial whitespace issue.
Andre Noll [Sun, 6 Aug 2017 14:20:55 +0000 (16:20 +0200)]
vss: Fix trivial whitespace issue.

No need to wrap this line, it's short enough.

6 years agostring.h: Fix indentation, add doxygen reference.
Andre Noll [Sat, 5 Aug 2017 18:01:27 +0000 (20:01 +0200)]
string.h: Fix indentation, add doxygen reference.

The comment was improperly formatted, and the reference to
para_printf() lacked a \ref statement.

6 years agoMerge branch 'maint'
Andre Noll [Sun, 6 Aug 2017 21:02:17 +0000 (23:02 +0200)]
Merge branch 'maint'

* maint:
  stdin/stdout: Only set nonblock flags for non-tty fds.

6 years agoMerge branch 'refs/heads/t/lopsub'
Andre Noll [Sun, 6 Aug 2017 13:56:25 +0000 (15:56 +0200)]
Merge branch 'refs/heads/t/lopsub'

Three simple patches for the build system, all related to lopsub.

Cooking for three weeks.

* refs/heads/t/lopsub:
  build: Echo "M4" when running an m4 command.
  build: Run lopsubgen with absolute path.
  build: Improve lopsub error diagnostics.

6 years agoImprove documentation of signal_init_or_die().
Andre Noll [Fri, 28 Jul 2017 21:13:52 +0000 (23:13 +0200)]
Improve documentation of signal_init_or_die().

Prefix the reference to para_install_sighandler() with \ref to make
sure doxygen warns if the reference becomes stale, and fix the man
section of exit(): it is not a system call (but _exit() is).

6 years agoautogen: Run make check after a successful build.
Andre Noll [Sun, 16 Jul 2017 12:06:58 +0000 (14:06 +0200)]
autogen: Run make check after a successful build.

This helps to run the test suite more often, so bugs get caught
earlier.

6 years agostdin/stdout: Only set nonblock flags for non-tty fds.
Andre Noll [Sun, 30 Jul 2017 21:11:38 +0000 (23:11 +0200)]
stdin/stdout: Only set nonblock flags for non-tty fds.

Although the ->post_select methods of all paraslash executables perform
I/O only when select(2) reports that the file descriptor is ready,
we set the O_NONBLOCK flag for all monitored fds. This is considered
good practice because, in general, it might happen that a subsequent
read(2) call blocks even if select(2) indicates that the fd is ready
for reading. For example, an fd corresponding to a TCP socket might
be flagged as ready for reading if a network packet with incorrect
checksum has arrived, but a subsequent read(2) blocks until the packet
has been retransmitted.

However, stdin and stdout often correspond to a terminal device where
the above scenario won't happen. Moreover, for terminals it's essential
to reset the O_NONBLOCK flag to the old value on exit because the
shell refers to the same file description and thus shares the file
status flags, including O_NONBLOCK. Many terminal applications, for
example dialog(1), expect stdout to be set to blocking mode and fail
in arcane ways if O_NONBLOCK is set.

When the stdin and stdout tasks are about to exit, they reset the
file status flags back to the original values. However if "para_client
stat" is killed with SIGINT, SIGTERM or SIGKILL, or put to sleep with
SIGSTOP, the O_NONBLOCK flag remains set because para_client does not
handle signals at all. para_recv, para_filter and para_write suffer
from the same issue. Adding signal handling to these programs would
not help in the SIGSTOP case because this signal can not be caught.

This patch modifies stdin.c and stdout.c to no longer set O_NONBLOCK
for fd 0 and fd 1 if these fds are associated with a terminal
device. This is much easier and should do the job as well.

6 years agoMerge branch 'refs/heads/t/wma'
Andre Noll [Sat, 5 Aug 2017 12:05:52 +0000 (14:05 +0200)]
Merge branch 'refs/heads/t/wma'

A couple of patches which simplify the wma decoder and improve the
robustness of the bitstream API.

Cooking for a month.

* refs/heads/t/wma:
  wma: Remove _XOPEN_SOURCE define from wmadec_filter.c.
  wma: make ->ms_stereo local to wma_decode_block().
  wma: Simplify init_coef_vlc().
  wma: Rename input/output buffer variables.
  wma: Drop unused argument from wma_decode_superframe().
  wma: Remove pointless/incorrect sanity checks.
  wma: Combine wmadec_cleanup() and wmadec_close().
  wma: Simplify get_vlc().
  wma: Remove pointless VLC_TYPE define.
  wma: Make bitstream API more robust.

6 years agoserver: Remove -F option to ls.
Andre Noll [Tue, 18 Jul 2017 23:56:58 +0000 (01:56 +0200)]
server: Remove -F option to ls.

Quoting the current help text of the option:

This option is the default, so it does nothing. Deprecated as of
v0.6.0, scheduled for removal in v0.6.1.

This patch gets rid of the option and also adjusts the test suite,
which still used it.

6 years agoserver: Make sender subcommand array const.
Andre Noll [Mon, 24 Jul 2017 23:39:58 +0000 (01:39 +0200)]
server: Make sender subcommand array const.

Also the array itself (not just the subcommands) are constant.

6 years agoMerge branch 'maint'
Andre Noll [Mon, 31 Jul 2017 09:47:20 +0000 (11:47 +0200)]
Merge branch 'maint'

A fix for the udp sender which silences an annoying log message.

* maint:
  udp sender: Send EOF package only once.

6 years agoudp sender: Send EOF package only once.
Andre Noll [Wed, 26 Jul 2017 18:45:27 +0000 (20:45 +0200)]
udp sender: Send EOF package only once.

We already have the per target ->sent_fec_eof flag, but we only set it
after the EOF packet was sent *successfully*. It's pointless to send
the packet more than once, so this patch modifies udp_close_target() to
set the flag regardless of whether the write(2) call succeeded.

6 years agoserver: Fix segfault in com_sender().
Andre Noll [Mon, 24 Jul 2017 22:18:50 +0000 (00:18 +0200)]
server: Fix segfault in com_sender().

Commit 1709cc8f (server: Convert non-afs commands to lopsub) from
one year ago dropped the terminating NULL pointer from the array
of sender commands, presumably because the array size is declared
as the NUM_SENDER_CMDS enum constant, and this constant can be used
to iterate over all sender subcommands.

However, the loop in check_sender_args() of command.c does not
terminate the loop after NUM_SENDER_CMDS elements but only when it
encounters a NULL pointer. Hence, without the terminating NULL, the
code reads beyond the end of the array. The resulting invalid memory
access causes the command handler process to segfault.

Fix this by changing the termination condition of the loop to check
the loop variable against NUM_SENDER_CMDS.

6 years agoMerge branch 'maint'
Andre Noll [Fri, 28 Jul 2017 08:03:34 +0000 (10:03 +0200)]
Merge branch 'maint'

A fix for an old bug which should be propagated to master and next.

* maint:
  vss: Avoid use after free in vss_send().

6 years agovss: Avoid use after free in vss_send().
Andre Noll [Mon, 24 Jul 2017 15:26:44 +0000 (17:26 +0200)]
vss: Avoid use after free in vss_send().

In vss_send() we increment the current slice number for the fec
client after fc->send_fec() has sent a slice. This results in a use
after free in case of a write error because ->send_fec() frees the
fec client structure on write errors. Valgrind complains about this
with the splat below.

To avoid this, the fc pointer must not be dereferenced after
->send_fec() has been called. This patch increases the current slice
number *before* the call to ->send_fec(). This works because the fec
clients do not care about this number.

The bug was introduced eight years ago in commit 625c5cd (Add forward
error correction code to the udp sender/receiver).

==8615== Invalid read of size 1
==8615==    at 0x805022B: vss_send (vss.c:1051)
==8615==    by 0x805022B: vss_post_select (vss.c:1168)
==8615==    by 0x8061DC7: call_post_select (sched.c:84)
==8615==    by 0x8061DC7: sched_post_select (sched.c:110)
==8615==    by 0x8061DC7: schedule (sched.c:163)
==8615==    by 0x804CBFD: main (server.c:607)
==8615==  Address 0x4670168 is 80 bytes inside a block of size 116 free'd
==8615==    at 0x402D221: free (vg_replace_malloc.c:530)
==8615==    by 0x8062D7C: udp_delete_target (udp_send.c:80)
==8615==    by 0x80630DC: udp_send_fec (udp_send.c:305)
==8615==    by 0x805022A: vss_send (vss.c:1049)
==8615==    by 0x805022A: vss_post_select (vss.c:1168)
==8615==    by 0x8061DC7: call_post_select (sched.c:84)
==8615==    by 0x8061DC7: sched_post_select (sched.c:110)
==8615==    by 0x8061DC7: schedule (sched.c:163)
==8615==    by 0x804CBFD: main (server.c:607)
==8615==  Block was alloc'd at
==8615==    at 0x402C1F0: malloc (vg_replace_malloc.c:299)
==8615==    by 0x8052D7E: para_malloc (string.c:67)
==8615==    by 0x8052FBD: para_calloc (string.c:90)
==8615==    by 0x804F48F: vss_add_fec_client (vss.c:686)
==8615==    by 0x8063433: udp_com_add (udp_send.c:342)
==8615==    by 0x8063688: udp_init_target_list (udp_send.c:395)
==8615==    by 0x806371D: udp_send_init (udp_send.c:442)
==8615==    by 0x805062A: init_vss_task (vss.c:1195)
==8615==    by 0x804CA57: server_init (server.c:537)
==8615==    by 0x804CA57: main (server.c:605)

6 years agoblob: Remove some unnecessary casts for arguments to read_u32().
Andre Noll [Thu, 20 Jul 2017 15:41:22 +0000 (17:41 +0200)]
blob: Remove some unnecessary casts for arguments to read_u32().

Since read_u32() has been modified to receive a void * pointer,
these casts are no longer needed.

6 years agocrypt: Remove read_ssh_u32().
Andre Noll [Sat, 15 Jul 2017 13:24:07 +0000 (15:24 +0200)]
crypt: Remove read_ssh_u32().

It was just another implementation of read_u32_be(). This commit makes
the crypto code use the helper of portable_io.h instead.

6 years agoLet helpers in portable_io.h receive void * arguments.
Andre Noll [Sat, 15 Jul 2017 13:19:32 +0000 (15:19 +0200)]
Let helpers in portable_io.h receive void * arguments.

The functions have to convert the bytes to uint8_t (aka unsigned char)
anyway, so allow to pass any pointer type.

6 years agoMerge branch 'refs/heads/t/hash-sort-for-ls'
Andre Noll [Sun, 23 Jul 2017 13:23:03 +0000 (15:23 +0200)]
Merge branch 'refs/heads/t/hash-sort-for-ls'

A single commit which allows to pass -s=h to the ls command for
sorting the output by hash value.

Cooking for six weeks.

* refs/heads/t/hash-sort-for-ls:
  server: Introduce hash sort for ls command.

6 years agoMake dummy completers static.
Andre Noll [Tue, 13 Jun 2017 19:39:12 +0000 (21:39 +0200)]
Make dummy completers static.

This revealed that the completers for SUPERCOMMAND_UNAVAILABLE are all
unused..

6 years agoMerge branch 'refs/heads/t/doxygen'
Andre Noll [Fri, 21 Jul 2017 17:45:31 +0000 (19:45 +0200)]
Merge branch 'refs/heads/t/doxygen'

This series contains an update of Doxyfile to a newer doxygen version
and an overhaul of the source code documentation. Several stale
references have been fixed. Other parts of the documentation have
been improved.

Cooking for almost a month.

* refs/heads/t/doxygen:
  aft.c: Trivial spelling/whitespace fixes.
  afh: Expand documentation of init function declarations.
  filter: Remove duplicate documentation of filter_get().
  doxygen: Improve documentation of struct receiver.
  doxygen: Add \ref to references.
  Improve documentation of mm.c and mm.h.
  doxygen: Don't refer to Black Hats Manual.
  doxygen: Don't refer to libosl functions.
  doxygen: Trivial cleanups.
  doxygen: Remove some stale doxygen references.
  recv: Explain user data mechanism.
  Update to doxygen-1.8.11.

The merge resulted in a few conflicts which were easy to resolve.

6 years agoDefine status items in para.h.
Andre Noll [Fri, 14 Jul 2017 15:11:32 +0000 (17:11 +0200)]
Define status items in para.h.

The only reason the status item enum and string array are defined in
configure.ac is that upper case identifiers and lower case strings
are not easy to do in cpp as it lacks toupper().

However, configure.ac is not the right place for defining C language
constructs as the configure script should only check for installed
packages.

This commit moves the definition of the status item enum and array to
para.h and modifies all users to use lower case for the item names.
This was automated with a script which essentially did

upper=${i^^}
sed -i "s/\<SI_$upper/SI_$i/g" $files

for each status item $i. Care has been taken to leave the order of
the status items unchanged. This is important because the item numbers
must be considered part of the API between server and client.

6 years agoafh: Unify name of init functions.
Andre Noll [Fri, 14 Jul 2017 18:05:21 +0000 (20:05 +0200)]
afh: Unify name of init functions.

The init functions of the mp3 and ogg audio format handlers lacked
the _afh part in the name which all other audio format handlers have.

6 years agoafh: Fix typo in comment.
Andre Noll [Fri, 14 Jul 2017 18:45:57 +0000 (20:45 +0200)]
afh: Fix typo in comment.

6 years agoaft.c: Improve documentation of get_afhi_of_row().
Andre Noll [Tue, 11 Jul 2017 17:33:31 +0000 (19:33 +0200)]
aft.c: Improve documentation of get_afhi_of_row().

It is not obvious that the function initializes the afh_info structure
so that its members point to memory-mapped data. This comment adds
some clarifying comments.

6 years agomood.c: Rename compute_mood_score().
Andre Noll [Thu, 6 Jul 2017 18:46:29 +0000 (20:46 +0200)]
mood.c: Rename compute_mood_score().

The main purpose of this function is to determine whether the
audio file is admissible with respect to the given mood. So
row_is_admissible() is more to the point.

6 years agomood.c: Trivial whitespace fixes.
Andre Noll [Thu, 6 Jul 2017 19:52:45 +0000 (21:52 +0200)]
mood.c: Trivial whitespace fixes.

6 years agoserver: Avoid NULL pointer dereference in make_status_items().
Andre Noll [Sun, 16 Jul 2017 14:21:07 +0000 (16:21 +0200)]
server: Avoid NULL pointer dereference in make_status_items().

The previous patch (Update status items on blob events) modified the
aft event handler to call make_status_items() on certain blob events
because the event could have rendered the current status information
stale.

However, if no audio file is open at the time the event occurs,
make_status_items() triggers a segfault because the ->path and ->hash
members of status_item_ls_data are NULL in this case.

This patch avoids the problem by returning early from
make_status_items() if ->path is NULL.

6 years agoRemove some unnecessary includes.
Andre Noll [Sun, 9 Jul 2017 18:20:05 +0000 (20:20 +0200)]
Remove some unnecessary includes.

These headers are already included with para.h.

6 years agogui: Trivial whitespace and spelling fixes.
Andre Noll [Sat, 15 Jul 2017 12:01:28 +0000 (14:01 +0200)]
gui: Trivial whitespace and spelling fixes.

Nothing interesting in this patch..

6 years agoaft: Fix a typo in comment.
Andre Noll [Sun, 16 Jul 2017 00:21:59 +0000 (02:21 +0200)]
aft: Fix a typo in comment.

6 years agoafs: Improve documentation of callback_result_handler.
Andre Noll [Sun, 16 Jul 2017 00:07:48 +0000 (02:07 +0200)]
afs: Improve documentation of callback_result_handler.

The old text was rather incomprehensive ("chunks to data").

6 years agobuild: Remove an unused function from configure.ac.
Andre Noll [Fri, 14 Jul 2017 13:55:28 +0000 (15:55 +0200)]
build: Remove an unused function from configure.ac.

This function has become unused with the removal of gengetopt, but
we missed to drop it back then.

6 years agobuild: Fix typo in comment to HAVE_IP_MREQN.
Andre Noll [Sat, 8 Jul 2017 23:15:41 +0000 (01:15 +0200)]
build: Fix typo in comment to HAVE_IP_MREQN.

Introduced in 2009 when the --udp_mcast_iface option was implemented
and the check for struct ip_mreqn was added.

6 years agomanual: Add a sentence about release notifications.
Andre Noll [Sat, 15 Jul 2017 13:37:43 +0000 (15:37 +0200)]
manual: Add a sentence about release notifications.

This patch was meant to be applied years ago, but it got stashed
and then forgotten.

6 years agomanual: Fix typo.
Andre Noll [Sat, 15 Jul 2017 13:33:47 +0000 (15:33 +0200)]
manual: Fix typo.

Duplicate "about".

6 years agomanual: libosl is optional.
Andre Noll [Fri, 14 Jul 2017 13:39:28 +0000 (15:39 +0200)]
manual: libosl is optional.

Even without libosl, the build succeeds (only para_server won't be
built). Hence libosl should be listed as optional software. This
commit moves the item out of the list of mandatory packages.

6 years agobuild: Echo "M4" when running an m4 command.
Andre Noll [Sat, 8 Jul 2017 19:47:55 +0000 (21:47 +0200)]
build: Echo "M4" when running an m4 command.

Translating a .suite.m4 file into a lopsub suite is a quiet operation
for no good reason. Let's add the usual output line to the build.

6 years agobuild: Run lopsubgen with absolute path.
Andre Noll [Sat, 8 Jul 2017 16:53:11 +0000 (18:53 +0200)]
build: Run lopsubgen with absolute path.

The configure script detects the location of the lopsubgen executable,
but we never use this information and rely on the shell to find the
executable in $PATH when the recipes in m4/lls/makefile are run.

This should not matter much, but it is inconsistent to how we deal
with m4. Moreover, using the LOPSUBGEN autoconf variable in the
recipes allows the user to override the path at build time.

6 years agobuild: Fix check for lopsub.
Andre Noll [Sat, 8 Jul 2017 16:36:03 +0000 (18:36 +0200)]
build: Fix check for lopsub.

If the lopsub library is not installed, HAVE_LOPSUB should be set to
"no".  The current code in configure.ac gets this wrong, causing the
configure script to succeed even if the library is not installed.

6 years agobuild: Improve lopsub error diagnostics.
Andre Noll [Sat, 8 Jul 2017 16:43:00 +0000 (18:43 +0200)]
build: Improve lopsub error diagnostics.

The configure script checks for the lopsubgen executable, the lopsub.h
header file and the liblopsub.a library. If the executable is not
found, we print a short error while a long error message with download
instructions is shown if the header file or the library is missing.

In the common failure case none of the three files is installed,
in which case we print the short message because the check for the
executable comes first. This is unfortunate.

This commit moves the check for the executable to the lopsub section
of configure.ac and prints the long error message if any of the three
files is missing.

6 years agoMerge branch 'refs/heads/t/manual'
Andre Noll [Fri, 14 Jul 2017 12:50:43 +0000 (14:50 +0200)]
Merge branch 'refs/heads/t/manual'

A couple of patches which merge the contents of the overview.pdf file
into the user manual. After this, the documentation no longer depends
on dia.

Cooking for six weeks.

* refs/heads/t/manual:
  manual: Expand description of para_play.
  manual: Omit level 3 headers from table of contents.
  manual: Combine overview.pdf and the user manual.
  manual: Remove text about permissions of /var/paraslash.
  manual: Correct format of para_client help output.
  manual: Add lopsub installation instructions to quick start.

6 years agoMerge branch 'maint'
Andre Noll [Thu, 13 Jul 2017 15:21:13 +0000 (17:21 +0200)]
Merge branch 'maint'

A single important fix for the error subsystem. The merge conflicted
because master removed the E_AAC_AFH_INIT error code while maint
still has it. The conflict was trivial to resolve.

* refs/heads/maint:
  Let error codes start out at index 1.

6 years agoLet error codes start out at index 1.
Andre Noll [Sat, 8 Jul 2017 20:55:11 +0000 (22:55 +0200)]
Let error codes start out at index 1.

When the error code facility was simplified one year ago in commit
a775408 (Simplify the error subsystem, get rid of error2.[ch]) we
introduced a simple enum for all error codes, but missed the fact
that this approach assigns the first error code the value zero.

Hence, when the AAC decoder returns this error code, it will not be
recognized as an error because we generally check for negative return
values only.

This patch introduces an unused dummy error code so that the real
error codes start at index 1.

6 years agoMerge branch 'refs/heads/t/para_play'
Andre Noll [Sun, 9 Jul 2017 17:38:40 +0000 (19:38 +0200)]
Merge branch 'refs/heads/t/para_play'

A single patch which removes pointless play_task arguments to many
functions in play.c.

Cooking for well over a month.

* refs/heads/t/para_play:
  play: Remove pointless play_task arguments.

6 years agowma: Remove _XOPEN_SOURCE define from wmadec_filter.c.
Andre Noll [Wed, 14 Jun 2017 17:24:45 +0000 (19:24 +0200)]
wma: Remove _XOPEN_SOURCE define from wmadec_filter.c.

It has been there since day one of the wma decoder with no indication
why it is needed. The code compiles fine without it on all supported
platforms, so get rid of it.

6 years agowma: make ->ms_stereo local to wma_decode_block().
Andre Noll [Sun, 11 Jun 2017 16:25:32 +0000 (18:25 +0200)]
wma: make ->ms_stereo local to wma_decode_block().

mid/side stereo mode is a per-block property and thus does not
need to be stored in the private_wmadec_data structure.

6 years agowma: Simplify init_coef_vlc().
Andre Noll [Sun, 11 Jun 2017 16:10:39 +0000 (18:10 +0200)]
wma: Simplify init_coef_vlc().

This function of wmadec_filter.c was unnecessarily convoluted.
The patched version should be equivalent, and easier to understand.

This also allows to get rid of ->coef_vlcs of struct private_wmadec_data,
which was utterly confusing since we also have ->coef_vlc.

6 years agowma: Rename input/output buffer variables.
Andre Noll [Sun, 11 Jun 2017 14:20:01 +0000 (16:20 +0200)]
wma: Rename input/output buffer variables.

The naming was confusing. With the new names it is clear which buffer
is used for input and which for output.

6 years agowma: Drop unused argument from wma_decode_superframe().
Andre Noll [Sun, 11 Jun 2017 14:10:40 +0000 (16:10 +0200)]
wma: Drop unused argument from wma_decode_superframe().

The function depends on the caller not passing a smaller value than
the packet size - WMA_FRAME_SKIP, and only uses this many input
bytes anyway. So we may get rid of the input size argument.

6 years agowma: Remove pointless/incorrect sanity checks.
Andre Noll [Sun, 11 Jun 2017 13:59:17 +0000 (15:59 +0200)]
wma: Remove pointless/incorrect sanity checks.

In wma_decode_superframe() we check the size of the input buffer twice.
Both checks are redundant because the input queue size of the wmadec
filter node already makes sure we never pass a smaller value. The
second check is in fact wrong, because pwd->ahi.packet_size -
WMA_FRAME_SKIP would be the correct limit to check.

6 years agowma: Combine wmadec_cleanup() and wmadec_close().
Andre Noll [Tue, 6 Jun 2017 08:07:44 +0000 (10:07 +0200)]
wma: Combine wmadec_cleanup() and wmadec_close().

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

6 years agowma: Simplify get_vlc().
Andre Noll [Tue, 6 Jun 2017 07:29:37 +0000 (09:29 +0200)]
wma: Simplify get_vlc().

The "bits" argument of the function is implicitly given by the vlc
structure and may thus be omitted from the call. For this to work we
must pass a pointer to struct vlc instead of only the table, which
further simplifies wmadec_filter.c.

6 years agowma: Remove pointless VLC_TYPE define.
Andre Noll [Mon, 5 Jun 2017 15:08:58 +0000 (17:08 +0200)]
wma: Remove pointless VLC_TYPE define.

It was defined to int16_t which only obfuscates the code.

6 years agowma: Make bitstream API more robust.
Andre Noll [Mon, 5 Jun 2017 14:52:37 +0000 (16:52 +0200)]
wma: Make bitstream API more robust.

The ->buffer_end field of struct getbit_context is set but never
used. In fact, we never check bounds and happily read beyond the
supplied data buffer.

Fix this by replacing the field by ->num_bits, an integer which
is initialized in init_get_bits() to the number of bits available.
All functions which read the bitstream are modified to check bounds.

6 years agoaft.c: Trivial spelling/whitespace fixes.
Andre Noll [Tue, 13 Jun 2017 22:03:45 +0000 (00:03 +0200)]
aft.c: Trivial spelling/whitespace fixes.

Avoid an overlong line, spell out memory-mapped and don't misspell
"formatted".

6 years agoafh: Expand documentation of init function declarations.
Andre Noll [Tue, 13 Jun 2017 21:21:34 +0000 (23:21 +0200)]
afh: Expand documentation of init function declarations.

It's not obvious why all of these are declared here, so explain this
in a bit more detail.

6 years agofilter: Remove duplicate documentation of filter_get().
Andre Noll [Tue, 13 Jun 2017 19:48:18 +0000 (21:48 +0200)]
filter: Remove duplicate documentation of filter_get().

This public function is documented both in filter.h and in
filter_common.c. Get rid of the comment in the header file as this
is incomplete and causes a doxygen warning.

6 years agodoxygen: Improve documentation of struct receiver.
Andre Noll [Tue, 30 May 2017 19:11:09 +0000 (21:11 +0200)]
doxygen: Improve documentation of struct receiver.

The documentation still referred to the former gengetopt related
->conf pointer and also had some language and punctuation issues. The
new text should fix this, and is more to the point.

6 years agodoxygen: Add \ref to references.
Andre Noll [Thu, 18 May 2017 18:58:42 +0000 (20:58 +0200)]
doxygen: Add \ref to references.

This way doxygen issues a warning if the file/function/structure no
longer exists and a stale reference remains.

6 years agoImprove documentation of mm.c and mm.h.
Andre Noll [Sun, 21 May 2017 19:44:45 +0000 (21:44 +0200)]
Improve documentation of mm.c and mm.h.

This was in a rather bad shape and referred to functions like
mood_open() which have been renamed long ago.

6 years agodoxygen: Don't refer to Black Hats Manual.
Andre Noll [Fri, 19 May 2017 07:24:28 +0000 (09:24 +0200)]
doxygen: Don't refer to Black Hats Manual.

It's no longer online.

6 years agodoxygen: Don't refer to libosl functions.
Andre Noll [Fri, 19 May 2017 07:00:35 +0000 (09:00 +0200)]
doxygen: Don't refer to libosl functions.

They are not part of the tree, and there is no dedicated man page
for them.

6 years agodoxygen: Trivial cleanups.
Andre Noll [Fri, 19 May 2017 06:22:15 +0000 (08:22 +0200)]
doxygen: Trivial cleanups.

A couple of capitalization and punctuation fixes.

6 years agodoxygen: Remove some stale doxygen references.
Andre Noll [Tue, 16 May 2017 21:09:33 +0000 (23:09 +0200)]
doxygen: Remove some stale doxygen references.

When we switched to lopsub, the callback request functions became
unused and were removed. At the same time, all command handlers were
made static, so they are no longer part of the doxygen documentation
and we shouldn't refer to them any more.

Also struct slot_info and the server_uptime variable have been made
private to their respective files audiod and time.c. Tthe latter was
in fact replaced by a timeval struct long ago.

The http and udp receivers don't have an init function any more, and
get_chunk_table_of_row() was removed ten years ago in commit 54a480ae.

Most references of the source code documentation will be annotated
with \ref in a subsequent commit to avoid this kind of documentation
bug in the future.

6 years agorecv: Explain user data mechanism.
Andre Noll [Tue, 16 May 2017 21:16:44 +0000 (23:16 +0200)]
recv: Explain user data mechanism.

This is not obvious, so it deserves a comment in recv_init(). The
patch also adds a reference to each of the four instances of struct
receiver, reducing the number of doxygen warnings when EXTRACT_ALL
is set to NO in Doxyfile.

6 years agoUpdate to doxygen-1.8.11.
Andre Noll [Wed, 17 May 2017 21:20:12 +0000 (23:20 +0200)]
Update to doxygen-1.8.11.

This is the result of running doxygen -u.

6 years agoUpdate status items on blob events.
Andre Noll [Mon, 17 Apr 2017 19:13:59 +0000 (21:13 +0200)]
Update status items on blob events.

If the image or the lyrics blob for the current audio file changes,
e.g. because the user executed the mvimg command, para_gui still
reports the old value because blob events don't trigger a status item
update.

This patch teaches aft_event_handler() to honor such events. We keep
it simple and update the items on every add/remove/rename event.

6 years agoplay: Remove unused dummy completer.
Andre Noll [Tue, 13 Jun 2017 18:22:08 +0000 (20:22 +0200)]
play: Remove unused dummy completer.

There is no stop command for para_play.

6 years agonet.c: Silence clang warning.
Andre Noll [Sun, 11 Jun 2017 10:13:22 +0000 (12:13 +0200)]
net.c: Silence clang warning.

clang-3.8.0 on FreeBSD complains about a recent change to net.c:

net.c:606:33: warning: missing field 'ss_family' initializer [-Wmissing-field-initializers]
struct sockaddr_storage ss = {0};
       ^
This line was introduced in commit 63128eea (net: Always initialize
struct sockaddr_storage) to avoid a warning from the static analyzer
of clang. Setting .ss_family initializes all struct members, which
makes both the analyzer and the compiler happy again.