Index: /trunk/globals.h
===================================================================
--- /trunk/globals.h (revision 5308)
+++ /trunk/globals.h (revision 5309)
@@ -1351,7 +1351,7 @@
extern void fprintf_conf(FILE *f, int32_t varnameWidth, const char *varname, const char *fmtstring, ...);
extern void cs_strncpy(char * destination, const char * source, size_t num);
-extern char *get_servicename(struct s_client *cl, int32_t srvid, int32_t caid);
-extern char *get_tiername(int32_t tierid, int32_t caid);
-extern char *get_provider(int32_t caid, uint32_t provid);
+extern char *get_servicename(struct s_client *cl, int32_t srvid, int32_t caid, char *buf);
+extern char *get_tiername(int32_t tierid, int32_t caid, char *buf);
+extern char *get_provider(int32_t caid, uint32_t provid, char *buf);
extern void make_non_blocking(int32_t fd);
extern uchar fast_rnd(void);
Index: /trunk/module-camd35.c
===================================================================
--- /trunk/module-camd35.c (revision 5308)
+++ /trunk/module-camd35.c (revision 5309)
@@ -50,4 +50,5 @@
struct s_auth *account;
struct s_client *cl = cur_client();
+ unsigned char md5tmp[MD5_DIGEST_LENGTH];
if (cl->upwd[0])
@@ -56,9 +57,9 @@
crc=(((ucrc[0]<<24) | (ucrc[1]<<16) | (ucrc[2]<<8) | ucrc[3]) & 0xffffffffL);
for (account=cfg.account; (account) && (!cl->upwd[0]); account=account->next)
- if (crc==crc32(0L, MD5((unsigned char *)account->usr, strlen(account->usr), cl->dump), 16))
+ if (crc==crc32(0L, MD5((unsigned char *)account->usr, strlen(account->usr), md5tmp), MD5_DIGEST_LENGTH))
{
memcpy(cl->ucrc, ucrc, 4);
cs_strncpy((char *)cl->upwd, account->pwd, sizeof(cl->upwd));
- aes_set_key((char *) MD5(cl->upwd, strlen((char *)cl->upwd), cl->dump));
+ aes_set_key((char *) MD5(cl->upwd, strlen((char *)cl->upwd), md5tmp));
rc=cs_auth_client(cl, account, NULL);
}
@@ -371,8 +372,9 @@
static void casc_set_account()
{
+ unsigned char md5tmp[MD5_DIGEST_LENGTH];
struct s_client *cl = cur_client();
cs_strncpy((char *)cl->upwd, cl->reader->r_pwd, sizeof(cl->upwd));
- memcpy(cl->ucrc, i2b(4, crc32(0L, MD5((unsigned char *)cl->reader->r_usr, strlen(cl->reader->r_usr), cl->dump), 16)), 4);
- aes_set_key((char *)MD5(cl->upwd, strlen((char *)cl->upwd), cl->dump));
+ memcpy(cl->ucrc, i2b(4, crc32(0L, MD5((unsigned char *)cl->reader->r_usr, strlen(cl->reader->r_usr), md5tmp), 16)), 4);
+ aes_set_key((char *)MD5(cl->upwd, strlen((char *)cl->upwd), md5tmp));
cl->crypted=1;
}
Index: /trunk/module-dvbapi.c
===================================================================
--- /trunk/module-dvbapi.c (revision 5308)
+++ /trunk/module-dvbapi.c (revision 5309)
@@ -1110,6 +1110,7 @@
cs_debug_mask(D_DVBAPI, "Found %d ECMpids and %d STREAMpids in PMT", demux[demux_id].ECMpidcount, demux[demux_id].STREAMpidcount);
- char *name = get_servicename(dvbapi_client, demux[demux_id].program_number, demux[demux_id].ECMpidcount>0 ? demux[demux_id].ECMpids[0].CAID : 0);
- cs_log("new program number: %04X (%s)", program_number, name);
+ char channame[32];
+ get_servicename(dvbapi_client, demux[demux_id].program_number, demux[demux_id].ECMpidcount>0 ? demux[demux_id].ECMpids[0].CAID : 0, channame);
+ cs_log("new program number: %04X (%s)", program_number, channame);
#ifdef AZBOX
Index: /trunk/module-lcd.c
===================================================================
--- /trunk/module-lcd.c (revision 5308)
+++ /trunk/module-lcd.c (revision 5309)
@@ -20,4 +20,5 @@
char targetfile[256];
+ char channame[32];
snprintf(targetfile, sizeof(targetfile),"%s%s", get_tmp_dir(), "/oscam.lcd");
@@ -170,5 +171,5 @@
count_u++;
- get_servicename(cl, cl->last_srvid, cl->last_caid);
+ get_servicename(cl, cl->last_srvid, cl->last_caid, channame);
fprintf(fpsave,"%s%d | %-10.10s | %-10.10s:%-17.17s| % 4d\n",
type,
Index: /trunk/module-monitor.c
===================================================================
--- /trunk/module-monitor.c (revision 5308)
+++ /trunk/module-monitor.c (revision 5309)
@@ -49,4 +49,5 @@
struct s_auth *account;
struct s_client *cur_cl = cur_client();
+ unsigned char md5tmp[MD5_DIGEST_LENGTH];
if (cur_cl->auth)
@@ -61,8 +62,8 @@
for (account=cfg.account; (account) && (!cur_cl->auth); account=account->next)
if ((account->monlvl) &&
- (crc==crc32(0L, MD5((unsigned char *)account->usr, strlen(account->usr), cur_cl->dump), 16)))
+ (crc==crc32(0L, MD5((unsigned char *)account->usr, strlen(account->usr), md5tmp), MD5_DIGEST_LENGTH)))
{
memcpy(cur_cl->ucrc, ucrc, 4);
- aes_set_key((char *)MD5((unsigned char *)account->pwd, strlen(account->pwd), cur_cl->dump));
+ aes_set_key((char *)MD5((unsigned char *)account->pwd, strlen(account->pwd), md5tmp));
if (cs_auth_client(cur_cl, account, NULL))
cs_exit(0);
@@ -225,6 +226,6 @@
}
-static char *monitor_client_info(char id, struct s_client *cl){
- static char sbuf[256];
+static char *monitor_client_info(char id, struct s_client *cl, char *sbuf){
+ char channame[32];
sbuf[0] = '\0';
@@ -288,9 +289,9 @@
int32_t cnr=get_threadnum(cl);
snprintf(ltime, sizeof(ldate), "%02d:%02d:%02d", lt.tm_hour, lt.tm_min, lt.tm_sec);
- snprintf(sbuf, sizeof(sbuf), "[%c--CCC]%8X|%c|%d|%s|%d|%d|%s|%d|%s|%s|%s|%d|%04X:%04X|%s|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d\n",
+ snprintf(sbuf, 256, "[%c--CCC]%8X|%c|%d|%s|%d|%d|%s|%d|%s|%s|%s|%d|%04X:%04X|%s|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d\n",
id, (uint32_t)cl->thread, cl->typ, cnr, usr, cau, cl->crypted,
cs_inet_ntoa(cl->ip), cl->port, monitor_get_proto(cl),
ldate, ltime, lsec, cl->last_caid, cl->last_srvid,
- get_servicename(cl, cl->last_srvid, cl->last_caid), isec, con,
+ get_servicename(cl, cl->last_srvid, cl->last_caid, channame), isec, con,
cl->cwfound, cl->cwnot, cl->cwcache, cl->cwignored,
cl->cwtout, cl->emmok, cl->emmnok, lrt);
@@ -302,4 +303,5 @@
static void monitor_process_info(){
time_t now = time((time_t)0);
+ char sbuf[256];
struct s_client *cl, *cur_cl = cur_client();
@@ -315,5 +317,5 @@
continue;
}
- monitor_send_info(monitor_client_info('I', cl), 0);
+ monitor_send_info(monitor_client_info('I', cl, sbuf), 0);
}
}
@@ -438,5 +440,5 @@
break;
case 'c': case 'm':
- monitor_send_details(monitor_client_info(1, cl), (uint32_t)(cl->thread));
+ monitor_send_details(monitor_client_info(1, cl, sbuf), (uint32_t)(cl->thread));
break;
case 'r':
@@ -444,5 +446,5 @@
break;
case 'p':
- monitor_send_details(monitor_client_info(1, cl), (uint32_t)(cl->thread));
+ monitor_send_details(monitor_client_info(1, cl, sbuf), (uint32_t)(cl->thread));
break;
}
Index: /trunk/module-stat.c
===================================================================
--- /trunk/module-stat.c (revision 5308)
+++ /trunk/module-stat.c (revision 5309)
@@ -597,7 +597,8 @@
void convert_to_beta_int(ECM_REQUEST *er, uint16_t caid_to)
{
+ unsigned char md5tmp[MD5_DIGEST_LENGTH];
convert_to_beta(er->client, er, caid_to);
// update ecmd5 for store ECM in cache
- memcpy(er->ecmd5, MD5(er->ecm+13, er->l-13, er->client->dump), CS_ECMSTORESIZE);
+ memcpy(er->ecmd5, MD5(er->ecm+13, er->l-13, md5tmp), CS_ECMSTORESIZE);
}
Index: /trunk/oscam-http.c
===================================================================
--- /trunk/oscam-http.c (revision 5308)
+++ /trunk/oscam-http.c (revision 5309)
@@ -1255,5 +1255,5 @@
int32_t rowcount = 0;
uint64_t ecmcount = 0;
- time_t lastaccess=0;
+ time_t lastaccess = 0;
if (rdr->lb_stat) {
@@ -1264,4 +1264,5 @@
LL_ITER it = ll_iter_create(rdr->lb_stat);
READER_STAT *stat = ll_iter_next(&it);
+ char channame[32];
while (stat) {
@@ -1272,5 +1273,5 @@
if (!apicall) {
tpl_printf(vars, TPLADD, "CHANNEL", "%04X:%06lX:%04X", stat->caid, stat->prid, stat->srvid);
- tpl_addVar(vars, TPLADD, "CHANNELNAME", xml_encode(vars, get_servicename(cur_client(), stat->srvid, stat->caid)));
+ tpl_addVar(vars, TPLADD, "CHANNELNAME", xml_encode(vars, get_servicename(cur_client(), stat->srvid, stat->caid, channame)));
tpl_printf(vars, TPLADD, "ECMLEN","%04hX", stat->ecmlen);
tpl_addVar(vars, TPLADD, "RC", stxt[stat->rc]);
@@ -1293,5 +1294,5 @@
tpl_printf(vars, TPLADD, "ECMSRVID", "%04X", stat->srvid);
tpl_printf(vars, TPLADD, "ECMLEN", "%04hX", stat->ecmlen);
- tpl_addVar(vars, TPLADD, "ECMCHANNELNAME", xml_encode(vars, get_servicename(cur_client(), stat->srvid, stat->caid)));
+ tpl_addVar(vars, TPLADD, "ECMCHANNELNAME", xml_encode(vars, get_servicename(cur_client(), stat->srvid, stat->caid, channame)));
tpl_printf(vars, TPLADD, "ECMTIME", "%d", stat->time_avg);
tpl_printf(vars, TPLADD, "ECMTIMELAST", "%d", stat->time_stat[stat->time_idx]);
@@ -1685,8 +1686,9 @@
}
if(latestclient != NULL) {
+ char channame[32];
status = "connected";
classname = "connected";
proto = monitor_get_proto(latestclient);
- lastchan = xml_encode(vars, get_servicename(latestclient, latestclient->last_srvid, latestclient->last_caid));
+ lastchan = xml_encode(vars, get_servicename(latestclient, latestclient->last_srvid, latestclient->last_caid, channame));
lastresponsetm = latestclient->cwlastresptime;
tpl_addVar(vars, TPLADDONCE, "CLIENTIP", cs_inet_ntoa(latestclient->ip));
@@ -1840,4 +1842,5 @@
uint8_t serbuf[8];
+ char provname[83];
// @todo alno: sort by click, 0=ascending, 1=descending (maybe two buttons or reverse on second click)
@@ -1913,5 +1916,5 @@
while ((prov = ll_iter_next(&pit))) {
- provider = xml_encode(vars, get_provider(card->caid, prov->prov));
+ provider = xml_encode(vars, get_provider(card->caid, prov->prov, provname));
if (!apicall) {
@@ -2281,6 +2284,8 @@
}
- if(!cfg.mon_appendchaninfo)
- get_servicename(cl, cl->last_srvid, cl->last_caid);
+ if(!cfg.mon_appendchaninfo){
+ char channame[32];
+ get_servicename(cl, cl->last_srvid, cl->last_caid, channame);
+ }
tpl_printf(vars, TPLADD, "CLIENTSRVPROVIDER","%s%s", cl->last_srvidptr && cl->last_srvidptr->prov ? xml_encode(vars, cl->last_srvidptr->prov) : "", cl->last_srvidptr && cl->last_srvidptr->prov ? ": " : "");
@@ -2534,4 +2539,5 @@
struct s_sidtab *sidtab, *sidtab2;
char *service = getParam(params, "service");
+ char channame[32];
int32_t i, found = 0;
@@ -2572,5 +2578,5 @@
tpl_printf(vars, TPLAPPEND, "SID", "
");
for (i=0; inum_srvid; i++) {
- tpl_printf(vars, TPLAPPEND, "SID", "%04X : %s
", sidtab->srvid[i], xml_encode(vars, get_servicename(cur_client(), sidtab->srvid[i], sidtab->caid[0])));
+ tpl_printf(vars, TPLAPPEND, "SID", "%04X : %s
", sidtab->srvid[i], xml_encode(vars, get_servicename(cur_client(), sidtab->srvid[i], sidtab->caid[0], channame)));
}
} else {
Index: /trunk/oscam-log.c
===================================================================
--- /trunk/oscam-log.c (revision 5308)
+++ /trunk/oscam-log.c (revision 5309)
@@ -380,7 +380,9 @@
cwps=0;
- char *channel ="";
+ char channame[32];
if(cfg.mon_appendchaninfo)
- channel = get_servicename(client, client->last_srvid,client->last_caid);
+ get_servicename(client, client->last_srvid,client->last_caid, channame);
+ else
+ channame[0] = '\0';
int32_t lsec;
@@ -424,5 +426,5 @@
client->last_caid,
client->last_srvid,
- channel);
+ channame);
cs_write_log(buf);
Index: /trunk/oscam-reader.c
===================================================================
--- /trunk/oscam-reader.c (revision 5308)
+++ /trunk/oscam-reader.c (revision 5309)
@@ -463,6 +463,7 @@
{
int32_t rc;
+ unsigned char md5tmp[MD5_DIGEST_LENGTH];
struct s_client *cl = cur_client();
- memcpy(cl->emmcache[cl->rotate].emmd5, MD5(emm, emm[2], cl->dump), CS_EMMSTORESIZE);
+ memcpy(cl->emmcache[cl->rotate].emmd5, MD5(emm, emm[2], md5tmp), CS_EMMSTORESIZE);
cl->emmcache[cl->rotate].type=type;
cl->emmcache[cl->rotate].count=1;
@@ -563,4 +564,5 @@
{
int32_t i, no, rc, ecs;
+ unsigned char md5tmp[MD5_DIGEST_LENGTH];
char *rtxt[] = { "error", (reader->typ & R_IS_CASCADING) ? "sent" : "written", "skipped", "blocked" };
char *typedesc[]= { "unknown", "unique", "shared", "global" };
@@ -570,9 +572,9 @@
cs_ftime(&tps);
- MD5(ep->emm, ep->emm[2], cl->dump);
+ MD5(ep->emm, ep->emm[2], md5tmp);
no=0;
for (i=ecs=0; (iemmcache[i].emmd5, cl->dump, CS_EMMSTORESIZE)) {
+ if (!memcmp(cl->emmcache[i].emmd5, md5tmp, CS_EMMSTORESIZE)) {
if (reader->cachemm)
ecs=(reader->rewritemm > cl->emmcache[i].count) ? 1 : 2;
Index: /trunk/oscam-simples.c
===================================================================
--- /trunk/oscam-simples.c (revision 5308)
+++ /trunk/oscam-simples.c (revision 5309)
@@ -779,72 +779,70 @@
}
-char *get_servicename(struct s_client *cl, int32_t srvid, int32_t caid){
+/* Gets the servicename. Make sure that buf is at least 32 bytes large. */
+char *get_servicename(struct s_client *cl, int32_t srvid, int32_t caid, char *buf){
int32_t i;
struct s_srvid *this;
- char *name = (char*)cl->dump;
- name[0] = 0;
-
- if (!srvid) {
- name[0]='\0';
- return(name);
- }
+ buf[0] = '\0';
+
+ if (!srvid)
+ return(buf);
if (cl && cl->last_srvidptr && cl->last_srvidptr->srvid==srvid)
for (i=0; i < cl->last_srvidptr->ncaid; i++)
if (cl->last_srvidptr->caid[i] == caid)
- cs_strncpy(name, cl->last_srvidptr->name, 32);
-
- for (this = cfg.srvid[srvid>>12]; this && (!name[0]); this = this->next)
+ cs_strncpy(buf, cl->last_srvidptr->name, 32);
+
+ for (this = cfg.srvid[srvid>>12]; this && (!buf[0]); this = this->next)
if (this->srvid == srvid)
for (i=0; incaid; i++)
if (this->caid[i] == caid && this->name) {
- cs_strncpy(name, this->name, 32);
+ cs_strncpy(buf, this->name, 32);
cl->last_srvidptr = this;
}
- if (!name[0]) {
- snprintf(name, sizeof(cl->dump), "%04X:%04X unknown", caid, srvid);
+ if (!buf[0]) {
+ snprintf(buf, 32, "%04X:%04X unknown", caid, srvid);
cl->last_srvidptr = NULL;
}
- return(name);
-}
-
-char *get_tiername(int32_t tierid, int32_t caid){
+ return(buf);
+}
+
+/* Gets the tier name. Make sure that buf is at least 83 bytes long. */
+char *get_tiername(int32_t tierid, int32_t caid, char *buf){
int32_t i;
struct s_tierid *this = cfg.tierid;
- static char name[83];
-
- for (name[0] = 0; this && (!name[0]); this = this->next)
+
+ for (buf[0] = 0; this && (!buf[0]); this = this->next)
if (this->tierid == tierid)
for (i=0; incaid; i++)
if (this->caid[i] == caid)
- cs_strncpy(name, this->name, 32);
+ cs_strncpy(buf, this->name, 32);
//if (!name[0]) sprintf(name, "%04X:%04X unknown", caid, tierid);
- if (!tierid) name[0] = '\0';
- return(name);
-}
-
-char *get_provider(int32_t caid, uint32_t provid){
+ if (!tierid) buf[0] = '\0';
+ return(buf);
+}
+
+/* Gets the provider name. Make sure that buf is at least 83 bytes long. */
+char *get_provider(int32_t caid, uint32_t provid, char *buf){
struct s_provid *this = cfg.provid;
- static char name[83];
-
- for (name[0] = 0; this && (!name[0]); this = this->next) {
+
+ for (buf[0] = 0; this && (!buf[0]); this = this->next) {
if (this->caid == caid && this->provid == provid) {
- snprintf(name, 83, "%s", this->prov);
+ snprintf(buf, 83, "%s", this->prov);
if (this->sat[0]) {
- strcat(name, " / ");
- strcat(name, this->sat);
+ strcat(buf, " / ");
+ strcat(buf, this->sat);
}
if (this->lang[0]) {
- strcat(name, " / ");
- strcat(name, this->lang);
+ strcat(buf, " / ");
+ strcat(buf, this->lang);
}
}
}
- if (!name[0]) snprintf(name, 83, "%04X:%06X unknown", caid, provid);
- if (!caid) name[0] = '\0';
- return(name);
+ if (!buf[0]) snprintf(buf, 83, "%04X:%06X unknown", caid, provid);
+ if (!caid) buf[0] = '\0';
+ return(buf);
}
Index: /trunk/oscam.c
===================================================================
--- /trunk/oscam.c (revision 5308)
+++ /trunk/oscam.c (revision 5309)
@@ -733,4 +733,5 @@
{
struct s_auth *account;
+ unsigned char md5tmp[MD5_DIGEST_LENGTH];
struct s_client *cl;
@@ -741,5 +742,5 @@
break;
- if (account && !account->disabled && cl->pcrc == crc32(0L, MD5((uchar *)account->pwd, strlen(account->pwd), cur_client()->dump), 16)) {
+ if (account && !account->disabled && cl->pcrc == crc32(0L, MD5((uchar *)account->pwd, strlen(account->pwd), md5tmp), MD5_DIGEST_LENGTH)) {
cl->account = account;
if(cl->typ == 'c'){
@@ -1449,4 +1450,5 @@
{
int32_t rc=0;
+ unsigned char md5tmp[MD5_DIGEST_LENGTH];
char buf[32];
char *t_crypt="encrypted";
@@ -1497,5 +1499,5 @@
client->dup=0;
if (client->typ=='c' || client->typ=='m')
- client->pcrc = crc32(0L, MD5((uchar *)account->pwd, strlen(account->pwd), client->dump), 16);
+ client->pcrc = crc32(0L, MD5((uchar *)account->pwd, strlen(account->pwd), md5tmp), MD5_DIGEST_LENGTH);
if (client->typ=='c')
{
@@ -1810,8 +1812,6 @@
*/
- char *name=get_servicename(cur_client(), er->srvid, er->caid);
- cs_strncpy(srvname, name, sizeof(srvname));
-
- srvname[sizeof(srvname)-1] = 0;
+ get_servicename(cur_client(), er->srvid, er->caid, srvname);
+
for (i = 0; srvname[i]; i++)
if (srvname[i] == ' ') srvname[i] = '_';
@@ -2016,4 +2016,5 @@
char erEx[32]="";
char uname[38]="";
+ char channame[32];
struct timeb tpe;
uint16_t lc, *lp;
@@ -2043,5 +2044,5 @@
if(cfg.mon_appendchaninfo)
- snprintf(schaninfo, sizeof(schaninfo)-1, " - %s", get_servicename(client, er->srvid, er->caid));
+ snprintf(schaninfo, sizeof(schaninfo)-1, " - %s", get_servicename(client, er->srvid, er->caid, channame));
if(er->msglog[0])
@@ -2671,7 +2672,7 @@
if ((er->caid >> 8) == 0x17)
offset = 13;
-
+ unsigned char md5tmp[MD5_DIGEST_LENGTH];
// store ECM in cache
- memcpy(er->ecmd5, MD5(er->ecm+offset, er->l-offset, client->dump), CS_ECMSTORESIZE);
+ memcpy(er->ecmd5, MD5(er->ecm+offset, er->l-offset, md5tmp), CS_ECMSTORESIZE);
// cache1
Index: /trunk/reader-nagra.c
===================================================================
--- /trunk/reader-nagra.c (revision 5308)
+++ /trunk/reader-nagra.c (revision 5309)
@@ -820,5 +820,5 @@
int32_t euro=0;
- char *tier_name = NULL;
+ char tiername[83];
time_t rawtime;
struct tm timeinfo;
@@ -832,14 +832,13 @@
{
case 0x00:
- case 0x01:
- tier_name = get_tiername(records[i].value, reader->caid);
+ case 0x01:
if( (reader->nagra_read == 2) && (reccmp(records[i].date2,currdate) >= 0) )
cs_ri_log(reader, "Tier : %04X, expiry date: %s %s",
- records[i].value, records[i].date2, tier_name);
+ records[i].value, records[i].date2, get_tiername(records[i].value, reader->caid, tiername));
else if(reader->nagra_read == 1)
{
euro = (records[i].price / 100);
cs_ri_log(reader, "Activation : ( %04X ) from %s to %s (%3d euro) %s",
- records[i].value, records[i].date1, records[i].date2, euro, tier_name);
+ records[i].value, records[i].date1, records[i].date2, euro, get_tiername(records[i].value, reader->caid, tiername));
}
break;
@@ -848,8 +847,7 @@
case 0x21:
if( (reader->nagra_read == 2) && (reccmp(records[i].date2,currdate) >= 0) )
- {
- tier_name = get_tiername(records[i].value, reader->caid);
+ {
cs_ri_log(reader, "Tier : %04X, expiry date: %s %s",
- records[i].value, records[i].date2, tier_name);
+ records[i].value, records[i].date2, get_tiername(records[i].value, reader->caid, tiername));
}
break;
@@ -884,7 +882,6 @@
euro = records[i].price / 100;
credit -= euro;
- tier_name = get_tiername(records[i].value, reader->caid);
cs_ri_log(reader, "Subscription : ( %04X ) from %s to %s (%3d euro) %s",
- records[i].value, records[i].date1, records[i].date2, euro, tier_name);
+ records[i].value, records[i].date1, records[i].date2, euro, get_tiername(records[i].value, reader->caid, tiername));
}
break;
Index: /trunk/reader-videoguard-common.c
===================================================================
--- /trunk/reader-videoguard-common.c (revision 5308)
+++ /trunk/reader-videoguard-common.c (revision 5309)
@@ -568,5 +568,5 @@
int32_t i, ecmi, ecm_header_count;
unsigned char buffer[0x80];
- unsigned char md5_digest[0x10];
+ unsigned char md5tmp[MD5_DIGEST_LENGTH];
static const uint16_t Hash3[] = {0x0123,0x4567,0x89AB,0xCDEF,0xF861,0xCB52};
static const unsigned char Hash4[] = {0x0B,0x04,0x07,0x08,0x05,0x09,0x0B,0x0A,0x07,0x02,0x0A,0x05,0x04,0x08,0x0D,0x0F};
@@ -729,6 +729,6 @@
memcpy(buffer, cw, 8);
memcpy(buffer + 8, &ecm_header_data[ecmi + 3], ecm_header_data[ecmi] - 2);
- MD5(buffer, 8 + ecm_header_data[ecmi] - 2, md5_digest);
- memcpy(cw, md5_digest, 8);
+ MD5(buffer, 8 + ecm_header_data[ecmi] - 2, md5tmp);
+ memcpy(cw, md5tmp, 8);
cs_ddump_mask(D_READER, cw, 8, "Postprocessed Case 3 DW:");
break;
Index: /trunk/reader-videoguard1.c
===================================================================
--- /trunk/reader-videoguard1.c (revision 5308)
+++ /trunk/reader-videoguard1.c (revision 5309)
@@ -72,6 +72,6 @@
rev_date_calc(&cta_res[4], &y, &m, &d, &H, &M, &S, reader->card_baseyear);
uint16_t tier_id = (cta_res[2] << 8) | cta_res[3];
- char *tier_name = get_tiername(tier_id, reader->caid);
- cs_ri_log(reader, "[videoguard1-reader] tier: %04x, expiry date: %04d/%02d/%02d-%02d:%02d:%02d %s", tier_id, y, m, d, H, M, S, tier_name);
+ char tiername[83];
+ cs_ri_log(reader, "[videoguard1-reader] tier: %04x, expiry date: %04d/%02d/%02d-%02d:%02d:%02d %s", tier_id, y, m, d, H, M, S, get_tiername(tier_id, reader->caid, tiername));
}
}
Index: /trunk/reader-videoguard12.c
===================================================================
--- /trunk/reader-videoguard12.c (revision 5308)
+++ /trunk/reader-videoguard12.c (revision 5309)
@@ -79,6 +79,6 @@
rev_date_calc(&cta_res[4], &y, &m, &d, &H, &M, &S, reader->card_baseyear);
uint16_t tier_id = (cta_res[2] << 8) | cta_res[3];
- char *tier_name = get_tiername(tier_id, reader->caid);
- cs_ri_log(reader, "tier: %04x, expiry date: %04d/%02d/%02d-%02d:%02d:%02d %s", tier_id, y, m, d, H, M, S, tier_name);
+ char tiername[83];
+ cs_ri_log(reader, "tier: %04x, expiry date: %04d/%02d/%02d-%02d:%02d:%02d %s", tier_id, y, m, d, H, M, S, get_tiername(tier_id, reader->caid, tiername));
}
}
Index: /trunk/reader-videoguard2.c
===================================================================
--- /trunk/reader-videoguard2.c (revision 5308)
+++ /trunk/reader-videoguard2.c (revision 5309)
@@ -47,5 +47,5 @@
int32_t i, ecmi, ecm_header_count;
unsigned char buffer[0x80];
- unsigned char md5_digest[0x10];
+ unsigned char md5tmp[MD5_DIGEST_LENGTH];
static const uint16_t Hash3[] = {0x0123,0x4567,0x89AB,0xCDEF,0xF861,0xCB52};
static const unsigned char Hash4[] = {0x0B,0x04,0x07,0x08,0x05,0x09,0x0B,0x0A,0x07,0x02,0x0A,0x05,0x04,0x08,0x0D,0x0F};
@@ -208,6 +208,6 @@
memcpy(buffer, cw, 8);
memcpy(buffer + 8, &ecm_header_data[ecmi + 3], ecm_header_data[ecmi] - 2);
- MD5(buffer, 8 + ecm_header_data[ecmi] - 2, md5_digest);
- memcpy(cw, md5_digest, 8);
+ MD5(buffer, 8 + ecm_header_data[ecmi] - 2, md5tmp);
+ memcpy(cw, md5tmp, 8);
cs_ddump_mask(D_READER, cw, 8, "[videoguard2-reader] Postprocessed Case 3 DW:");
break;
@@ -275,11 +275,11 @@
if(cta_res[2]!=0 || cta_res[3]!=0) {
int32_t y,m,d,H,M,S;
+ char tiername[83];
rev_date_calc(&cta_res[4],&y,&m,&d,&H,&M,&S,reader->card_baseyear);
- uint16_t tier_id = (cta_res[2] << 8) | cta_res[3];
- char *tier_name = get_tiername(tier_id, reader->caid);
+ uint16_t tier_id = (cta_res[2] << 8) | cta_res[3];
if(!stopemptytier){
cs_debug_mask(D_READER, "tier: %04x, tier-number: 0x%02x",tier_id,i);
}
- cs_ri_log(reader, "tier: %04x, expiry date: %04d/%02d/%02d-%02d:%02d:%02d %s",tier_id,y,m,d,H,M,S,tier_name);
+ cs_ri_log(reader, "tier: %04x, expiry date: %04d/%02d/%02d-%02d:%02d:%02d %s",tier_id,y,m,d,H,M,S,get_tiername(tier_id, reader->caid, tiername));
}
}
@@ -578,9 +578,10 @@
//log tiers
int32_t k;
+ char tiername[83];
for (k = posECMpart2+1; k < lenECMpart2+posECMpart2+1-4; k++){
if (er->ecm[k] == 0x03 && er->ecm[k+3] == 0x80) {
uint16_t vtier_id = (er->ecm[k+1] << 8) | er->ecm[k+2];
- char *vtier_name = get_tiername(vtier_id, reader->caid);
- cs_log("valid tier: %04x %s",vtier_id,vtier_name);
+ get_tiername(vtier_id, reader->caid, tiername);
+ cs_log("valid tier: %04x %s",vtier_id, tiername);
}
}