diff -Nru sc-0.5.10-original/systems/cardclient/cc.mk sc/systems/cardclient/cc.mk
--- sc-0.5.10-original/systems/cardclient/cc.mk	2006-05-29 11:49:11.000000000 +0200
+++ sc/systems/cardclient/cc.mk	2007-01-15 15:58:34.000000000 +0100
@@ -2,5 +2,5 @@
 # Cardclient
 #
 TARGET = cardclient
-OBJS   = cc.o camd.o radegast.o aroureos.o newcamd.o
+OBJS   = cc.o camd.o radegast.o aroureos.o newcamd.o satbazaar.o
 LIBS   = -lcrypto -lcrypt
diff -Nru sc-0.5.10-original/systems/cardclient/satbazaar.c sc/systems/cardclient/satbazaar.c
--- sc-0.5.10-original/systems/cardclient/satbazaar.c	1970-01-01 01:00:00.000000000 +0100
+++ sc/systems/cardclient/satbazaar.c	2007-01-15 16:56:28.000000000 +0100
@@ -0,0 +1,237 @@
+/*
+ * Softcam plugin to VDR (C++)
+ * SatBazaar implementation (c) 2007 by Manio
+ * (v. 0.2)
+ *
+ * Revision history:
+ * 0.1      Initial release
+ * 0.2      Added support to SBCL (thanks to gosad)
+ *          Splitted into two clients: Satbazaar and SBCL
+ *
+ * This code is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This code is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include <stdio.h>
+#include <string.h>
+
+#include "common.h"
+#include "cc.h"
+#include "data.h"
+#include "network.h"
+
+#include <openssl/md5.h>
+#define CWTIMEOUT 7000 //ms
+
+// -- cSatBazaarCommon ---------------------------------------------------------
+
+class cSatBazaarCommon : public cCardClient {
+protected:
+  cNetSocket so;
+  virtual bool Login(void);
+public:
+  cSatBazaarCommon(const char *Name);
+  virtual bool Init(const char *config);
+  virtual bool ProcessECM(const cEcmInfo *ecm, const unsigned char *source, unsigned char *cw);
+};
+
+cSatBazaarCommon::cSatBazaarCommon(const char *Name)
+:cCardClient(Name)
+,so(DEFAULT_CONNECT_TIMEOUT,CWTIMEOUT/1000,DEFAULT_IDLE_TIMEOUT)
+{}
+
+bool cSatBazaarCommon::Init(const char *config)
+{
+  cMutexLock lock(this);
+  so.Disconnect();
+  return ParseStdConfig(config);
+}
+
+bool cSatBazaarCommon::Login(void)
+{
+  so.Disconnect();
+  if (!so.Connect(hostname,port))
+    return false;
+  dc(printf("cc-%s: connected to %s:%d\n",name,hostname,port))
+  return true;
+}
+
+bool cSatBazaarCommon::ProcessECM(const cEcmInfo *ecm, const unsigned char *source, unsigned char *cw)
+{
+  static unsigned char ecm_reply_ok[]={0x08,0x00,0x24,0x01,0x10};
+  const int ecmlen=(SCT_LEN(source))-8;
+  const int ecmstart=16;
+  unsigned char rxbuff[256+32];
+  unsigned char txbuff[256+32];
+
+  cMutexLock lock(this);
+  so.Flush();
+
+  //tworzenie pakietu z ECM'em do wyslania
+  txbuff[0]=0x06;            // ECM (ECM packet intended for decryption)
+
+  txbuff[1]=0x00;            // len dla calego pakietu
+  txbuff[2]=0x1f+ecmlen;     // = 7B (reszta pakietu (0x1f) + dlugosc ECM)
+
+  txbuff[3]=0x01;            // CAID
+  txbuff[4]=0x02;            // len
+  txbuff[5]=0x01;            // CA
+  txbuff[6]=0x00;            // ID
+
+  txbuff[7]=0x02;            // PROVID (provider ID)
+  txbuff[8]=0x02;            // len (1-8)
+  txbuff[9]=0x00;            // wpisane
+  txbuff[10]=0x65;           // na stale (bo ecm->provID jest w formacie ASCII)
+  //sprintf((char*)&txbuff[9],"%02X",ecm->provId);
+
+  txbuff[11]=0x03;           // KEYNO (operation key number)
+  txbuff[12]=0x01;           // len (1-2)
+  txbuff[13]=source[7];      // = 9C
+
+  txbuff[14]=4;              // PACKET (raw ECM packet)
+  txbuff[15]=ecmlen;         // len (<FF)
+  memcpy(&txbuff[ecmstart],source+8,ecmlen);    // ECM wlasciwy (pomijamy 8 pierwszych bajtow)
+  int i=ecmstart+ecmlen;     // aktualny wskanik w buforze
+
+  txbuff[i++]=0x05;          // HASH (MD5 hash of the raw ECM packet)
+  txbuff[i++]=0x10;          // len (0x10)
+  //obliczamy MD5 dla ECM'a
+  MD5(txbuff+ecmstart,ecmlen,txbuff+i); // MD5 hash
+
+  //dc(printf("cc-%s: TX [ECM] ",name));
+  //HexDump((const unsigned char*)&txbuff, i+16);
+
+  //wyslanie zapytania do cardservera
+  if(!SendMsg(&so,txbuff,i+16))
+    return false;
+
+  //odebranie odpowiedzi
+  int n=RecvMsg(&so,rxbuff,sizeof(rxbuff));
+  if(n>0)    //cos odebral
+  {
+    //dc(printf("cc-%s: RX ",name));
+    //HexDump((const unsigned char*)&rxbuff, rxbuff[2]+3);
+
+    //sprawdzenie czy odebrany pakiet to DW
+    if ( (memcmp(rxbuff,ecm_reply_ok,5)==0) && (rxbuff[21]==0x02 && rxbuff[22]==0x10) )
+    {
+      // sprawdzenie czy odebrany DW to ten na ktory czekamy
+      // czyli porownanie wygenerowanego z ECM'a MD5 z otrzymanym DW
+      if (memcmp((unsigned char*)&txbuff[i],(unsigned char*)&rxbuff[5],16)==0)
+      {
+        //dc(printf("cc-%s: correct md5 matched - sending cw to card\n",name))
+        memcpy(cw,&rxbuff[23],16);    //kopiujemy klucz
+        return true;
+      }
+    }
+  }
+  return false;
+}
+
+// -- cCardClientSatBazaar -----------------------------------------------------
+
+class cCardClientSatBazaar : public cSatBazaarCommon {
+public:
+  cCardClientSatBazaar(const char *Name);
+};
+
+static cCardClientLinkReg<cCardClientSatBazaar> __sbaz("satbazaar");
+
+cCardClientSatBazaar::cCardClientSatBazaar(const char *Name)
+:cSatBazaarCommon(Name)
+{}
+
+// -- cCardClientSBCL ----------------------------------------------------------
+
+class cCardClientSBCL : public cSatBazaarCommon {
+protected:
+  char username[32], password[32];
+  virtual bool Login(void);
+public:
+  virtual bool Init(const char *config);
+  cCardClientSBCL(const char *Name);
+};
+
+static cCardClientLinkReg<cCardClientSBCL> __sbcl("sbcl");
+
+cCardClientSBCL::cCardClientSBCL(const char *Name)
+:cSatBazaarCommon(Name)
+{}
+
+bool cCardClientSBCL::Init(const char *config)
+{
+  int num=0;
+  cMutexLock lock(this);
+  so.Disconnect();
+  if (!ParseStdConfig(config,&num) || sscanf(&config[num],":%31[^:]:%31[^:]",username,password)!=2)
+    return false;
+  dc(printf("cc-%s: username=%s password=%s\n",name,username,password));
+    return true;
+}
+
+bool cCardClientSBCL::Login(void)
+{
+  unsigned char buff[256];
+  if(!cSatBazaarCommon::Login())
+    return false;
+  int len=strlen(username);
+  //tworzenie pakietu z loginem
+  buff[0]=0x02;
+  buff[1]=0x00;
+  buff[2]=2+len+12;
+  buff[3]=0x01;
+  buff[4]=len;
+  memcpy(&buff[5],username,strlen(username));
+  int i=strlen(username)+5;
+  buff[i]=02;
+  buff[++i]=16;
+  memcpy(&buff[++i],"VDR  v0.8i",10);
+
+  //wyslanie loginu
+  if (!SendMsg(&so,buff,i+10))
+    return false;
+
+  //odebranie odpowiedzi
+  int n=RecvMsg(&so,buff,sizeof(buff));
+  if(n>0)    //cos odebral
+  {
+    //nieprawidlowa odpowiedz na login
+    if(buff[0]!=0x03)
+      return false;
+
+    //tworzenie pakietu z haslem
+    len=strlen(password);
+    buff[0]=0x04;
+    buff[1]=0x00;
+    buff[2]=0x02+len;
+    buff[3]=0x01;
+    buff[4]=len;
+    memcpy(&buff[5],password,strlen(password));
+
+    //wyslanie hasla
+    if(!SendMsg(&so,buff,strlen(password)+5))
+      return false;
+
+    //odebranie odpowiedzi
+    int n=RecvMsg(&so,buff,sizeof(buff));
+    if(n>0)    //cos odebral
+    {   
+      //sprawdzenie odpowiedzi na haslo
+      if(buff[0]==0x05)
+        return true;
+    }
+  }
+  return false;
+}

