paraslash.git
14 years agoRemove the likely/unlikely macros.
Andre Noll [Sun, 19 Jul 2009 16:09:27 +0000 (18:09 +0200)]
Remove the likely/unlikely macros.

These also slow down the compress filter, its only user, by about 10%.

14 years agoMicro optimizations for the amp filter.
Andre Noll [Sun, 19 Jul 2009 15:56:22 +0000 (17:56 +0200)]
Micro optimizations for the amp filter.

Use memcpy in the special case amp==0 (no amplification) and optimize the code in
the performance-critical loop. Intrestingly, using the likely()/unlikely() macros made the
code slower.

Results (three runs on identical input data on a 32bit x86 machine under Linux, gcc-4.4.0):

old with --amp 3:
        0m0.776s 0m0.790s 0m0.812s, avg: 792
new with --amp 3:
        0m0.456s 0m0.492s 0m0.477s, avg: 475
speedup: 1.67

old with --amp 0:
        0m0.791s 0m0.808s 0m0.810s, avg: 803
new with --amp 0:
        0m0.100s 0m0.103s 0m0.094s, avg: 99
speedup: 8.1

14 years agoDon't include osl.h from the audio format handlers.
Andre Noll [Sun, 19 Jul 2009 13:44:35 +0000 (15:44 +0200)]
Don't include osl.h from the audio format handlers.

They don't need this header, and including it broke compilation with -O0.

14 years agoIntroduce LIST_HEAD macro and use it in audiod_command.
Andre Noll [Sun, 19 Jul 2009 13:23:42 +0000 (15:23 +0200)]
Introduce LIST_HEAD macro and use it in audiod_command.

Using initialized list heads where possible allows to get rid of the checks whether the
list is already initialized.

14 years agoMove functions only needed by audiod from stat.c to audiod_command.c.
Andre Noll [Sun, 19 Jul 2009 13:07:28 +0000 (15:07 +0200)]
Move functions only needed by audiod from stat.c to audiod_command.c.

This was 4 out of 5 and thus should decrease the size of executables for non-Linux
systems a bit as we don't use -fdata-sections -ffunction-sections and -Wl,--gc-sections
there.

Is also allows to remove some entries from para.h.

14 years agoMerge branch 'master' into next
Andre Noll [Sun, 19 Jul 2009 12:16:56 +0000 (14:16 +0200)]
Merge branch 'master' into next

14 years agoFix memory leaks in [alsa,file,oss]write.c.
Andre Noll [Sun, 19 Jul 2009 12:16:42 +0000 (14:16 +0200)]
Fix memory leaks in [alsa,file,oss]write.c.

Small and harmless but anyway.

14 years agoaudiod: Increase default select timeout to 1s.
Andre Noll [Sun, 19 Jul 2009 12:12:14 +0000 (14:12 +0200)]
audiod: Increase default select timeout to 1s.

This was set to 99ms only for debugging purposes three years ago...

14 years agoaudiod: Only call audiod_status_dump twice per second.
Andre Noll [Sun, 19 Jul 2009 12:10:31 +0000 (14:10 +0200)]
audiod: Only call audiod_status_dump twice per second.

audiod_status_dump() is quite expensive and is called in a rather hot path.

14 years agoclient_post_select(): Defer decrypting of server challenge.
Andre Noll [Sun, 19 Jul 2009 01:10:34 +0000 (03:10 +0200)]
client_post_select(): Defer decrypting of server challenge.

The old code worked only by pure luck: We allocated the crypt buffer on the stack as
an ordinary automatic variable. This buffer was filled right after we received the challenge
from the server, but it was used in a _subsequent_ call to client_post_select(). There's
no guarantee that the content of the crypt buffer stays the same between these two calls.

So defer the decryption until the client status is CL_RECEIVED_CHALLENGE, i.e. until
the socket file descriptor is known to be ready for sending back the SHA1 of the decrypted
challenge.

14 years agoRemove unused field challenge_nr from struct client_task.
Andre Noll [Sun, 19 Jul 2009 00:09:47 +0000 (02:09 +0200)]
Remove unused field challenge_nr from struct client_task.

A relict from 0.3.x.

14 years agoMerge branch 'master' into next
Andre Noll [Sat, 18 Jul 2009 13:43:30 +0000 (15:43 +0200)]
Merge branch 'master' into next

Conflicts:
audiod_command.c

14 years agoRemove unused label "out".
Andre Noll [Sat, 18 Jul 2009 13:40:39 +0000 (15:40 +0200)]
Remove unused label "out".

14 years agoMerge branch 'master' into next
Andre Noll [Sat, 18 Jul 2009 13:24:48 +0000 (15:24 +0200)]
Merge branch 'master' into next

Conflicts:
audiod_command.c

14 years agoaudiod: Clean up status output.
Andre Noll [Sat, 18 Jul 2009 13:19:24 +0000 (15:19 +0200)]
audiod: Clean up status output.

It's a mess. Fortunately, this is much cleaner in 0.4.x..

14 years agoaudiod: Properly prefix uptime string.
Andre Noll [Sat, 18 Jul 2009 12:57:15 +0000 (14:57 +0200)]
audiod: Properly prefix uptime string.

The prefix was missing the first time the uptime was printed in the status output.

14 years agoMerge branch 'master' into next
Andre Noll [Sat, 18 Jul 2009 12:27:35 +0000 (14:27 +0200)]
Merge branch 'master' into next

Conflicts:
audiod_command.c

14 years agoaudiod: Fix some memory leaks in the com_stat() error paths.
Andre Noll [Sat, 18 Jul 2009 12:22:25 +0000 (14:22 +0200)]
audiod: Fix some memory leaks in the com_stat() error paths.

14 years agoMerge branch 'master' into next
Andre Noll [Sat, 18 Jul 2009 12:02:13 +0000 (14:02 +0200)]
Merge branch 'master' into next

14 years agoFix a memory leak in filter.c.
Andre Noll [Sat, 18 Jul 2009 12:00:17 +0000 (14:00 +0200)]
Fix a memory leak in filter.c.

We must free the filter configs as well.

14 years agoFix a typo in the udp_recv help.
Andre Noll [Sat, 18 Jul 2009 10:26:04 +0000 (12:26 +0200)]
Fix a typo in the udp_recv help.

14 years agoFix memory leaks in xxx_recv_init().
Andre Noll [Sat, 18 Jul 2009 10:25:39 +0000 (12:25 +0200)]
Fix memory leaks in xxx_recv_init().

Not serious but it's good to make valgrind happy.

14 years agoMerge branch 'master' into next
Andre Noll [Sat, 18 Jul 2009 09:35:41 +0000 (11:35 +0200)]
Merge branch 'master' into next

Conflicts:
client_common.c

14 years agoMake RSA keys larger than 512 bit work.
Andre Noll [Sat, 18 Jul 2009 09:30:24 +0000 (11:30 +0200)]
Make RSA keys larger than 512 bit work.

This allows to use the 2048 bit keys which are necessary for paraslash-0.4.x also for
paraslash-0.3.5.

14 years agoNEWS update.
Andre Noll [Sat, 18 Jul 2009 09:16:44 +0000 (11:16 +0200)]
NEWS update.

14 years agoMerge commit 'meins/next' into next
Andre Noll [Mon, 13 Jul 2009 09:03:30 +0000 (11:03 +0200)]
Merge commit 'meins/next' into next

14 years agoAdd bitrate, frequency, and channels mood methods.
Andre Noll [Sun, 12 Jul 2009 15:30:09 +0000 (17:30 +0200)]
Add bitrate, frequency, and channels mood methods.

This isolates the number comparing code from the year mood method so that it can also
be used by the new methods.

14 years agoAdd mood methods {artist, title, album, comment}_matches.
Andre Noll [Sun, 12 Jul 2009 10:28:26 +0000 (12:28 +0200)]
Add mood methods {artist, title, album, comment}_matches.

Document the new mood methods and remove the documentation of the played_rarely
mood method that has been deleted recently.

14 years agoMerge branch 'master' into next
Andre Noll [Sat, 11 Jul 2009 19:01:40 +0000 (21:01 +0200)]
Merge branch 'master' into next

14 years agoFix com_init() in case arguments are given.
Andre Noll [Sat, 11 Jul 2009 19:01:27 +0000 (21:01 +0200)]
Fix com_init() in case arguments are given.

As the ->name field of struct afs_table was only initialized in the afs process,
com_init(), which gets forked from the server process, did not see the table
names and would segfault due to a NULL pointer dereference if table names
were given as arguments.

Fix it by initializing the ->name fields in the definition of the afs_tables array.

This bug was introduced in commit 53d503ce back in 2007...

14 years agoScoring performance enhancements.
Andre Noll [Sat, 11 Jul 2009 15:13:04 +0000 (17:13 +0200)]
Scoring performance enhancements.

The old scoring code computed the afsi, afhi, and the path of the audio file for each
item of the mood,  which is unnecessary.  This patch moves these computations from
get_item_score() into compute_mood_score() so that afsi, afhi and path are only
computed once  per audio file.

As a result, get_item_score() can no longer fail, so we may skip the checks for negative
return values.

14 years agoMerge branch 'master' into next
Andre Noll [Sat, 11 Jul 2009 14:58:40 +0000 (16:58 +0200)]
Merge branch 'master' into next

Conflicts:
mood.c

14 years agoScoring fixes.
Andre Noll [Sat, 11 Jul 2009 14:53:50 +0000 (16:53 +0200)]
Scoring fixes.

Rename add_item_score to get_item_score(), properly check its return value,
and use the computed score only for admissible files.

14 years agoMove mood methods to a separate file.
Andre Noll [Sat, 11 Jul 2009 13:55:04 +0000 (15:55 +0200)]
Move mood methods to a separate file.

As more mood methods will be added in subsequent patches, it's good to separate
moods from mood methods.

This also removes the played_rarely mood method, since it never really worked: Whether
or not a file was played rarely depends on the afs statistics which have not been
computed at the time the mood scrore function is executed.

14 years agogui: Output "xxx tag not set" for unset tags rather than empty strings.
Andre Noll [Sat, 11 Jul 2009 11:31:50 +0000 (13:31 +0200)]
gui: Output "xxx tag not set" for unset tags rather than empty strings.

14 years agoAdd documentation to struct rc4_context.
Andre Noll [Sat, 11 Jul 2009 11:19:08 +0000 (13:19 +0200)]
Add documentation to struct rc4_context.

14 years agoMerge commit 'meins/next' into next
Andre Noll [Fri, 10 Jul 2009 12:55:05 +0000 (14:55 +0200)]
Merge commit 'meins/next' into next

14 years agoMerge commit 'fml/master' into next
Andre Noll [Fri, 10 Jul 2009 07:46:32 +0000 (09:46 +0200)]
Merge commit 'fml/master' into next

14 years agoAdd the new "year" mood method.
Andre Noll [Thu, 9 Jul 2009 18:11:55 +0000 (20:11 +0200)]
Add the new "year" mood method.

This includes a Y2K heuristic for year tags that contain only two digits. If that two-digit
number N is less or equal than the current year minus 2000, assume that it means 2000 + N.
Otherwise, assume 1900 + N.

Examples: 0 -> 2000, 42 -> 1942, 9->2009.

14 years agoAdd missing regex include to generated command_list files.
Andre Noll [Thu, 9 Jul 2009 18:04:29 +0000 (20:04 +0200)]
Add missing regex include to generated command_list files.

14 years agoMerge branch 'master' into next
Andre Noll [Thu, 9 Jul 2009 14:14:28 +0000 (16:14 +0200)]
Merge branch 'master' into next

14 years agoMerge commit 'meins/next' into next
Andre Noll [Thu, 9 Jul 2009 14:14:19 +0000 (16:14 +0200)]
Merge commit 'meins/next' into next

14 years agoIntroduce para_regcomp.
Andre Noll [Wed, 8 Jul 2009 21:10:49 +0000 (23:10 +0200)]
Introduce para_regcomp.

A wrapper for regcomp() that logs an error message if the regcomp() failed
and uses a return value according to the paraslash rules. Currently there is
only one user of regular expressions, is_v4_dot_quad(), which is converted
to para_regex(), but new callers will be added soon.

Unfortunately, this change made it necessary to include regex.h in all .c files
that use string.h. Clean up the order in which headers are included a bit while
we're at it.

Maybe I should rethink the rule "Only .c files shall include header files"...

14 years agoPass full argument list to mood parsers.
Andre Noll [Wed, 8 Jul 2009 19:59:39 +0000 (21:59 +0200)]
Pass full argument list to mood parsers.

Currently, for each mood line only the first word after the mood method  is passed
to the mood parser. Passing all arguments allows for mood parsers that take more
than one argument.l

14 years agofade.c: Fix a gcc warning on FreeBSD.
Andre Noll [Tue, 7 Jul 2009 13:53:59 +0000 (15:53 +0200)]
fade.c: Fix a gcc warning on FreeBSD.

fade.c:220: warning: long unsigned int format, time_t arg (arg 4)

14 years agoconfigure: Add config options for libosl.
Andre Noll [Mon, 6 Jul 2009 11:18:56 +0000 (13:18 +0200)]
configure: Add config options for libosl.

This adds --with-osl-headers and --with-osl-libs to allow linking against
a version of libosl which is not installed at a standard location.

14 years agoFix some format-string warnings on x86_64.
Andre Noll [Mon, 6 Jul 2009 09:08:28 +0000 (11:08 +0200)]
Fix some format-string warnings on x86_64.

14 years agorecv/filter: Init loglevel earlier.
Andre Noll [Sun, 5 Jul 2009 21:26:54 +0000 (23:26 +0200)]
recv/filter: Init loglevel earlier.

This avoids that early debug messages are always printed.

14 years agofd.c: Simplify write_ok().
Andre Noll [Sun, 5 Jul 2009 20:40:12 +0000 (22:40 +0200)]
fd.c: Simplify write_ok().

Use para_select() rather than open-code it.

14 years agofd.c: Simplify para_select().
Andre Noll [Sun, 5 Jul 2009 20:39:36 +0000 (22:39 +0200)]
fd.c: Simplify para_select().

No need  to save errno into an extra variable.

14 years agocom_stat(): Return a proper error message if an invalid option was given.
Andre Noll [Sun, 5 Jul 2009 20:38:22 +0000 (22:38 +0200)]
com_stat(): Return a proper error message if an invalid option was given.

14 years agoRewrite grab-client code.
Andre Noll [Sun, 5 Jul 2009 20:35:29 +0000 (22:35 +0200)]
Rewrite grab-client code.

This gets rid of the gengetopt grab client command line parser and all the special
treatment it caused.

14 years agoReplace split_args() by create_argv().
Andre Noll [Sun, 5 Jul 2009 16:11:32 +0000 (18:11 +0200)]
Replace split_args() by create_argv().

The latter function is superior as it honors quotes and special characters like '\n'.
This allows for example to use whitespace characters in mood methods.
Fixup and simplify all callers accordingly.

The patch broke the grab command of para_audiod which is deactivated ATM and
will be fixed in a subsequent patch.

14 years agoMerge branch 'master' into next
Andre Noll [Sun, 5 Jul 2009 08:56:17 +0000 (10:56 +0200)]
Merge branch 'master' into next

14 years agoFix a bug in the output of para_audioc.
Andre Noll [Sun, 5 Jul 2009 08:40:55 +0000 (10:40 +0200)]
Fix a bug in the output of para_audioc.

This bites In case of short writes to stdout. The bug was literally there since day one
but never showed up as short writes usually don't happen with the rather small amount
of data that is written by para_audioc.

14 years agogui: Avoid unnecessary strdup's and replace newlines by spaces in curses output.
Andre Noll [Sun, 5 Jul 2009 08:53:06 +0000 (10:53 +0200)]
gui: Avoid unnecessary strdup's and replace newlines by spaces in curses output.

align_str() made a copy of the given buffer because one of its callers, print_in_bar(),
passes a string literal and align_str() needs to truncate large strings.However, all other
callers pass a writable string anyway, so do the strdup() in print_in_bar(). This avoids the
unnecessary copies for each status item.

The areas for the status items was designed to hold only a part of a single line, so status
item text should not contain newlines. The patch replaces newlines by spaces.

Also get rid of a stale comment.

14 years agogui: Use variable-sized input buffer for the audiod pipe.
Andre Noll [Sun, 5 Jul 2009 08:44:23 +0000 (10:44 +0200)]
gui: Use variable-sized input buffer for the audiod pipe.

The previous fixed size of 8192 might be too small if the audio file contains large
tags. OTOH, 8192 is much too large for the bulk of all audio files. So use a small
buffer that gets increased on demand.

14 years agoFix a bug in the output of para_audioc.
Andre Noll [Sun, 5 Jul 2009 08:40:55 +0000 (10:40 +0200)]
Fix a bug in the output of para_audioc.

This bites In case of short writes to stdout. The bug was literally there since day one
but never showed up as short writes usually don't happen with the rather small amount
of data that is written by para_audioc.

14 years agoNew codename for 0.4.
Andre Noll [Sun, 5 Jul 2009 08:38:20 +0000 (10:38 +0200)]
New codename for 0.4.

14 years agoDocumentation updates for 0.4.
Andre Noll [Sun, 5 Jul 2009 08:38:01 +0000 (10:38 +0200)]
Documentation updates for 0.4.

14 years agoMerge branch 'master' into next
Andre Noll [Sat, 4 Jul 2009 21:23:00 +0000 (23:23 +0200)]
Merge branch 'master' into next

14 years agoINSTALL: Fix the help text on how to create the RSA key pair.
Andre Noll [Sat, 4 Jul 2009 21:21:56 +0000 (23:21 +0200)]
INSTALL: Fix the help text on how to create the RSA key pair.

Some day, I will write a user-friendly script that generates the keys...

14 years agoAdd a check for libosl to configure.ac.
Andre Noll [Sat, 4 Jul 2009 19:45:48 +0000 (21:45 +0200)]
Add a check for libosl to configure.ac.

If libosl is not found, configure will exit with an error message describing how
to download and install libosl. We could make it optional and build only the
client side of paraslash if libosl is not available, but that seems not be worth the
trouble as everyone likely wants to build para_server anyway.

14 years agoMakefile: Remove *_command_list.* on make clean.
Andre Noll [Sat, 4 Jul 2009 19:13:23 +0000 (21:13 +0200)]
Makefile: Remove *_command_list.* on make clean.

No need to do this only for maintainer-clean.

14 years agocommand_util: Generate properly documented command header files.
Andre Noll [Sat, 4 Jul 2009 19:12:22 +0000 (21:12 +0200)]
command_util: Generate properly documented command header files.

14 years agopara_server: Don't link with stat.o.
Andre Noll [Sat, 4 Jul 2009 17:23:00 +0000 (19:23 +0200)]
para_server: Don't link with stat.o.

We linked stat.o only because command.o needs the status item array.
Definining this array in command.c allows to link para_server without
stat.o.

14 years agoChange the syntax of the parameters to the touch command.
Andre Noll [Sat, 4 Jul 2009 16:29:31 +0000 (18:29 +0200)]
Change the syntax of the parameters to the touch command.

It's more natural to specify e.g. the numplayed count as

touch -n=42

rather than

touch -n42

14 years agoFix some gcc warnings.
Andre Noll [Sat, 4 Jul 2009 16:19:46 +0000 (18:19 +0200)]
Fix some gcc warnings.

Moving the declaration of send_afs_status() which depends on
struct rc4_context out of afs.h fixes a couple of these:

afs.h:120: warning: 'struct rc4_context' declared inside parameter list

14 years agoMerge branch 'afh_cleanup' into next.
Andre Noll [Sat, 4 Jul 2009 15:15:50 +0000 (17:15 +0200)]
Merge branch 'afh_cleanup' into next.

Quite a few conflicts, but no real problem. git rerere rulez!

Conflicts:
afs.c
afs.cmd
aft.c
attribute.c
audiod_command.c
blob.c
command.c
para.h
server.c
server.cmd
stat.c

14 years agoMerge branch 'crypt' into next
Andre Noll [Sat, 4 Jul 2009 14:25:20 +0000 (16:25 +0200)]
Merge branch 'crypt' into next

14 years agoNEWS update.
Andre Noll [Sat, 4 Jul 2009 14:24:25 +0000 (16:24 +0200)]
NEWS update.

14 years agoaudioc stat: Remove __a_unused attributes from com_stat().
Andre Noll [Sat, 4 Jul 2009 14:22:44 +0000 (16:22 +0200)]
audioc stat: Remove __a_unused attributes from com_stat().

argc and argv _are_ used.

14 years agoaudioc stat: Make status item mask 64 bits wide.
Andre Noll [Sat, 4 Jul 2009 14:21:36 +0000 (16:21 +0200)]
audioc stat: Make status item mask 64 bits wide.

We already have more than 32 status items.

14 years agoMerge commit 'fml/master'
Andre Noll [Sat, 4 Jul 2009 13:53:43 +0000 (15:53 +0200)]
Merge commit 'fml/master'

14 years agoRevamp status item handling.
Andre Noll [Sat, 4 Jul 2009 13:52:39 +0000 (15:52 +0200)]
Revamp status item handling.

This patch changes the way the status items are printed and parsed.
The new parser-friendly format is used internally and, as a side
effect, is also available as an new listing mode for the ls command
and for the stat commands of both para_server and para_audiod.

With the new format, each status item is prefixed by its size, and the
status item identifier is printed as a numerical value. This simplifies
the parsing code in para_audiod/para_gui a bit and should make it
perform better as the status items do not have to be looked up by name.

More importantly, the new format  gets rid of the restriction that
status items should not contain newline characters because the parser
knows in advance how much it has to read to get the complete item. This
restriction became a real problem as more and more audio files contain
(version 2 id3) tags that contain much more than a single line. For
example the linux podcast mp3 files contain the full content of the
podcast as text in the command tag.

14 years agomake_attribute_lines(): Check return value of ().
Andre Noll [Tue, 30 Jun 2009 18:19:27 +0000 (20:19 +0200)]
make_attribute_lines(): Check return value of ().

As get_attribute_text() might fail, we have to check its return value.

14 years agoSupport netmask subsets
Gerrit Renker [Tue, 30 Jun 2009 08:20:19 +0000 (10:20 +0200)]
Support netmask subsets

This allows to specify sets of addresses which are defined by sharing
the least-common netmask value.

For example, if the allow list contains the following addresses:

        10.0.0.2/24  10.0.0.2/32

then the second address is redundant since it is already included
via the first one. The least-common netmask value is 24; with this
patch a command like

        para_client sender http deny 10.0.0.0/24

will catch both addresses.

14 years agoMake allow/deny syntax consistent with that of add/delete
Gerrit Renker [Tue, 30 Jun 2009 08:17:16 +0000 (10:17 +0200)]
Make allow/deny syntax consistent with that of add/delete

After the changes for the add/delete commands, this patch updates
allow/deny to use the same syntax and (almost) the same code.

14 years agoObtain afs status items directly from afs.
Andre Noll [Mon, 29 Jun 2009 17:34:24 +0000 (19:34 +0200)]
Obtain afs status items directly from afs.

This patch changes the way how the afs status items are passed from afs to the stat
command handler. Previously, afs passed the status item string to the server process
whenever a new audio file was loaded. The server process stored the string in the mmd
shared memory area from which it was available to the client process that executed the
stat command.

This approach has the disadvantage that  the size of the string must be restricted to a
fixed number of bytes,  VERBOSE_LS_OUTPUT_SIZE, determined at compile time and
independent of the audio file.  As version 2 id3 tags and vorbis comments do not impose
an upper bound on the size of the tags a rather ugly patch was merged recently to the master
branch which truncated the size of the tags if it exceeded VERBOSE_LS_OUTPUT_SIZE.

This patch gets rid of this restriction by not storing the info string in the mmd structure. Instead,
the stat command requests the information directly from the afs process via the callback
mechanism which is also used by other afs commands.

14 years agoMajor audio format handler cleanups.
Andre Noll [Fri, 26 Jun 2009 18:54:55 +0000 (20:54 +0200)]
Major audio format handler cleanups.

The main change is the replacement of afhi->taginfo by more specific
fields: This patch adds struct taginfo to the audio format handler
info struct.

The prefix is no longer stored inside the osl database, i.e. it is
no longer duplicated for each audio file.

The tag information is only stored in memory as a dynamically allocated
string if it is new, i.e. if the struct was generated by the audio format
handler. If it was retrieved from the database, pointers to the memory
mapped table are used instead.

The crappy fixup_info_string() function is gone. It was too ugly to live.
Of course, this re-introduces the bug it fixed, but as we broke the
on disk format with this patch anyway, we might as well fix it right(TM).
This will be done in a subsequent patch.

afhi->eof_tv is gone as well. It was not useful at all.

14 years agoStronger crypto for client authentication.
Andre Noll [Sun, 21 Jun 2009 18:55:07 +0000 (20:55 +0200)]
Stronger crypto for client authentication.

This patch changes the way clients are authenticated:

- The size of the challenge has been increased from sizeof(unsigned long)
to 64. Openssl's Rand_bytes() is used to get the random buffer for the
challenge and the rc4 keys.

- The client responds with the sha1 hash of the challenge rather than
sending back the decrypted challenge in plain text.

- The rc4 keys are now 2 x 32 bytes long. They are rsa encrypted and
sent together with the challenge.

- Authentication requests for invalid users are not immediatedly denied
as this would reveal the fact that the user does not exist.

- rsa keys are required to be at least 2048 bits long.

14 years agoUpdate to gengetopt 2.22.2.
Andre Noll [Sun, 21 Jun 2009 10:12:28 +0000 (12:12 +0200)]
Update to gengetopt 2.22.2.

This introduced a new gcc warning which is fixed by this patch.

14 years agoMake rc4 encryption/decryption more explicit.
Andre Noll [Sun, 14 Jun 2009 20:50:11 +0000 (22:50 +0200)]
Make rc4 encryption/decryption more explicit.

The old code used a rather fancy way to (de)activate encryption on
a per fd basis: In net.c there was an array of rc4 keys, indexed by fd.
This is rather wastful because the array size is determined by the
highest fd for which encryption is activated.

It's also hard to comprehend and it's easy to get strange results if
one forgets to deactivate the encryption after the fd is closed.

This patch introduces a new structure, rc4_context, which consists of
an fd and the needed rc4 keys. Users explicitly call the new rc4 variants
of the receving/sending functions which take a pointer to a struct
rc4_context instead of a file descriptor but are otherwise identical.

Keep crypt simple!

14 years agoMove para_tmpname() to file_write.c and make it static.
Andre Noll [Sun, 14 Jun 2009 10:30:41 +0000 (12:30 +0200)]
Move para_tmpname() to file_write.c and make it static.

Also use para_random() instead of rand().

14 years agoUse openssl's RAND_load_file() and RAND_bytes() to get randomness.
Andre Noll [Sun, 14 Jun 2009 09:02:17 +0000 (11:02 +0200)]
Use openssl's RAND_load_file() and RAND_bytes() to get randomness.

This should yield random data that is cryptographically stronger than
random().

14 years agoKill the client-0.2.6 compatibility mode and the --plain option.
Andre Noll [Sat, 13 Jun 2009 18:41:59 +0000 (20:41 +0200)]
Kill the client-0.2.6 compatibility mode and the --plain option.

This makes rc4 encryption mandatory.

14 years agoDeactivate gcc's strict aliasing optimizations.
Andre Noll [Sat, 13 Jun 2009 17:22:51 +0000 (19:22 +0200)]
Deactivate gcc's strict aliasing optimizations.

This causes a lot of warnings which are not easy to fix and probably
harmless. So simply disallow gcc to assume the strictest aliasing
rules.

14 years agoReplace the convert_0.2-0.3.sh script by convert_0.3-0.4.sh.
Andre Noll [Sat, 13 Jun 2009 17:17:21 +0000 (19:17 +0200)]
Replace the convert_0.2-0.3.sh script by convert_0.3-0.4.sh.

14 years agoAdd new ls option -d.
Andre Noll [Sat, 13 Jun 2009 11:53:42 +0000 (13:53 +0200)]
Add new ls option -d.

This is useful for the conversion script that transforms the afs
database to the 0.4 format.

14 years agoFix osl() wrapper.
Andre Noll [Fri, 12 Jun 2009 19:39:52 +0000 (21:39 +0200)]
Fix osl() wrapper.

14 years agoFix checking of return values from osl_open().
Andre Noll [Fri, 12 Jun 2009 19:39:38 +0000 (21:39 +0200)]
Fix checking of return values from osl_open().

14 years agoUse different paths for the 0.4 database and the afs socket.
Andre Noll [Fri, 12 Jun 2009 19:38:07 +0000 (21:38 +0200)]
Use different paths for the 0.4 database and the afs socket.

14 years agoAdd osl.h include to generated command C files.
Andre Noll [Thu, 11 Jun 2009 23:13:33 +0000 (01:13 +0200)]
Add osl.h include to generated command C files.

14 years agoFix para_strerror() and use osl() wrapper for osl library calls.
Andre Noll [Thu, 11 Jun 2009 22:35:15 +0000 (00:35 +0200)]
Fix para_strerror() and use osl() wrapper for osl library calls.

14 years agoFirst draft of the libosl patch series.
Andre Noll [Mon, 18 May 2009 07:42:14 +0000 (09:42 +0200)]
First draft of the libosl patch series.

14 years agoMerge commit 'fml/master'
Andre Noll [Sat, 6 Jun 2009 13:48:34 +0000 (15:48 +0200)]
Merge commit 'fml/master'

14 years agoTrivial typo fixes and cosmetic cleanups.
Andre Noll [Thu, 4 Jun 2009 22:43:28 +0000 (00:43 +0200)]
Trivial typo fixes and cosmetic cleanups.

14 years agoFix a typo in the audiod man page.
Andre Noll [Wed, 3 Jun 2009 08:44:23 +0000 (10:44 +0200)]
Fix a typo in the audiod man page.

Thanks to Gerrit Renker who pointed out the typo.

14 years agoMerge commit 'fml/master'
Andre Noll [Sun, 31 May 2009 10:40:10 +0000 (12:40 +0200)]
Merge commit 'fml/master'

14 years agoalsa_write: Avoid EAGAIN.
Andre Noll [Sun, 31 May 2009 10:34:39 +0000 (12:34 +0200)]
alsa_write: Avoid EAGAIN.

Before writing to the sound device, use snd_pcm_avail_update() to
check how many frames alsa will accept and write only that many
frames.