]> git.tuebingen.mpg.de Git - paraslash.git/log
paraslash.git
7 years agoMerge branch 'refs/heads/t/wma_improvements'
Andre Noll [Fri, 21 Apr 2017 15:07:00 +0000 (17:07 +0200)]
Merge branch 'refs/heads/t/wma_improvements'

A couple of simple patches which simplify the WMA code and improve
readability.

Cooking for three weeks.

* refs/heads/t/wma_improvements:
  wmadec: Use read_u32_be().
  wma_afh.c: Remove condition which is always true.
  imdct.c: Replace pointless macro PASS.
  wma_common.c: Remove pointless assignment.
  wma_afh.c: Use DIV_ROUND_UP().

7 years agoMerge branch 'refs/heads/t/makefile_conventions'
Andre Noll [Wed, 19 Apr 2017 17:13:20 +0000 (19:13 +0200)]
Merge branch 'refs/heads/t/makefile_conventions'

A bunch of changes which strive to make the paraslash build system
more standard.

Cooking for three months.

* refs/heads/t/makefile_conventions:
  build: Add target "check" as a synonym for "test".
  build: Rename target "tarball" to "dist".
  build: Do not strip installed executables by default.
  build: Support $(DESTDIR).
  build: Rename clean targets.

7 years agoMerge branch 'refs/heads/t/rm_as_compat'
Andre Noll [Tue, 18 Apr 2017 12:55:03 +0000 (14:55 +0200)]
Merge branch 'refs/heads/t/rm_as_compat'

A single patch that removes socket compatibility code from para_audiod,
para_audioc and para_server.

Cooking for three months.

* refs/heads/t/rm_as_compat:
  Remove compatibility code for abstract unix domain sockets.

7 years agoMerge branch 'refs/heads/t/rm_rc4'
Andre Noll [Sun, 16 Apr 2017 18:15:35 +0000 (20:15 +0200)]
Merge branch 'refs/heads/t/rm_rc4'

This patch removes support for RC4, making the AES-based stream
cipher mandadory. The aes_ctr128 server feature is made a no-op,
breaking support with very old clients (<= 0.5.1).

Cooking for three months.

* refs/heads/t/rm_rc4:
  crypt: Remove RC4 support.

7 years agowww: Fix an html bug in download page.
Andre Noll [Sun, 16 Apr 2017 15:37:51 +0000 (17:37 +0200)]
www: Fix an html bug in download page.

Dillo complains with

HTML warning: line 45, Unexpected closing tag: </p> -- expected </ul>.

This complaint looks bogus, but removing the <p> and </p> tags makes the
warning go away with no visible change.

7 years agoMerge branch 'refs/heads/t/rm_oaep'
Andre Noll [Sat, 15 Apr 2017 13:51:38 +0000 (15:51 +0200)]
Merge branch 'refs/heads/t/rm_oaep'

The open-coded OAEP padding removed in this series is no longer needed
since all supported libgcrypt versions support OAEP padding.

The series also contains a few follow up cleanups for gcrypt.c.

Cooking for three months.

* refs/heads/t/rm_oaep:
  gcrypt: Simplify init_random_seed_or_die().
  gcrypt: Rename E_OEAP to E_RSA_DECODE.
  gcrypt: Remove open-coded OAEP padding.

7 years agoMerge branch 'refs/heads/t/rm_asn'
Andre Noll [Sun, 9 Apr 2017 11:47:15 +0000 (13:47 +0200)]
Merge branch 'refs/heads/t/rm_asn'

A few cleanups, and one patch which removes an obsolete feature,
getting rid of an open-coded ASN parser.

Cooking for three months.

* refs/heads/t/rm_asn:
  Remove unused E_PUBLIC_KEY.
  crypt.c: Combine load_key() and get_private_key().
  crypto: Remove support for ASN public keys.
  crypto: Simplify asymetric key handling.
  crypto: Rename check_key_file() -> check_private_key_file().
  gcrypt.c: Always initialize result pointer in get_private_key().

7 years agoMerge branch 'refs/heads/t/rm_osx'
Andre Noll [Tue, 4 Apr 2017 06:42:28 +0000 (08:42 +0200)]
Merge branch 'refs/heads/t/rm_osx'

Two simple patches which remove code and documentation related to
Mac OS. Cooking since 2017-01-04.

* refs/heads/t/rm_osx:
  build: Remove compatibility check for clock_gettime().
  Drop support for Mac OS.

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 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.

7 years agoFix signedness issues in format strings.
Andre Noll [Wed, 23 Nov 2016 22:16:50 +0000 (23:16 +0100)]
Fix signedness issues in format strings.

Compiling with -Wformat-signedness (not enabled so far) causes many
warnings because of format strings which specify an unsigned type but
correspond to an argument of signed type, or vice versa. This commit
fixes all these mismatches.

For "%u", "%d", "%lu", "%ld" we let the format string match the
type of the argument, but for "%x" we need to cast the argument to
a suitable unsigned type.

After this patch the tree compiles cleanly with -Wformat-signedness
given. The warning will be enabled in a subsequent commit.

7 years agoMerge branch 'refs/heads/t/sideband-cleanup'
Andre Noll [Sun, 4 Dec 2016 10:10:36 +0000 (11:10 +0100)]
Merge branch 'refs/heads/t/sideband-cleanup'

started on 2016-07-03, cooking since 2016-07-16

para_server announces sideband as an optional feature, which is
pointless since sideband connections have become mandatory in
paraslash-0.5.x, so they are always used. This patch set removes
the feature negitiation during the initial handshake. The sideband
protocol remains and is not affected.

Overwiew of the handshake in v0.5.x:
(SA) server announces sideband
(CC) client fails connection if server did not announce sideband
(CR) client requests sideband
(SC) server fails connection if sideband was not requested
already broken
- client-0.4/server-0.5 (!CR, SC)
- client-0.5/server-0.4 (!SA, CC)

Conversion plan:
rm (CC): breaks nothing
rm (SC): breaks nothing
rm (CR): breaks cl-0.6/server-0.5 (!CR, SC)
rm (SA): breaks cl-0.5/server-0.6 (!SA, CC)
server fails connection if client requests sideband

In this series only the first two conversion steps are done as they
can be merged early without breaking anything.

* refs/heads/t/sideband-cleanup:
  server: Do not fail if client does not request sideband.
  client: No longer fail connection if sideband was not announced.

7 years agoserver: Fix race condition in afs startup.
Andre Noll [Tue, 23 Aug 2016 20:58:46 +0000 (22:58 +0200)]
server: Fix race condition in afs startup.

After server_init() returns, the server accepts connections on the
TCP command socket. If an afs command arrives on the command socket,
the server process forks and the resulting child process (the command
handler) connects to the local afs socket. However, this socket is
created by the afs process which was forked from the server process
in server_init(). It is therefore possible that the command handler
connects before the afs process started to listen on the local afs
socket. In this case, the connection, hence the command fails.

This commit fixes the race condition by letting the parent process
block on read(2) on the afs socket. The afs process writes a byte
to the other end of the socket after it has completed its setup,
causing the parent process to resume.

For this to work, we need a connection-mode byte stream for the
communication between the server and the afs process, rather
than the connectionless datagram socket we have now. There is no
particular reason to prefer a datagram socket here, so let's switch
to SOCK_STREAM.

7 years agodaemon: Fix race condition in daemonize().
Andre Noll [Thu, 16 Jun 2016 18:17:21 +0000 (20:17 +0200)]
daemon: Fix race condition in daemonize().

If parent_waits is true, the parent process waits for a signal from
the child before it exits. However, this signal can arive before the
parent has set up its signal handler.

This patch closes the race window by switching from signals to
pipes. We now create a pipe before the new process is forked, and
let the parent block on read(2) until the child exits or indicates
success by writing a byte to one end of the pipe. The child process
receives the file descriptor of the writing end of the pipe as the
return value of daemonize().

The only user of the parent_waits feature is para_server, which is
changed accordingly.

7 years agotouch: Refuse to set an invalid image or lyrics ID.
Andre Noll [Sat, 26 Mar 2016 22:27:09 +0000 (22:27 +0000)]
touch: Refuse to set an invalid image or lyrics ID.

This makes the callback of the touch command fail the command if the
given ID does not exist in the corresponding blob table.

To this aim we call blob_get_name_by_id() to look up the ID. Since
we are not interested in the name, the function now allows a NULL
result pointer in which case it only checks whether the ID is valid.

With this patch applied the attempt to set an invalid image or lyrics
ID results in an error message like this:

invalid image ID: 456565
remote: key not found in rbtree
main: command failed

7 years agotest-lib: Fix a bash-4.4 issue.
Andre Noll [Sun, 25 Sep 2016 13:56:43 +0000 (15:56 +0200)]
test-lib: Fix a bash-4.4 issue.

Apparently bash-4.4 changed how unquoted here strings are treated.
We want to process only the first line of the output, so the right
thing to do is to ask awk to exit after processing the first line.
This works regardless of the bash version.

7 years agodaemon: Improve "daemonizing" log message.
Andre Noll [Mon, 26 Sep 2016 16:44:39 +0000 (18:44 +0200)]
daemon: Improve "daemonizing" log message.

The function name "daemonize" is shown anyway, so let's print the
path to the log file instead.

7 years agoserver: Deprecate ls -p.
Andre Noll [Wed, 24 Aug 2016 20:18:36 +0000 (22:18 +0200)]
server: Deprecate ls -p.

In v0.6.0 the -p option will have the same meaning as for the rm and
touch commands: perform pathname match. Also the default for the ls
command will be changed to list full paths while the new -b option
must be given to print only the basename (i.e., the current behaviour
if -p is not given).

This commit is a preparation for these incompatible changes which
does not break existing scripts. It does the following

* The -p option is deprecated in favor of its synonym, the new -F
option (for full path).

* The new -b option instructs the command to perform basename matching
and print only the basename of the matching files. It is currently
a no-op.

With the patch applied, scripts are supposed to specify either -b or
-F as appropriate.  In v0.6.0 the semantics of -p will be changed as
described above, the default will be changed to print the full path,
and -F will be deprecated because it is a no-op then.

7 years agoopenssl: RSA fixes for openssl-1.1.
Andre Noll [Sun, 28 Aug 2016 13:35:11 +0000 (15:35 +0200)]
openssl: RSA fixes for openssl-1.1.

In openssl-1.1 the RSA structure has been made opaque, causing
compilation of crypt.c to fail because the code accesses ->n and ->e
directly to set the modulus and the public exponent according to the
values read from the public ssh key.

With openssl-1.1 applications are supposed to call RSA_set0_key()
to set n and e. Unfortunately, this function does not exist in
openssl-1.0.2.

This patch adds a configure check which defines HAVE_RSA_SET0_KEY if
RSA_set0_key() is available. In crypt.c we either call the function
or set ->n and ->e directly, depending on whether HAVE_RSA_SET0_KEY
is defined. This results in code which works on both openssl-1.0.2
and openssl-1.1.0.

7 years agoopenssl: Use EVP API for AES.
Andre Noll [Sun, 28 Aug 2016 13:35:53 +0000 (15:35 +0200)]
openssl: Use EVP API for AES.

opensssl-1.1 no longer exports AES_set_encrypt_key() and
AES_ctr128_encrypt(). Applications are supposed to use the high-level
EVP interface instead.

Fortunately, the EVP library functions necessary for our use of
the AES_ctr128 stream cipher are available in openssl version 1.0.1
and above, so switching to the EVP API makes the code work with all
versions >= 1.0.1.

7 years agobuild: Remove target "dep".
Andre Noll [Sat, 16 Jul 2016 20:47:57 +0000 (22:47 +0200)]
build: Remove target "dep".

It is not needed at all. The attempt to include non-existent or
outdated .d files instructs make to rebuild them.

7 years agoafs: Fix error handling of the select command.
Andre Noll [Sat, 11 Jun 2016 18:44:01 +0000 (20:44 +0200)]
afs: Fix error handling of the select command.

com_select() returns success even if the mood or playlist could not
be activated. This commit changes the function to return the error
code from activate_mood_or_playlist() instead.

The function had another minor issue: If the current mood is the
dummy mood, and we failed to switch to the given mood or playlist,
and also failed to switch back to the dummy mood, we try a second
time to activate the dummy mood. This should not happen, but let's
fix it anyway.

7 years agonet.c: Fix two trivial whitespace issues.
Andre Noll [Fri, 26 Aug 2016 18:56:14 +0000 (20:56 +0200)]
net.c: Fix two trivial whitespace issues.

7 years agofilter: Make ->open() optional.
Andre Noll [Sun, 28 Jun 2015 14:18:22 +0000 (16:18 +0200)]
filter: Make ->open() optional.

There is no need to force each filter to supply this method, so teach
the three callers of ->open() to check for NULL pointers.

The commit also fixes some trivial language issues in the documentation
of ->open() and ->close().

7 years agobase64: Speed up decoder by using a table.
Andre Noll [Sat, 9 Apr 2016 18:44:28 +0000 (20:44 +0200)]
base64: Speed up decoder by using a table.

The current implementation calls strchr() for each character in the
decoded data to find the offset in the Base64[] array that corresponds
to six decoded bits. This makes the algorithm scale poorly.

This commit introduces a lookup table of size 256 which simplifies
the code and improves the performance of the decoder.

7 years agobase64: Use para_isspace() everywhere.
Andre Noll [Sat, 9 Apr 2016 18:42:59 +0000 (20:42 +0200)]
base64: Use para_isspace() everywhere.

Should not matter because we only test for zero, but let's be
consistent.

7 years agobase64: Trivial whitespace fixes.
Andre Noll [Thu, 30 Apr 2015 07:06:35 +0000 (09:06 +0200)]
base64: Trivial whitespace fixes.

7 years agobase64: Replace Pad64 variable by macro.
Andre Noll [Wed, 29 Apr 2015 17:02:20 +0000 (19:02 +0200)]
base64: Replace Pad64 variable by macro.

There is no need to define a variable for this.

7 years agobase64: Remove unnecessary overflow checks.
Andre Noll [Tue, 28 Apr 2015 16:17:42 +0000 (18:17 +0200)]
base64: Remove unnecessary overflow checks.

Since we decode no more than encoded_size many bytes, and the output
buffer is allocated large enough to store the decoded data, we won't
ever overflow the output buffer. This commit removes the pointless
checks.

7 years agobase64: Saner semantics for base64_decode() and uudecode().
Andre Noll [Sun, 26 Apr 2015 21:41:00 +0000 (23:41 +0200)]
base64: Saner semantics for base64_decode() and uudecode().

Currently the callers of these functions must allocate a suitably
sized buffer for the decoded data. It is easier to let the decoders
allocate the result buffer, as implemented in this commit. The callers
in crypt.c and gcrypt.c are adjusted accordingly.

7 years agoMove base64 implementation to own file.
Andre Noll [Tue, 10 Jun 2014 15:52:22 +0000 (17:52 +0200)]
Move base64 implementation to own file.

The base64 decoder is independent of anything else, so it should not
be part of the crypto API. This patch moves the two public functions
uudecode() and base64_decode() to a new file, base64.c, and introduces
base64.h to declare them.