]> www.vanbest.org Git - sasc-ng.git/commitdiff
cardclient-cccam2: add version/build setting to config
authorleslie <unknown>
Sat, 10 Oct 2009 01:15:51 +0000 (09:15 +0800)
committerleslie <unknown>
Sat, 10 Oct 2009 01:15:51 +0000 (09:15 +0800)
examples/cardclient.conf.example
systems/cardclient/cccam2.c

index e6db6d0881dbb905025657c3a41072bc0e4f2235..6f7f6c754be499fb000c90e17666eee702a898b4 100644 (file)
@@ -56,8 +56,12 @@ gbox:hostname:port:emm/caid/mask
 cccam:hostname:port:emm/caid/mask:socket
 #
 # (the real) cccam client
-# 'nodeid' is your node ID (16characters). Optional, defaults to use random ID
+# 'nodeid' is your node ID (16 characters). Optional, defaults to use random ID
+# 'version/build' is the version and build string send to the server (each max.
+#  31 characters). Optional, defaults to 2.0.11/2892
+# If you want to specify version/build but you don't want to specify a node ID,
+# put a * to the node ID field.
 #
 # NOTE: this is a real client. You don't need to have CCcam running on local
 # machine.
-cccam2:hostname:port:emm/caid/mask:username:password[:nodeid]
+cccam2:hostname:port:emm/caid/mask:username:password[:nodeid][:version/build]
index 58ac4eefa62e7173faa7fb84e514e209b7c419a9..0e311f5520cca2bac906c4ee9684135c8e09d534 100644 (file)
@@ -525,7 +525,7 @@ private:
   cShares shares;
   unsigned char nodeid[8];
   int shareid;
-  char username[21], password[64];
+  char username[21], password[64], versstr[32], buildstr[32];
   bool login, emmProcessing;
   cTimeMs lastsend;
   int pendingDCW, keymaskpos;
@@ -713,19 +713,22 @@ bool cCardClientCCcam2::CanHandle(unsigned short SysId)
 bool cCardClientCCcam2::Init(const char *config)
 {
   cMutexLock lock(this);
+  strn0cpy(versstr,"2.0.11",sizeof(versstr));
+  strn0cpy(buildstr,"2892",sizeof(buildstr));
   int n=0, num=0;
   Logout();
   char ni[17];
   if(!ParseStdConfig(config,&num)
-     || (n=sscanf(&config[num],":%20[^:]:%63[^:]:%16[^:]",username,password,ni))<2 ) return false;
+     || (n=sscanf(&config[num],":%20[^:]:%63[^:]:%16[^:]:%31[^/]:%31[^:]",username,password,ni,versstr,buildstr))<2 ) return false;
   PRINTF(L_CC_CORE,"%s: username=%s password=%s",name,username,password);
-  if(n>2) {
+  if(n>2 && strcmp(ni,"*")) {
     const char *tmp=ni;
     if(GetHex(tmp,nodeid,sizeof(nodeid),false)!=sizeof(nodeid)) return false;
     }
   else
     for(unsigned int i=0; i<sizeof(nodeid); i++) nodeid[i]=rand();
   LDUMP(L_CC_CORE,nodeid,sizeof(nodeid),"Our nodeid:");
+  PRINTF(L_CC_CORE,"Pretended CCcam version '%s' build '%s'",versstr,buildstr);
   return Immediate() ? Login() : true;
 }
 
@@ -808,8 +811,8 @@ bool cCardClientCCcam2::Login(void)
   clt.header.cmd=0;
   SETCMDLEN(&clt.header,sizeof(clt));
   strcpy(clt.username,username);
-  snprintf(clt.version,sizeof(clt.version),"vdr-sc %s",ScVersion);
-  strcpy(clt.build,"2892");
+  strn0cpy(clt.version,versstr,sizeof(clt.version));
+  strn0cpy(clt.build,buildstr,sizeof(clt.build));
   memcpy(clt.nodeid,nodeid,8);
   LDUMP(L_CC_CCCAM2DT,&clt,sizeof(clt),"send clientinfo:");
   if(!CryptSend((unsigned char*)&clt,sizeof(clt))) {