From d259f1323d942305da1d6903ab49d62e7b592628 Mon Sep 17 00:00:00 2001
From: mirv <unknown>
Date: Fri, 4 Jan 2008 19:35:55 +0100
Subject: [PATCH] remove sec. loader code / cleanup. Task done ;)

---
 data.c                            | 31 -------------------------------
 data.h                            | 10 ----------
 smartcard.c                       |  2 +-
 system-common.c                   |  2 --
 systems/conax/conax.c             |  2 --
 systems/constcw/constcw.c         |  2 --
 systems/cryptoworks/cryptoworks.c |  2 --
 systems/nagra/nagra.c             |  2 --
 systems/seca/seca.c               |  2 --
 systems/viaccess/viaccess.c       |  2 --
 10 files changed, 1 insertion(+), 56 deletions(-)

diff --git a/data.c b/data.c
index 7427078..52983df 100644
--- a/data.c
+++ b/data.c
@@ -510,32 +510,6 @@ void cStructLoaders::Purge(void)
     }
 }
 
-// -- cConfRead ----------------------------------------------------------------
-
-bool cConfRead::ConfRead(const char *type, const char *filename, bool missingok)
-{
-  bool res=false;
-  FILE *f=fopen(filename,"r");
-  if(f) {
-    res=true;
-    PRINTF(L_GEN_INFO,"loading %s from %s",type,filename);
-    char buff[1024];
-    while(fgets(buff,sizeof(buff),f)) {
-      if(!index(buff,'\n') && !feof(f))
-        PRINTF(L_GEN_ERROR,"confread %s fgets readbuffer overflow",type);
-      char *line=skipspace(stripspace(buff));
-      if(line[0]==0 || line[0]==';' || line[0]=='#') continue; // skip empty & comment lines
-      if(!ParseLine(line,false)) {
-        PRINTF(L_GEN_ERROR,"file '%s' has error in line '%s'",filename,buff);
-        res=false;
-        }
-      }
-    fclose(f);
-    }
-  else if(!missingok) PRINTF(L_GEN_ERROR,"Failed to open file '%s': %s",filename,strerror(errno));
-  return res;
-}
-
 // -- cPid ---------------------------------------------------------------------
 
 cPid::cPid(int Pid, int Section, int Mask, int Mode)
@@ -677,11 +651,6 @@ cString cPlainKey::ToString(bool hide)
   return cString::sprintf(hide ? "%c %.*X %s %.4s..." : "%c %.*X %s %s",type,IdSize(),id,*PrintKeyNr(),*Print());
 }
 
-void cPlainKey::FormatError(const char *type, const char *sline)
-{
-  PRINTF(L_GEN_WARN,"%s key: bad format '%.15s%s'\n",type,sline,(strlen(sline)>15)?"...":"");
-}
-
 // -- cMutableKey --------------------------------------------------------------
 
 cMutableKey::cMutableKey(bool Super)
diff --git a/data.h b/data.h
index 1e7a879..ff5e378 100644
--- a/data.h
+++ b/data.h
@@ -191,15 +191,6 @@ public:
 
 // ----------------------------------------------------------------
 
-class cConfRead {
-public:
-  virtual ~cConfRead() {}
-  bool ConfRead(const char *type, const char *filename, bool missingok=false);
-  virtual bool ParseLine(const char *line, bool fromCache)=0;
-  };
-
-// ----------------------------------------------------------------
-
 class cPid : public cSimpleItem {
 public:
   int pid, sct, mask, mode;
@@ -266,7 +257,6 @@ protected:
   virtual int IdSize(void);
   virtual cString Print(void)=0;
   virtual cString PrintKeyNr(void);
-  void FormatError(const char *type, const char *sline);
 public:
   int type, id, keynr;
   //
diff --git a/smartcard.c b/smartcard.c
index 14cd9be..957c0cf 100644
--- a/smartcard.c
+++ b/smartcard.c
@@ -1107,7 +1107,7 @@ static const char *serModes[] = { 0,"8e2","8o2","8n2" };
 
 cSmartCards::cSmartCards(void)
 :cThread("SmartcardWatcher")
-,cStructList<cSmartCardData>("smartcard data",DATAFILE,SL_MISSINGOK|SL_WATCH)
+,cStructList<cSmartCardData>("smartcard data",DATAFILE,SL_MISSINGOK|SL_WATCH|SL_VERBOSE)
 {
   for(int i=0 ; i<MAX_PORTS ; i++) ports[i].Serial=0;
   firstRun=true;
diff --git a/system-common.c b/system-common.c
index eec12fe..fdaec09 100644
--- a/system-common.c
+++ b/system-common.c
@@ -153,7 +153,6 @@ cPlainKeyStd::cPlainKeyStd(bool Super)
 bool cPlainKeyStd::Parse(const char *line)
 {
   unsigned char sid[3], skeynr, skey[PLAINLEN_STD];
-  const char *sline=line;
   int len;
   if(GetChar(line,&type,1) && (len=GetHex(line,sid,3,false)) &&
      GetHex(line,&skeynr,1) && GetHex(line,skey,PLAINLEN_STD)) {
@@ -161,7 +160,6 @@ bool cPlainKeyStd::Parse(const char *line)
     SetBinKey(skey,PLAINLEN_STD);
     return true;
     }
-  FormatError("standard",sline);
   return false;
 }
 
diff --git a/systems/conax/conax.c b/systems/conax/conax.c
index abf7e47..390760b 100644
--- a/systems/conax/conax.c
+++ b/systems/conax/conax.c
@@ -150,14 +150,12 @@ cPlainKeyConax::cPlainKeyConax(bool Super)
 bool cPlainKeyConax::Parse(const char *line)
 {
   unsigned char sid, skey[PLAINLEN_CONAX];
-  const char *sline=line;
   if(GetChar(line,&type,1) && GetHex(line,&sid,1) &&
      GetChar(line,&keynr,1) && GetHex(line,skey,PLAINLEN_CONAX)) {
     type=toupper(type); keynr=toupper(keynr); id=sid;
     SetBinKey(skey,PLAINLEN_CONAX);
     return true;
     }
-  FormatError("conax",sline);
   return false;
 }
 
diff --git a/systems/constcw/constcw.c b/systems/constcw/constcw.c
index 1a5fc67..56ddd46 100644
--- a/systems/constcw/constcw.c
+++ b/systems/constcw/constcw.c
@@ -66,7 +66,6 @@ bool cPlainKeyConstCw::Matches(const cEcmInfo *ecm)
 bool cPlainKeyConstCw::Parse(const char *line)
 {
   unsigned char caid[2], skey[PLAINLEN_CW];
-  const char *sline=line;
   if(GetChar(line,&type,1) && GetHex(line,caid,2)) {
     int num;
     char srcBuf[16];
@@ -85,7 +84,6 @@ bool cPlainKeyConstCw::Parse(const char *line)
         }
       }
     }
-  FormatError("constcw",sline);
   return false;
 }
 
diff --git a/systems/cryptoworks/cryptoworks.c b/systems/cryptoworks/cryptoworks.c
index f0b9205..1fc0d6b 100644
--- a/systems/cryptoworks/cryptoworks.c
+++ b/systems/cryptoworks/cryptoworks.c
@@ -359,7 +359,6 @@ bool cPlainKeyCryptoworks::IsBNKey(void) const
 
 bool cPlainKeyCryptoworks::Parse(const char *line)
 {
-  const char *sline=line;
   unsigned char sid[2], sprov;
   if(GetChar(line,&type,1) && GetHex(line,sid,2) && GetHex(line,&sprov,1)) {
     int keylen, prov;
@@ -386,7 +385,6 @@ bool cPlainKeyCryptoworks::Parse(const char *line)
         }
       }
     }
-  FormatError("cryptoworks",sline);
   return false;
 }
 
diff --git a/systems/nagra/nagra.c b/systems/nagra/nagra.c
index 9844a82..09fa884 100644
--- a/systems/nagra/nagra.c
+++ b/systems/nagra/nagra.c
@@ -101,7 +101,6 @@ void cPlainKeyNagra::GetTagDef(int nr, int &romnr, int &pk, int &keytype)
 bool cPlainKeyNagra::Parse(const char *line)
 {
   unsigned char sid[2];
-  const char *sline=line;
   int len;
   if(GetChar(line,&type,1) && (len=GetHex(line,sid,2,false))) {
     type=toupper(type); id=Bin2Int(sid,len); 
@@ -172,7 +171,6 @@ bool cPlainKeyNagra::Parse(const char *line)
       return true;
       }
     }
-  FormatError("nagra",sline);
   return false;
 }
 
diff --git a/systems/seca/seca.c b/systems/seca/seca.c
index b91650d..5f51736 100644
--- a/systems/seca/seca.c
+++ b/systems/seca/seca.c
@@ -95,7 +95,6 @@ bool cPlainKeySeca::IsBNKey(void) const
 bool cPlainKeySeca::Parse(const char *line)
 {
   unsigned char sid[2];
-  const char *sline=line;
   int len;
   if(GetChar(line,&type,1) && (len=GetHex(line,sid,2,false))) {
     type=toupper(type); id=Bin2Int(sid,len);
@@ -143,7 +142,6 @@ bool cPlainKeySeca::Parse(const char *line)
         }
       }
     }
-  FormatError("seca",sline);
   return false;
 }
 
diff --git a/systems/viaccess/viaccess.c b/systems/viaccess/viaccess.c
index d083894..a0f5adc 100644
--- a/systems/viaccess/viaccess.c
+++ b/systems/viaccess/viaccess.c
@@ -80,7 +80,6 @@ bool cPlainKeyVia::SetBinKey(unsigned char *Mem, int Keylen)
 bool cPlainKeyVia::Parse(const char *line)
 {
   unsigned char sid[3], skeynr, skey[VIA2_KEYLEN];
-  const char *sline=line;
   int len;
   if(GetChar(line,&type,1) && (len=GetHex(line,sid,3,false))) {
      type=toupper(type); id=Bin2Int(sid,len);
@@ -105,7 +104,6 @@ bool cPlainKeyVia::Parse(const char *line)
        return true;
        }
     }
-  FormatError("viaccess",sline);
   return false;
 }
 
-- 
2.39.5