Changeset 118
- Timestamp:
- 07/16/09 18:45:25 (15 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Distribution/doc/oscam-conf.txt
r95 r118 50 50 werden, da hier die daten auf das wesentliche 51 51 reduziert sind. (siehe auch UsrFile Satzbeschreibung) 52 CWLogDir = in which directory to save the correct CW (no save if not 53 defined) 52 54 Sleep = system-globaler standard-wert fuer alle acounts. 53 55 (siehe oscam.user) -
trunk/Distribution/oscam.conf
r21 r118 8 8 Level = 15 9 9 CacheDelay = 120 10 11 #cwlogdir = cwl 10 12 11 13 [newcamd] -
trunk/globals.h
r116 r118 483 483 char pidfile[128]; 484 484 char usrfile[128]; 485 char cwlogdir[128]; 485 486 struct s_auth *account; 486 487 struct s_srvid *srvid; -
trunk/oscam-config.c
r95 r118 286 286 if (!strcmp(token, "pidfile")) strncpy(cfg->pidfile, value, sizeof(cfg->pidfile)-1); 287 287 if (!strcmp(token, "usrfile")) strncpy(cfg->usrfile, value, sizeof(cfg->usrfile)-1); 288 if (!strcmp(token, "cwlogdir")) strncpy(cfg->cwlogdir, value, sizeof(cfg->cwlogdir)-1); 288 289 if (!strcmp(token, "clienttimeout")) 289 290 { -
trunk/oscam.c
r114 r118 1314 1314 } 1315 1315 1316 void logCWtoFile(ECM_REQUEST *er) 1317 { 1318 /* This function writes the current CW from ECM struct to a cwl file. 1319 The filename is re-calculated and file re-opened every time. 1320 This will consume a bit cpu time, but nothing has to be stored between 1321 each call. If not file exists, a header is prepended */ 1322 1323 FILE *pfCWL; 1324 unsigned char srvname[23]; 1325 /* %s / %s _I %04X _ %s .cwl */ 1326 unsigned char buf[sizeof(cfg->cwlogdir)+1+6+2+4+1+sizeof(srvname)+5]; 1327 unsigned char date[7]; 1328 unsigned char i, parity, writeheader = 0; 1329 time_t t; 1330 struct tm *timeinfo; 1331 struct s_srvid *this; 1332 1333 if (cfg->cwlogdir[0]) /* CWL logging only if cwlogdir is set in config */ 1334 { 1335 /* search service name for that id and change characters 1336 causing problems in file name */ 1337 srvname[0] = 0; 1338 for (this=cfg->srvid; this; this=this->next) { 1339 if (this->srvid==er->srvid) { 1340 strncpy(srvname, this->name, sizeof(srvname)); 1341 srvname[sizeof(srvname)-1] = 0; 1342 for (i=0;srvname[i];i++) 1343 if (srvname[i]==' ') srvname[i]='_'; 1344 break; 1345 } 1346 } 1347 1348 /* calc log file name */ 1349 time(&t); 1350 timeinfo = localtime(&t); 1351 strftime(date,sizeof(date),"%y%m%d",timeinfo); 1352 sprintf(buf, "%s/%s_I%04X_%s.cwl", cfg->cwlogdir, date, er->srvid, srvname); 1353 1354 if((pfCWL=fopen(buf,"r")) == NULL) 1355 { 1356 /* open failed, assuming file does not exist, yet */ 1357 writeheader = 1; 1358 } 1359 if ((pfCWL=fopen(buf, "a+")) == NULL) 1360 { 1361 /* maybe this fails because the subdir does not exist. Is there a common function to create it? */ 1362 /* for the moment do not print to log on every ecm 1363 cs_log(""error opening cw logfile for writing: %s (errno %d)", buf, errno); */ 1364 return; 1365 } 1366 if (writeheader) 1367 { 1368 /* no global macro for cardserver name :( */ 1369 fprintf(pfCWL, "# OSCam cardserver v%s - http://streamboard.gmc.to:8001/oscam/wiki\n", CS_VERSION_X); 1370 fprintf(pfCWL, "# control word log file for use with tsdec offline decrypter\n"); 1371 strftime(buf,sizeof(buf),"DATE %Y-%m-%d, TIME %H:%M:%S, TZ %Z\n",timeinfo); 1372 fprintf(pfCWL, "# %s",buf); 1373 fprintf(pfCWL, "# CAID 0x%04X, SID 0x%04X, SERVICE \"%s\"\n", er->caid, er->srvid, srvname); 1374 } 1375 1376 parity = er->ecm[0]&1; 1377 fprintf(pfCWL, "%d ",parity); 1378 for (i=parity*8; i<8+parity*8; i++) 1379 fprintf(pfCWL, "%02X ",er->cw[i]); 1380 /* better use incoming time er->tps rather than current time? */ 1381 strftime(buf,sizeof(buf),"%H:%M:%S\n",timeinfo); 1382 fprintf(pfCWL, "# %s",buf); 1383 fflush(pfCWL); 1384 fclose(pfCWL); 1385 } /* if (cfg->pidfile[0]) */ 1386 } 1387 1316 1388 int write_ecm_answer(int fd, ECM_REQUEST *er) 1317 1389 { … … 1335 1407 if (er->rc==1||(er->gbxRidx&&er->rc==0)){ 1336 1408 store_ecm(er); 1409 logCWtoFile(er); 1337 1410 } 1338 1411
Note:
See TracChangeset
for help on using the changeset viewer.