Fixes problems with providers that use quite long ECMs/EMMs.
Store message len in int instead of uint8_t to fix transmission of msgs
longer than 255 bytes (size_t was not an option as some functions return
negative values).
Add msg len check to cs378x as it only allows up to 256 bytes data.
Since r10358 oscam expects ECM pid to be send over the camd3 protocol.
This allows ECMs to be retransmitted over gbox.
This change adds support for sending ecm pid.
This removes tsdecrypt's error message in favour of getopt
native errors. Our message was always 'Unknown parameter'
which was not correct (most of the time) and very misleading.
This is useful when DNS name is used for server address. Without logging
the actual IP address there was no way to know which server refused the
connection or returned error.
Valgrind report:
Invalid read of size 8
at 0x41CCB7: get_socket.constprop.1 (udp.c:81)
by 0x41CDC7: udp_connect_input (udp.c:102)
by 0x404BDE: main (tsdecrypt.c:978)
Address 0x607a410 is 0 bytes after a block of size 64 alloc'd
at 0x4C2A359: malloc (vg_replace_malloc.c:270)
by 0x594955C: gaih_inet (in /lib64/libc-2.17.so)
by 0x594D18C: getaddrinfo (in /lib64/libc-2.17.so)
by 0x41CB95: get_socket.constprop.1 (udp.c:61)
by 0x41CDC7: udp_connect_input (udp.c:102)
by 0x404BDE: main (tsdecrypt.c:978)
Increase how much seconds to assume the key is valid.
10 seconds is a bit low, there are services that change their key
every 15 seconds. Increase the period in which we assume the key is
valid to 30 seconds.
Before this it was possible for pthread_join to hang waiting for
threads to finish. Also if there was no input data exiting was
delayed by a second.
After this patch the exit is instant even if there is no input data
and if a thread hangs and the main process can't stop it after two
seconds tsdecrypt exits anyway.