Do not forget to close open file on error.

Patch by DaytonaHack.

git-svn-id: http://streamboard.de.vu/svn/oscam/trunk@8452 4b0bc96b-bc66-0410-9d44-ebda105a78c1
webif: Align fields in templates data before compression.

This prevents crashes on architectures that do not allow unaligned access.
We lose a litlle bit of binary size (~520 bytes) but this is unavoidable
because unaligned access causes crashes.

This fixes crash on DD-WRT reported by basta2k.

git-svn-id: http://streamboard.de.vu/svn/oscam/trunk@8453 4b0bc96b-bc66-0410-9d44-ebda105a78c1
Add emmreassembly reader setting.

Unfortunately r8441 causes too many errors for clients that do not
try to be smart (like dvbapi, see ticket #3204) so this commit reverts
r8441.

I can't see how to make non assembled and assembled emms to work both,
so I'm forced to introduce reader setting that turns off emm reassembly.

For the documentation:

emmreassembly = [0|1], Default: 1 (EMM reassembly is enabled).

emmreassembly = 0 (disable) should be set for viaccess and cryptoworks
readers if the client that you are using to send EMMs is reassembling
them instead of just sending them to OSCam for processing.

Two such clients are mgcamd and ACamd (over newcamd).

git-svn-id: http://streamboard.de.vu/svn/oscam/trunk@8454 4b0bc96b-bc66-0410-9d44-ebda105a78c1
Make ptab in struct s_module embedded not a pointer.

This blows up bss (static) memory nearly twice but we'll get that
back and lots more once we slim down struct s_port in the next
commit.

git-svn-id: http://streamboard.de.vu/svn/oscam/trunk@8455 4b0bc96b-bc66-0410-9d44-ebda105a78c1
Slim down struct s_port.

struct s_port contains filter array and couple of other fields that are
used only for newcamd and nothing else. They waste more than 2k in common
case.

To stop losing this much space, create private structure only for
newcamd fields and allocate it dynamically. This lowers struct s_port
size a lot and of course struct s_ptab even more because it contains
array of struct s_ports's.

New structure sizes (32-bit):
{{{
                  before  after
  struct s_port     2144     12
  struct s_ptab    68612    388
  struct s_config 141260   4812
}}}

Size report (32-bit):

{{{
    text     data      bss      dec    hex filename
  998222     1944   602344  1602510 1873ce before/oscam-1.20-unstable_svn8453-i486-slackware-linux
  998174     1944    61800  1061918 10341e  after/oscam-1.20-unstable_svn8453-i486-slackware-linux
}}}

bloat-o-meter report (32-bit):

{{{
  add/remove: 0/1 grow/shrink: 13/16 up/down: 7897/-548383 (-540486)
  function                                     old     new   delta
  modules                                     1840    9520   +7680
  ...
  cfg                                       141260    4812 -136448
  static.ptab                               411672       - -411672
}}}

git-svn-id: http://streamboard.de.vu/svn/oscam/trunk@8456 4b0bc96b-bc66-0410-9d44-ebda105a78c1
newcamd: Add paranoid checks for per port newcamd data.

Better safe than sorry.

git-svn-id: http://streamboard.de.vu/svn/oscam/trunk@8457 4b0bc96b-bc66-0410-9d44-ebda105a78c1
irdeto: Fix EMM filters.

What this commit does:
  - Allow shared to hex serial only for betacrypt. This allows one more
    free filter slot for Irdeto.
  - Skip not initialised providers. They always have first and third byte 0x00.
  - Improve exit conditions from provider loop. Previous patch could result
    in memory overwrite.
  - Only display "could not start all emm filters" if we break out of the
    provider loop. Previously it would display this message even if we
    haven't skipped emm filters.

Patch by malakudi posted in ticket #3198.

git-svn-id: http://streamboard.de.vu/svn/oscam/trunk@8458 4b0bc96b-bc66-0410-9d44-ebda105a78c1
revert commit 7941
csp don't check ist beta or not
after commt 7990 is not more need 
when cacheex is on while ecmd5 check first.

git-svn-id: http://streamboard.de.vu/svn/oscam/trunk@8459 4b0bc96b-bc66-0410-9d44-ebda105a78c1
bring cacheex rdr 1 back to work after commit 8370
waittime setup on rdr destination server !
ex1 rdr win, no wait when also possibe wait for ex2/ex3/csp cache
but in time for wait answerback from ex1rdr ex2/ex3/csp can also answer

git-svn-id: http://streamboard.de.vu/svn/oscam/trunk@8460 4b0bc96b-bc66-0410-9d44-ebda105a78c1
workaround to prevent rare segfault on free_client
http://www.streamboard.tv/wbb2/thread.php?threadid=37372 

git-svn-id: http://streamboard.de.vu/svn/oscam/trunk@8461 4b0bc96b-bc66-0410-9d44-ebda105a78c1
cfg: Remove camd33 vars from struct s_config when the module is disabled.

git-svn-id: http://streamboard.de.vu/svn/oscam/trunk@8462 4b0bc96b-bc66-0410-9d44-ebda105a78c1
cfg: Remove radegast vars from struct s_config when the module is disabled.

git-svn-id: http://streamboard.de.vu/svn/oscam/trunk@8463 4b0bc96b-bc66-0410-9d44-ebda105a78c1
cfg: Remove camd35 vars from struct s_config when the module is disabled.

git-svn-id: http://streamboard.de.vu/svn/oscam/trunk@8464 4b0bc96b-bc66-0410-9d44-ebda105a78c1
cfg: Remove newcamd vars from struct s_config when the module is disabled.

git-svn-id: http://streamboard.de.vu/svn/oscam/trunk@8465 4b0bc96b-bc66-0410-9d44-ebda105a78c1
cfg: Remove serial vars from struct s_config when the module is disabled.

git-svn-id: http://streamboard.de.vu/svn/oscam/trunk@8466 4b0bc96b-bc66-0410-9d44-ebda105a78c1
ird-guess: Move everything related to irdeto guessing in the module.

git-svn-id: http://streamboard.de.vu/svn/oscam/trunk@8467 4b0bc96b-bc66-0410-9d44-ebda105a78c1
ird-guess: Allocate irdeto guess tab structure dynamically.

git-svn-id: http://streamboard.de.vu/svn/oscam/trunk@8468 4b0bc96b-bc66-0410-9d44-ebda105a78c1
Fix for regression introduces in r8465.

chk_sfilter should return true.

This should fix ticket #3207.

git-svn-id: http://streamboard.de.vu/svn/oscam/trunk@8469 4b0bc96b-bc66-0410-9d44-ebda105a78c1
freebsd