paraslash.git
8 years agocrypt: Really set result to NULL if get_asymmetric_key() fails.
Andre Noll [Mon, 15 Aug 2011 18:09:54 +0000 (20:09 +0200)]
crypt: Really set result to NULL if get_asymmetric_key() fails.

The error path of this function sets the local variable "result"
is set to NULL, which is useless. We must store NULL in the pointer
variable whose address was passed to the function, so "*result =
NULL" is correct.

8 years agoMerge branch 't/mp3_frame_padding'
Andre Noll [Sat, 13 Aug 2011 10:56:21 +0000 (12:56 +0200)]
Merge branch 't/mp3_frame_padding'

8 years agoalsa: Kill useless log message.
Andre Noll [Sat, 6 Aug 2011 19:44:56 +0000 (21:44 +0200)]
alsa: Kill useless log message.

This message does not add much information and looks strange in case
no alsa option was given.

8 years agomp3_afh: Take padding into account when computing frame duration.
Andre Noll [Sat, 30 Jul 2011 16:14:25 +0000 (18:14 +0200)]
mp3_afh: Take padding into account when computing frame duration.

Without this fix, the computed duration of a frame can be slightly
larger than its actual duration. If this happens for many frames of
an mp3 file, the chunk size will be slightly too large, which leads
to buffer underruns during streaming.

8 years agoMerge branch 't/smaller_tarball'
Andre Noll [Sat, 13 Aug 2011 10:21:18 +0000 (12:21 +0200)]
Merge branch 't/smaller_tarball'

8 years agoMerge branch 't/timing_improvements'
Andre Noll [Sat, 13 Aug 2011 10:17:51 +0000 (12:17 +0200)]
Merge branch 't/timing_improvements'

8 years agoMerge branch 't/sched_improvements'
Andre Noll [Sat, 13 Aug 2011 10:15:10 +0000 (12:15 +0200)]
Merge branch 't/sched_improvements'

8 years agoMerge branch 't/mad_sync_fix'
Andre Noll [Sat, 13 Aug 2011 10:07:14 +0000 (12:07 +0200)]
Merge branch 't/mad_sync_fix'

9 years agomanual: A couple of minor improvements.
Andre Noll [Tue, 9 Aug 2011 22:58:58 +0000 (00:58 +0200)]
manual: A couple of minor improvements.

Rewording, an external link to libosl, removal of duplicate information
and a typo fix.

9 years agomp3dec: Handle decode errors gracefully.
Andre Noll [Sun, 7 Aug 2011 10:33:03 +0000 (12:33 +0200)]
mp3dec: Handle decode errors gracefully.

Currently decoding damaged mp3 files leads to very audible artefacts
even if only a single frame is corrupt. This patch instructs the mp3
decoder to synchronize the stream on decode errors and to continue the
decode process. Only on fatal errors the input buffer is discarded.

9 years agomp3dec: Kill need_bad_data_delay().
Andre Noll [Sun, 7 Aug 2011 10:08:39 +0000 (12:08 +0200)]
mp3dec: Kill need_bad_data_delay().

This added quite some complexity for no real gain.

9 years agomp3dec: Allocate correct output buffer size also for mono files.
Andre Noll [Sat, 16 Jul 2011 13:21:57 +0000 (15:21 +0200)]
mp3dec: Allocate correct output buffer size also for mono files.

Currently the buffer size is chosen to hold 4 bytes per sample
even for mono files where 2 bytes per sample suffice.

Since the channel count does not change within a frame, use the
cached value in pmd->channels rather than the MAD_NCHANNELS
macro for each sample.

9 years agoAdd/fix some doxygen comments.
Andre Noll [Tue, 9 Aug 2011 20:40:19 +0000 (22:40 +0200)]
Add/fix some doxygen comments.

9 years agoafh.h: Remove unused declaration.
Andre Noll [Tue, 9 Aug 2011 20:37:59 +0000 (22:37 +0200)]
afh.h: Remove unused declaration.

This function was removed long ago, but we missed to remove the
declaration back then.

9 years agocrypt: Don't use plain integer as NULL pointer.
Andre Noll [Tue, 9 Aug 2011 19:54:44 +0000 (21:54 +0200)]
crypt: Don't use plain integer as NULL pointer.

Found by sparse.

9 years agogui: Fix sparse warning.
Andre Noll [Tue, 9 Aug 2011 19:53:12 +0000 (21:53 +0200)]
gui: Fix sparse warning.

Fixes:

gui.c:1373:24: error: symbol 'com_quit' redeclared with different type (originally declared at gui.c:102) - different modifiers

9 years agowma: Make log2_tab static.
Andre Noll [Sun, 7 Aug 2011 21:35:50 +0000 (23:35 +0200)]
wma: Make log2_tab static.

This table is only used in wma_common.c.

9 years agogcrypt: Check return value of unpad_oaep().
Andre Noll [Sun, 7 Aug 2011 19:19:21 +0000 (21:19 +0200)]
gcrypt: Check return value of unpad_oaep().

unpad_oaep() may fail, so we have to check the return value.

9 years agogcrypt: Fix return value of pad_oaep().
Andre Noll [Sun, 7 Aug 2011 19:18:18 +0000 (21:18 +0200)]
gcrypt: Fix return value of pad_oaep().

This function returned an uninitialized variable on success.

9 years agovss: Clean up timeout computations.
Andre Noll [Thu, 14 Jul 2011 06:17:08 +0000 (08:17 +0200)]
vss: Clean up timeout computations.

By passing the sched struct to vss_compute_timeout() we can get
rid of the static the_timeout struct in vss_compute_timeout(). The
previous patch, which made the timeout helper functions of sched.c
return whether the given barrier is in the past, allows to simplify
the timeout code of vss.c a bit.

The patch also combines the general timeout computations and the
computation for FEC slices into a single function.

9 years agosched: Improve sched_request_barrier() and friends.
Andre Noll [Wed, 13 Jul 2011 19:13:32 +0000 (21:13 +0200)]
sched: Improve sched_request_barrier() and friends.

Make these functions tell its caller whether the given barrier
was in the past. This is useful for vss because for certain
barriers, no other actions should be performed before the barrier
has passed.

9 years agoMerge branch 't/crypto'
Andre Noll [Sun, 7 Aug 2011 11:13:43 +0000 (13:13 +0200)]
Merge branch 't/crypto'

9 years agoMerge branch 't/osx_overhaul'
Andre Noll [Sat, 6 Aug 2011 12:32:30 +0000 (14:32 +0200)]
Merge branch 't/osx_overhaul'

9 years agomanual: Mention that clang is also a supported compiler.
Andre Noll [Fri, 5 Aug 2011 11:13:19 +0000 (13:13 +0200)]
manual: Mention that clang is also a supported compiler.

And add a link to the clang home page.

9 years agogcrypt: Return key size in bytes.
Andre Noll [Fri, 5 Aug 2011 10:53:46 +0000 (12:53 +0200)]
gcrypt: Return key size in bytes.

The crypto API requires get_asymmetric_key() to return the size of
the RSA key in bytes on success.  The return value is evaluated in
populate_user_list() where keys which are too short to encrypt a
challenge buffer are rejected right away.

However, for ASN.1 keys, the gcrypt implementation returned the number
of *bits* instead. This caused para_server to accept keys which are
in fact not suitable for authentication.

The fix is trivial.

9 years agoafs: Fix long-standing bug in add command.
Andre Noll [Sun, 31 Jul 2011 12:40:10 +0000 (14:40 +0200)]
afs: Fix long-standing bug in add command.

Before the add command handler adds a given audio file to the database
it asks the afs process to check whether the file already exists.

The afs process looks for rows in the audio file table with path
and/or hash identical to the given file. If a match is found a
pointer to the matching row is passed from afs to the command handler.
The get_row_pointer_from_result() helper is then called by the command
handler to extract the row pointer from the result returned by afs.

However, this helper incorrectly dereferenced the pointer which caused
the command handler to examine an address rather than the content of
the address to tell whether the file already exists and whether path
or content has changed. This could lead to changed/moved files being
ignored as well as existing files being added again.

This bug was introduced in commit 0a3b9b83, back in 2008.

9 years agosched: Optimize the case of zero timeouts.
Andre Noll [Thu, 21 Jul 2011 17:59:46 +0000 (19:59 +0200)]
sched: Optimize the case of zero timeouts.

If a pre_select method calls sched_min_delay() there is no
point in calling the pre_select hooks of the other tasks since
these can not decrease the timeout any further, and adding file
descriptors to the fd sets makes no sense either. So we may
break out early in sched_preselect() in this case.

If the timeout is zero we may even omit the entire select call as
well as the subsequent gettimeofday() since select() will return
immediately anyway. This patch teaches sched_postselect() to do so
which saves at least two system calls (plus locking in case of
para_server) in a rather hot path.

9 years agosched: Kill unnecessary check in sched_pre_select().
Andre Noll [Thu, 21 Jul 2011 17:39:03 +0000 (19:39 +0200)]
sched: Kill unnecessary check in sched_pre_select().

The only two callers of sched_shutdown() call this function
from post_select context, so we may safely remove the check
whether the pre_select list is empty.

Add a comment to sched_shutdown() which mentions that this
function must be called from post_select.

9 years agosched: Use (0,0) as the timeval for a minimal delay.
Andre Noll [Thu, 21 Jul 2011 17:18:41 +0000 (19:18 +0200)]
sched: Use (0,0) as the timeval for a minimal delay.

The select(2) man page says:

If both fields of the timeval structure are zero,
then select() returns immediately.

This is exactly what is desired for sched_min_delay().

9 years agoMerge branch 't/client_memory_leak_fix'
Andre Noll [Sat, 30 Jul 2011 18:22:47 +0000 (20:22 +0200)]
Merge branch 't/client_memory_leak_fix'

9 years agoconfigure: Check for help2man.
Andre Noll [Sat, 4 Jun 2011 11:18:05 +0000 (13:18 +0200)]
configure: Check for help2man.

help2man is required for generating the man pages, so we should print
a proper error message at configure time if help2man is not installed.

9 years agoconfigure: Check for gengetopt.
Andre Noll [Sat, 4 Jun 2011 10:09:26 +0000 (12:09 +0200)]
configure: Check for gengetopt.

Print an error message at configure time if gengetopt is not installed.

This patch also modifies the commands that call gengetopt in
ggo/makefile to use the executable which was found by configure.

9 years agomanual: Move gengetopt section.
Andre Noll [Fri, 3 Jun 2011 05:42:11 +0000 (07:42 +0200)]
manual: Move gengetopt section.

As gengetopt is now required also for building the tarball, move
the section on gengetopt from "Tools" to Requirements".

9 years agoDon't ship generated *cmdline.[ch] files in tarball.
Andre Noll [Fri, 3 Jun 2011 04:58:45 +0000 (06:58 +0200)]
Don't ship generated *cmdline.[ch] files in tarball.

These files increase the size of the tarball considerably for no real
gain. Gengetopt is available as a package on all major distributions,
so simply require gengetopt.

9 years agoalsa: Avoid busy loop.
Andre Noll [Sun, 24 Jul 2011 20:18:42 +0000 (22:18 +0200)]
alsa: Avoid busy loop.

It is possible that snd_pcm_writei() returns zero rather than -EAGAIN
in case nothing was written because the alsa buffer was already full.

Currently we try again, and eventually succeed. However, this is
ugly, burns CPU cycles and might even lead to an endless loop for
misconfigured alsa devices. So simply return from alsa_post_select()
if snd_pcm_writei() returned zero.

9 years agoMerge branch 't/clang'
Andre Noll [Thu, 21 Jul 2011 20:40:40 +0000 (22:40 +0200)]
Merge branch 't/clang'

9 years agofecdec: Kill an unused variable.
Andre Noll [Mon, 11 Jul 2011 21:37:52 +0000 (23:37 +0200)]
fecdec: Kill an unused variable.

The variable "p" is set, but the assigned value is never used.

9 years agoclient: Do not leak buffer tree node on exit.
Andre Noll [Thu, 9 Jun 2011 22:01:09 +0000 (00:01 +0200)]
client: Do not leak buffer tree node on exit.

Currently we deallocate the buffer tree node of the client
task in case the connect fails and in audiod.c's close_stat_pipe()
but miss to free it for para_client in case of a regular connection
shutdown.

Fix this memory leak by freeing the buffer tree node in
client_close().

9 years agoRewrite of the osx writer.
Andre Noll [Thu, 3 Feb 2011 16:15:39 +0000 (17:15 +0100)]
Rewrite of the osx writer.

This replaces most of the code taken from mosx-mpg123 and should
make osx_write.c much more readable, shorter and more reliable.

Since coreaudio creates a new thread which periodically calls our
callback function, some kind of coordination between the two threads
of execution is necessary.

This implementation employs a new buffer tree node and a mutex to
serialize access to the data buffers.  The parent thread pushes
down all data to the child thread which consumes this data in the
callback function.  Both threads grab the new mutex whenever they
access or modify the data buffers.

9 years agoaudiod get_play_time_slot_num(): Avoid possible NULL pointer dereference.
Andre Noll [Thu, 3 Feb 2011 16:12:53 +0000 (17:12 +0100)]
audiod get_play_time_slot_num(): Avoid possible NULL pointer dereference.

The pointer to the buffer tree node is dereferenced unconditionally
in btr_get_node_start(). This patch makes sure we never pass a NULL
pointer to this function.

9 years agoaudiod: Kill noisy debug message.
Andre Noll [Thu, 3 Feb 2011 16:10:36 +0000 (17:10 +0100)]
audiod: Kill noisy debug message.

Debug output is noisy enough even without this.

9 years agoaudiod: Use non-blocking writes for stat clients.
Andre Noll [Sun, 12 Jun 2011 11:58:49 +0000 (13:58 +0200)]
audiod: Use non-blocking writes for stat clients.

This allows to kill the call to write_ok() which involves
a select system call.

9 years agonet.c: Use proper socket type for __get_sock_name().
Andre Noll [Fri, 10 Jun 2011 14:03:30 +0000 (16:03 +0200)]
net.c: Use proper socket type for __get_sock_name().

This patch gets rid of

net.c:652:33: warning: incompatible pointer types passing 'int (int, __SOCKADDR_ARG, socklen_t *restrict)', expected 'int (*)(int, struct sockaddr *, socklen_t *)' [-pedantic]
        return __get_sock_name(sockfd, getsockname);
                                       ^~~~~~~~~~~

when compiling with clang.

9 years agoAvoid warning when compiling with clang.
Andre Noll [Fri, 10 Jun 2011 13:35:01 +0000 (15:35 +0200)]
Avoid warning when compiling with clang.

Apparently clang does not recognize the

#pragma GCC visibility push(default)

lines in osl.h and complains for each file which includes this
header. Compliling without -Wno-unknown-pragmas fixes this.

9 years agoWork around some clang warnings.
Andre Noll [Thu, 9 Jun 2011 15:52:13 +0000 (17:52 +0200)]
Work around some clang warnings.

This fixes a bunch of warnings of the form

command.c:126:2: warning: expression result unused [-Wunused-value]
WRITE_STATUS_ITEM(&b, SI_MTIME, "%s\n", mtime);

when compiling with clang. This warning is bogus, because the underlying call
to para_printf() can only return failure if the max_size_handler fails, but
this handler is never called here because the size of this para_buffer is
unlimited.

Casting to void makes the warning go away.

9 years agoMakefile: Place -Wno-sign-compare _after_ -Wall.
Andre Noll [Tue, 17 May 2011 11:55:27 +0000 (13:55 +0200)]
Makefile: Place -Wno-sign-compare _after_ -Wall.

Without this, clang still complains about comparisons between
signed and unsigned variables which produces lots of noise.

9 years agogcrypt: Optionally use internal OAEP padding.
Andre Noll [Mon, 4 Jul 2011 23:04:34 +0000 (01:04 +0200)]
gcrypt: Optionally use internal OAEP padding.

libgcrypt supports OAEP padding since version 1.5.0, which has just
been released. Since want the paraslash gcrypt code to work also
for older gcrypt libraries, we check the library version at runtime
and fall back to the internal OAEP padding code if an old library
was detected.

This patch moves much of the rather ugly OAEP padding code into new
new helper decode_rsa() which reduces to a mere memcpy for newer
gcrypt versions. Much of the old code can be removed once all major
distributions ship libgcrypt-1.5.0 or later.

9 years agogcrypt: Use GCRYMPI_FMT_USG for gcry_sexp_nth_mpi().
Andre Noll [Mon, 4 Jul 2011 22:08:14 +0000 (00:08 +0200)]
gcrypt: Use GCRYMPI_FMT_USG for gcry_sexp_nth_mpi().

The manual says: If you use this function to parse results of
a public key function, you most likely want to use `GCRYMPI_FMT_USG'.

9 years agocrypt: Fix typo in configure warning.
Andre Noll [Mon, 27 Jun 2011 16:25:36 +0000 (18:25 +0200)]
crypt: Fix typo in configure warning.

9 years agoUpdate doxygen main page with links to gcrypt functions.
Andre Noll [Fri, 29 Apr 2011 15:07:22 +0000 (17:07 +0200)]
Update doxygen main page with links to gcrypt functions.

9 years agomanual: gcrypt updates.
Andre Noll [Thu, 28 Apr 2011 00:35:16 +0000 (02:35 +0200)]
manual: gcrypt updates.

This incudes libgcrypt in the remark on crypto security and
adds an external link to the libgcrypt web page.

9 years agoAdd alternative crypto implementation.
Andre Noll [Sat, 4 Jun 2011 13:26:15 +0000 (15:26 +0200)]
Add alternative crypto implementation.

This fills gcrypt.c (which contained only dummy functions so far)
with contents.

The old openssl-based crypto API uses OAEP padding exclusively, as
this padding method is recommended for new applications which do not
have to care about backwards compatibility. Unfortunately, libcrypt
only supports the older pkcs1 padding method. Since we want older
para_client versions to be compatible with a newer para_server, even
if this para_server was compiled against libgcrypt, we must implement
our own OAEP padding functions. This turned out to be quite simple,
given the good documentation in rfc 3447.

This together with the fact that there is no ASN1 parser in libgcrypt
makes the patch quite large though.

On the other hand, SHA1, random numbers and RC4 were straight-forward
to implement using the primitives provided by libgcrypt.

9 years agoAdd configure checks and stubs for gcrypt support.
Andre Noll [Sat, 5 Mar 2011 15:39:30 +0000 (16:39 +0100)]
Add configure checks and stubs for gcrypt support.

Compiles but does not yet work as all functions are dummies ATM.

9 years agocrypt_common.c: Add missing doxygen documentation.
Andre Noll [Mon, 25 Apr 2011 13:23:48 +0000 (15:23 +0200)]
crypt_common.c: Add missing doxygen documentation.

9 years agocrypt: Move documentation to crypt.h.
Andre Noll [Fri, 11 Mar 2011 22:55:01 +0000 (23:55 +0100)]
crypt: Move documentation to crypt.h.

Since we will have two implementations soon, the documentation of
the public API should go to the common header.

Also fix the documentation of pub_encrypt(): The size of
the input buffer is never enough. 512 always suffices.

9 years agostream cipher: Allow in-place encryption.
Andre Noll [Mon, 7 Mar 2011 07:07:37 +0000 (08:07 +0100)]
stream cipher: Allow in-place encryption.

unlike openssl's RC4(), the RC4 implemenation of libgcrypt can encrypt
a buffer in-place. For this the "buf" argument of the various send
and receive functions must not be const.

9 years agocrypt: Make base64_decode public.
Andre Noll [Mon, 7 Mar 2011 07:04:23 +0000 (08:04 +0100)]
crypt: Make base64_decode public.

gcrypt.c needs this to decode public rsa keys. Public functions
should always return proper error codes, so change the return
value for errors from -1 to -E_BASE64.

9 years agocrypt: Move implementation-independent code to separate file.
Andre Noll [Sat, 5 Mar 2011 20:53:54 +0000 (21:53 +0100)]
crypt: Move implementation-independent code to separate file.

This introduces crypt_common.c which contains helper functions from
crypt.c which are independent of openssl.

crypt.common.c contains two types of public functions: Frontend
functions are called by users of the crypto API, and these functions
are exported as usual through the crypt.h header file. Backend
functions, on the other hand, are expected to be called only from
the crypto implementation (i.e. from crypt.c or gcrypt.c). These
functions are exported through the new crypt_backend.h header file.

9 years agoMerge branch 't/alsa_drain_fix'
Andre Noll [Thu, 23 Jun 2011 17:13:40 +0000 (19:13 +0200)]
Merge branch 't/alsa_drain_fix'

9 years agoMerge branch 't/hup_fix'
Andre Noll [Thu, 23 Jun 2011 17:13:40 +0000 (19:13 +0200)]
Merge branch 't/hup_fix'

9 years agoClear score table on mood reload.
Andre Noll [Sun, 5 Jun 2011 17:14:37 +0000 (19:14 +0200)]
Clear score table on mood reload.

Whenever a blob is added, the mood event handler is called
which may reload the current mood in order to react to the
change being made. However, we missed to clear the score table
first. This is necessary to to re-insert all admissible files.
Currently this fails with

afs_event: table moods, event 8: key already exists in rbtree

9 years agoMerge branch 't/audiod_regex'
Andre Noll [Mon, 13 Jun 2011 12:16:17 +0000 (14:16 +0200)]
Merge branch 't/audiod_regex'

9 years agoMerge branch 't/net_cleanups'
Andre Noll [Wed, 8 Jun 2011 17:44:56 +0000 (19:44 +0200)]
Merge branch 't/net_cleanups'

9 years agoalsa: Avoid busy loop at end of file.
Andre Noll [Mon, 6 Jun 2011 06:24:08 +0000 (08:24 +0200)]
alsa: Avoid busy loop at end of file.

During the drain period at the end of input the status of the alsa
buffer tree node is negative, yet we should not request a minimal
scheduler delay until the end of this period.

9 years agoaft: Do not invalidate status items when closing the audio file table.
Andre Noll [Sat, 4 Jun 2011 11:38:02 +0000 (13:38 +0200)]
aft: Do not invalidate status items when closing the audio file table.

Currently aft_close() frees the global variables status_items and
parser_friendly_status_items which are used for the stat comand of
para_server. This function is called on exit and when para_server
receives SIGHUP, the latter may happen while streaming. In this case
clients which connect after the SIGHUP do not see any aft status
items until the audio file changes.

Fix this flaw simply by not freeing the status item buffers until
they are recomputed anyway.

9 years agoaudiod: Document new regular expression syntax.
Andre Noll [Tue, 19 Apr 2011 23:28:10 +0000 (01:28 +0200)]
audiod: Document new regular expression syntax.

This changes the man page and the manual. The
usage of regular expressions for receiver, filter
and writers are explained and some examples are
provided.

9 years agoaudiod: Simplify parse_receiver_args().
Andre Noll [Tue, 19 Apr 2011 19:49:42 +0000 (21:49 +0200)]
audiod: Simplify parse_receiver_args().

Call parse_stream_command() rather than duplicating the logic.

9 years agoaudiod: Allow regular expressions in filter config.
Andre Noll [Tue, 19 Apr 2011 19:34:24 +0000 (21:34 +0200)]
audiod: Allow regular expressions in filter config.

9 years agoaudiod: Allow regular expressions in writer config.
Andre Noll [Tue, 19 Apr 2011 18:58:11 +0000 (20:58 +0200)]
audiod: Allow regular expressions in writer config.

9 years agoaudiod: Allow regular expressions in receiver config.
Andre Noll [Tue, 19 Apr 2011 16:18:45 +0000 (18:18 +0200)]
audiod: Allow regular expressions in receiver config.

The audio format substring of the reciever arg can now be a regular
expression rather than only the name of an audio format. This way
one can easily choose the same receiver for all audio formats by
saying e.g.

receiver ".:udp"

This works because the regex "." matches all audio formats.

9 years agoAdd missing alsa_write.ggo to .gitignore.
Andre Noll [Fri, 3 Jun 2011 06:04:11 +0000 (08:04 +0200)]
Add missing alsa_write.ggo to .gitignore.

This file is generated.

9 years agonew codename, reset version to git
Andre Noll [Wed, 1 Jun 2011 14:35:09 +0000 (16:35 +0200)]
new codename, reset version to git

9 years agothe paraslash-0.4.7 release tarball
Andre Noll [Wed, 1 Jun 2011 14:30:30 +0000 (16:30 +0200)]
the paraslash-0.4.7 release tarball

9 years agoparaslash 0.4.7 v0.4.7
Andre Noll [Wed, 1 Jun 2011 14:27:26 +0000 (16:27 +0200)]
paraslash 0.4.7

9 years agoMakefile.in: Add ao_write.ggo to ggos.
Andre Noll [Wed, 1 Jun 2011 14:19:26 +0000 (16:19 +0200)]
Makefile.in: Add ao_write.ggo to ggos.

Without this, compiling the tarball fails with

make: *** No rule to make target `objects/ao_write.cmdline.o', needed by `para_write'.  Stop.

9 years agoogg_get_file_info(): Fix off-by-one.
Andre Noll [Sun, 29 May 2011 11:53:32 +0000 (13:53 +0200)]
ogg_get_file_info(): Fix off-by-one.

The timing information encoded in the chunk table was not always
sufficient to guarantee no buffer underruns since vorbis frames
are frequently spread over two (or more) ogg pages. This should
fix it.

9 years agoalsa: Simplify pre_select().
Andre Noll [Sat, 28 May 2011 11:32:42 +0000 (13:32 +0200)]
alsa: Simplify pre_select().

No need to open-code sched_request_timeout_ms().

9 years agoDo not include net.h if it is not needed.
Andre Noll [Fri, 22 Apr 2011 22:03:35 +0000 (00:03 +0200)]
Do not include net.h if it is not needed.

9 years agonet.c: Combine host_and_port() and __get_sock_name().
Andre Noll [Fri, 22 Apr 2011 02:21:48 +0000 (04:21 +0200)]
net.c: Combine host_and_port() and __get_sock_name().

host_and_port() is only called by __get_sock_name().
Both functions are short enough, and merging these
two functions has the additional benefit that we can
always return the same static buffer.

Compiling with -Wwrite-strings previously caused a
warning due to returning either a string literal, or
the static buffer. We now always print into that buffer
and return it.

This also improves the error message which is returned
in the static buffer in case of failures: Previously we
returned "(don't know)" if getname() failed and "(unknown)"
if getnameinfo() failed. This turns it into "(unknown)" in
the former case and "(lookup error)" otherwise.

9 years agoConstify flowop functions.
Andre Noll [Fri, 22 Apr 2011 02:07:35 +0000 (04:07 +0200)]
Constify flowop functions.

This trivial patch fixes some "discards qualifiers" gcc
warnings when compiling with -Wwrite-strings.

9 years agoMerge branch 't/decl_after_statement'
Andre Noll [Sun, 22 May 2011 13:22:42 +0000 (15:22 +0200)]
Merge branch 't/decl_after_statement'

9 years agodoxify version.h and git-version.h.
Andre Noll [Sun, 22 May 2011 13:22:14 +0000 (15:22 +0200)]
doxify version.h and git-version.h.

9 years agoMove statements after declarations.
Andre Noll [Fri, 22 Apr 2011 14:41:39 +0000 (16:41 +0200)]
Move statements after declarations.

This gets rid of gcc warnings of the form

warning: ISO C90 forbids mixed declarations and code

when compiled with -Wdeclaration-after-statement.

9 years agodoxygen: Add some missing documentation.
Andre Noll [Fri, 22 Apr 2011 16:03:28 +0000 (18:03 +0200)]
doxygen: Add some missing documentation.

9 years agodoxygen: Exclude *.command_list.[ch].
Andre Noll [Fri, 22 Apr 2011 16:01:56 +0000 (18:01 +0200)]
doxygen: Exclude *.command_list.[ch].

These files are auto-generated and the documentation is not very
helpful, so do not generate doxygen pages for these.

9 years agoMerge branch 't/ssh_keys'
Andre Noll [Sun, 15 May 2011 07:39:51 +0000 (09:39 +0200)]
Merge branch 't/ssh_keys'

9 years agoMerge branch 't/const'
Andre Noll [Sun, 15 May 2011 07:38:04 +0000 (09:38 +0200)]
Merge branch 't/const'

9 years agolibao: Avoid segfault on com_cycle.
Andre Noll [Thu, 3 Feb 2011 16:15:27 +0000 (17:15 +0100)]
libao: Avoid segfault on com_cycle.

Executing the cycle command while the ao writer is active can lead to
a segmentation fault because kill_all_decoders() removes the buffer
tree node of the ao writer but leaves its child node alive.

This patch changes kill_all_decoders() to kill the receiver node only
while leaving all other nodes alone, removing the assumption that
the set of filter nodes and writer nodes are the only nodes in the
buffer tree. This assumption used to be true but became false with
the merge of the ao writer which has two buffer tree nodes.

It is enough to kill only the receiver node as all other nodes will
eventually notice that their parent node no longer exists and exit
shortly thereafter.

9 years agoMerge branch 't/libao'
Andre Noll [Thu, 5 May 2011 13:50:49 +0000 (15:50 +0200)]
Merge branch 't/libao'

9 years agomanual: Fix two typos.
Andre Noll [Tue, 26 Apr 2011 22:53:42 +0000 (00:53 +0200)]
manual: Fix two typos.

9 years agomanual: Change instructions for creating RSA keys.
Andre Noll [Thu, 3 Mar 2011 08:31:20 +0000 (09:31 +0100)]
manual: Change instructions for creating RSA keys.

Decribe how to create an rsa key with ssh-keygen instead of
"openssl genrsa".

9 years agoclient: Also try to load the private rsa-ssh key.
Andre Noll [Thu, 25 Nov 2010 07:56:34 +0000 (08:56 +0100)]
client: Also try to load the private rsa-ssh key.

If no key file was given and the default key file ~/.paraslash/key.<user> does
not exist, try ~/.ssh/id_rsa.

9 years agoAdd support for ssh-rsa keys.
Andre Noll [Thu, 25 Nov 2010 07:33:20 +0000 (08:33 +0100)]
Add support for ssh-rsa keys.

This allows to use standard ssh keys (that is, keys generated with
ssh-keygen) for the challenge/response authentication method of
paraslash. Only RSA keys without password protection are supported
at the moment.

Since we want that both openssl and ssh keys just work, we introduce
the helper function is_ssh_rsa_key(). It looks at the first few bytes
of the key to decide which type of public key we have. For openssl
keys, we just call openssl's EVP_PKEY_get1_RSA() and be done. Private
keys generated by ssh-keygen do not differ from keys generated by
"openssl rsa" and need no special treatment either.

However, public ssh rsa keys are stored differently, as an uuencoded
byte stream. So this patch adds functions that decode a given buffer
via base64 or uudecode. The two rsa public parameters (modulus and
exponent) are then read from the decoded buffer using BN_bin2bn().

9 years agofd: Allow passing NULL to para_munmap().
Andre Noll [Tue, 26 Apr 2011 14:33:44 +0000 (16:33 +0200)]
fd: Allow passing NULL to para_munmap().

This patch makes para_munmap succeed with return value 0 if the passed
"start" pointer is NULL. This allows to simplify the code in the
callers a bit, similar to free(NULL).

9 years agoMark a couple of functions as const.
Andre Noll [Tue, 29 Mar 2011 20:03:54 +0000 (22:03 +0200)]
Mark a couple of functions as const.

Probably does not matter much..

9 years agoMerge branch 't/crypt_cleanups'
Andre Noll [Sat, 23 Apr 2011 13:54:59 +0000 (15:54 +0200)]
Merge branch 't/crypt_cleanups'

Conflicts:
Makefile.in

9 years agoMake some variables static.
Andre Noll [Thu, 21 Apr 2011 22:05:43 +0000 (00:05 +0200)]
Make some variables static.

Found by sparse.

9 years agoMerge branch 't/autogen'
Andre Noll [Thu, 21 Apr 2011 20:56:56 +0000 (22:56 +0200)]
Merge branch 't/autogen'

9 years agoKILL E_AO_WRITE.
Andre Noll [Thu, 31 Mar 2011 09:27:49 +0000 (11:27 +0200)]
KILL E_AO_WRITE.

We have E_WRITE_COMMON_EOF, and use of this code is preferred because
para_write treats it as a non-fatal error and exits successfully if
the writer task removed its btr node due to E_WRITER_COMMON_EOF while
it exits non-zero in case of other errors.

9 years agoImplement support for libao via the new ao writer.
Andre Noll [Sat, 5 Mar 2011 11:36:34 +0000 (12:36 +0100)]
Implement support for libao via the new ao writer.

This adds support for another writer to paraslash. The new ao writer
allows to play an audio stream via one of libao's output plugins.

Two new configure options are provided and the documentation is
updated accordingly.