Changeset 8456
- Timestamp:
- 03/02/13 22:43:16 (11 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/globals.h
r8455 r8456 590 590 } FTAB; 591 591 592 struct ncd_port { 593 bool ncd_key_is_set; 594 uint8_t ncd_key[14]; 595 FTAB ncd_ftab; 596 }; 597 592 598 typedef struct s_port { 593 599 int32_t fd; 594 600 int32_t s_port; 595 int32_t ncd_key_is_set; //0 or 1 596 uint8_t ncd_key[14]; 597 FTAB ftab; 601 struct ncd_port *ncd; // newcamd specific settings 598 602 } PORT; 599 603 -
trunk/module-newcamd.c
r8455 r8456 153 153 cs_debug_mask(D_TRACE,"Send SID list to mgcamd client."); 154 154 memset(&cd, 0, sizeof(cd)); 155 FILTER *pfilts = cfg.ncd_ptab.ports[cl->port_idx]. ftab.filts;155 FILTER *pfilts = cfg.ncd_ptab.ports[cl->port_idx].ncd->ncd_ftab.filts; 156 156 157 157 /*memset(mbuf, 0, sizeof(mbuf));*/ // not nessesery … … 591 591 592 592 port_idx = cl->port_idx; 593 psfilt = &cfg.ncd_ptab.ports[port_idx]. ftab.filts[0];593 psfilt = &cfg.ncd_ptab.ports[port_idx].ncd->ncd_ftab.filts[0]; 594 594 595 595 // 1. CAID … … 809 809 // check for non ready reader and reject client 810 810 for (rdr=first_active_reader; rdr ; rdr=rdr->next) { 811 if(rdr->caid==cfg.ncd_ptab.ports[cl->port_idx]. ftab.filts[0].caid) {811 if(rdr->caid==cfg.ncd_ptab.ports[cl->port_idx].ncd->ncd_ftab.filts[0].caid) { 812 812 if(rdr->card_status == CARD_NEED_INIT) { 813 813 cs_log("init for reader %s not finished -> reject client", rdr->label); … … 822 822 while ((rdr = ll_iter_next(&itr))) { 823 823 int32_t n; 824 for (n=0;n<cfg.ncd_ptab.ports[cl->port_idx]. ftab.filts[0].nprids;n++) {825 if (emm_reader_match(rdr, cfg.ncd_ptab.ports[cl->port_idx]. ftab.filts[0].caid, cfg.ncd_ptab.ports[cl->port_idx].ftab.filts[0].prids[n])) {824 for (n=0;n<cfg.ncd_ptab.ports[cl->port_idx].ncd->ncd_ftab.filts[0].nprids;n++) { 825 if (emm_reader_match(rdr, cfg.ncd_ptab.ports[cl->port_idx].ncd->ncd_ftab.filts[0].caid, cfg.ncd_ptab.ports[cl->port_idx].ncd->ncd_ftab.filts[0].prids[n])) { 826 826 aureader=rdr; 827 827 break; … … 1053 1053 pi = cl->port_idx; 1054 1054 if( cfg.ncd_ptab.nports && cfg.ncd_ptab.nports >= pi) 1055 er->caid=cfg.ncd_ptab.ports[pi]. ftab.filts[0].caid;1055 er->caid=cfg.ncd_ptab.ports[pi].ncd->ncd_ftab.filts[0].caid; 1056 1056 } 1057 1057 memcpy(er->ecm, buf+2, er->ecmlen); … … 1191 1191 cs_log("client connected to %d port", cfg.ncd_ptab.ports[client->port_idx].s_port); 1192 1192 1193 if (cfg.ncd_ptab.ports[client->port_idx].ncd _key_is_set) {1193 if (cfg.ncd_ptab.ports[client->port_idx].ncd->ncd_key_is_set) { 1194 1194 //port has a des key specified 1195 res = newcamd_auth_client(client->ip, cfg.ncd_ptab.ports[client->port_idx].ncd _key);1195 res = newcamd_auth_client(client->ip, cfg.ncd_ptab.ports[client->port_idx].ncd->ncd_key); 1196 1196 } else { 1197 1197 //default global des key -
trunk/oscam-chk.c
r8444 r8456 379 379 return 1; 380 380 381 if (ptab->nports && ptab->ports[pi]. ftab.nfilts)382 { 383 for( rc=j=0; (!rc) && (j<ptab->ports[pi]. ftab.nfilts); j++ )381 if (ptab->nports && ptab->ports[pi].ncd && ptab->ports[pi].ncd->ncd_ftab.nfilts) 382 { 383 for( rc=j=0; (!rc) && (j<ptab->ports[pi].ncd->ncd_ftab.nfilts); j++ ) 384 384 { 385 scaid = ptab->ports[pi]. ftab.filts[j].caid;385 scaid = ptab->ports[pi].ncd->ncd_ftab.filts[j].caid; 386 386 if (caid==0||(caid!=0 && caid==scaid)) 387 387 { 388 for( i=0; (!rc) && i<ptab->ports[pi]. ftab.filts[j].nprids; i++ )388 for( i=0; (!rc) && i<ptab->ports[pi].ncd->ncd_ftab.filts[j].nprids; i++ ) 389 389 { 390 sprid=ptab->ports[pi]. ftab.filts[j].prids[i];390 sprid=ptab->ports[pi].ncd->ncd_ftab.filts[j].prids[i]; 391 391 cs_debug_mask(D_CLIENT, "trying server filter %04X:%06X", scaid, sprid); 392 392 if (prid==sprid) -
trunk/oscam-conf-chk.c
r8358 r8456 299 299 for (nfilts = i = 0, ptr1 = strtok_r(portasc, ";", &saveptr1); (i < CS_MAXPORTS) && (ptr1); ptr1 = strtok_r(NULL, ";", &saveptr1), i++) { 300 300 ptr[i] = ptr1; 301 302 if (!newptab->ports[i].ncd && !cs_malloc(&newptab->ports[i].ncd, sizeof(struct ncd_port))) 303 break; 304 301 305 if( (ptr2=strchr(trim(ptr1), '@')) ) { 302 306 *ptr2++ ='\0'; … … 304 308 305 309 //checking for des key for port 306 newptab->ports[i].ncd _key_is_set = 0; //default to 0310 newptab->ports[i].ncd->ncd_key_is_set = false; 307 311 if( (ptr3=strchr(trim(ptr1), '{')) ) { 308 312 *ptr3++='\0'; 309 if (key_atob_l(ptr3, newptab->ports[i].ncd _key, sizeof(newptab->ports[i].ncd_key) * 2))313 if (key_atob_l(ptr3, newptab->ports[i].ncd->ncd_key, sizeof(newptab->ports[i].ncd->ncd_key) * 2)) 310 314 fprintf(stderr, "newcamd: error in DES Key for port %s -> ignored\n", ptr1); 311 315 else 312 newptab->ports[i].ncd _key_is_set = 1;316 newptab->ports[i].ncd->ncd_key_is_set = true; 313 317 } 314 318 … … 332 336 if( (ptr2=strchr(trim(ptr3), ':')) ) { 333 337 *ptr2++='\0'; 334 newptab->ports[iport]. ftab.nfilts++;335 ifilt = newptab->ports[iport]. ftab.nfilts-1;336 newptab->ports[iport]. ftab.filts[ifilt].caid = (uint16_t)a2i(ptr3, 4);337 newptab->ports[iport]. ftab.filts[ifilt].prids[j] = a2i(ptr2, 6);338 newptab->ports[iport].ncd->ncd_ftab.nfilts++; 339 ifilt = newptab->ports[iport].ncd->ncd_ftab.nfilts-1; 340 newptab->ports[iport].ncd->ncd_ftab.filts[ifilt].caid = (uint16_t)a2i(ptr3, 4); 341 newptab->ports[iport].ncd->ncd_ftab.filts[ifilt].prids[j] = a2i(ptr2, 6); 338 342 } else { 339 newptab->ports[iport]. ftab.filts[ifilt].prids[j] = a2i(ptr3, 6);343 newptab->ports[iport].ncd->ncd_ftab.filts[ifilt].prids[j] = a2i(ptr3, 6); 340 344 } 341 newptab->ports[iport]. ftab.filts[ifilt].nprids++;345 newptab->ports[iport].ncd->ncd_ftab.filts[ifilt].nprids++; 342 346 } 343 347 } … … 371 375 ptab->nports = 0; 372 376 for (; i >= 0; --i) { 373 ptab->ports[i].ftab.nfilts = 0; 374 ptab->ports[i].ftab.filts[0].nprids = 0; 377 if (ptab->ports[i].ncd) { 378 ptab->ports[i].ncd->ncd_ftab.nfilts = 0; 379 ptab->ports[i].ncd->ncd_ftab.filts[0].nprids = 0; 380 free(ptab->ports[i].ncd); 381 ptab->ports[i].ncd = NULL; 382 } 375 383 } 376 384 } -
trunk/oscam-conf-mk.c
r8358 r8456 162 162 /* Port is maximally 5 chars long, plus the @caid, plus the ";" between ports */ 163 163 needed += 11; 164 if (cfg.c35_tcp_ptab.ports[i]. ftab.filts[0].nprids > 1) {165 needed += cfg.c35_tcp_ptab.ports[i]. ftab.filts[0].nprids * 7;164 if (cfg.c35_tcp_ptab.ports[i].ncd && cfg.c35_tcp_ptab.ports[i].ncd->ncd_ftab.filts[0].nprids > 1) { 165 needed += cfg.c35_tcp_ptab.ports[i].ncd->ncd_ftab.filts[0].nprids * 7; 166 166 } 167 167 } … … 172 172 for(i = 0; i < cfg.c35_tcp_ptab.nports; ++i) { 173 173 174 if (cfg.c35_tcp_ptab.ports[i]. ftab.filts[0].caid) {174 if (cfg.c35_tcp_ptab.ports[i].ncd && cfg.c35_tcp_ptab.ports[i].ncd->ncd_ftab.filts[0].caid) { 175 175 pos += snprintf(value + pos, needed-(value-saveptr), "%s%d@%04X", dot1, 176 176 cfg.c35_tcp_ptab.ports[i].s_port, 177 cfg.c35_tcp_ptab.ports[i]. ftab.filts[0].caid);178 179 if (cfg.c35_tcp_ptab.ports[i]. ftab.filts[0].nprids > 1) {177 cfg.c35_tcp_ptab.ports[i].ncd->ncd_ftab.filts[0].caid); 178 179 if (cfg.c35_tcp_ptab.ports[i].ncd->ncd_ftab.filts[0].nprids > 1) { 180 180 dot2 = ":"; 181 for (j = 0; j < cfg.c35_tcp_ptab.ports[i]. ftab.filts[0].nprids; ++j) {182 pos += snprintf(value + pos, needed-(value-saveptr), "%s%X", dot2, cfg.c35_tcp_ptab.ports[i]. ftab.filts[0].prids[j]);181 for (j = 0; j < cfg.c35_tcp_ptab.ports[i].ncd->ncd_ftab.filts[0].nprids; ++j) { 182 pos += snprintf(value + pos, needed-(value-saveptr), "%s%X", dot2, cfg.c35_tcp_ptab.ports[i].ncd->ncd_ftab.filts[0].prids[j]); 183 183 dot2 = ","; 184 184 } … … 289 289 /* Port is maximally 5 chars long, plus the @caid, plus the ";" between ports */ 290 290 needed += 11; 291 if(cfg.ncd_ptab.ports[i].ncd_key_is_set) needed += 30; 292 if (cfg.ncd_ptab.ports[i].ftab.filts[0].nprids > 0) { 293 needed += cfg.ncd_ptab.ports[i].ftab.filts[0].nprids * 7; 291 if (cfg.ncd_ptab.ports[i].ncd) { 292 if(cfg.ncd_ptab.ports[i].ncd->ncd_key_is_set) needed += 30; 293 if (cfg.ncd_ptab.ports[i].ncd->ncd_ftab.filts[0].nprids > 0) { 294 needed += cfg.ncd_ptab.ports[i].ncd->ncd_ftab.filts[0].nprids * 7; 295 } 294 296 } 295 297 } … … 302 304 303 305 // separate DES Key for this port 304 if(cfg.ncd_ptab.ports[i].ncd_key_is_set) { 305 pos += snprintf(value + pos, needed-pos, "{"); 306 for (k = 0; k < (int32_t)sizeof(cfg.ncd_ptab.ports[i].ncd_key[k]); k++) 307 pos += snprintf(value + pos, needed-pos, "%02X", cfg.ncd_ptab.ports[i].ncd_key[k]); 308 pos += snprintf(value + pos, needed-pos, "}"); 309 } 310 311 pos += snprintf(value + pos, needed-pos, "@%04X", cfg.ncd_ptab.ports[i].ftab.filts[0].caid); 312 313 if (cfg.ncd_ptab.ports[i].ftab.filts[0].nprids > 0) { 314 dot2 = ":"; 315 for (j = 0; j < cfg.ncd_ptab.ports[i].ftab.filts[0].nprids; ++j) { 316 pos += snprintf(value + pos, needed-pos, "%s%06X", dot2, (int)cfg.ncd_ptab.ports[i].ftab.filts[0].prids[j]); 317 dot2 = ","; 306 if (cfg.ncd_ptab.ports[i].ncd) { 307 if(cfg.ncd_ptab.ports[i].ncd->ncd_key_is_set) { 308 pos += snprintf(value + pos, needed-pos, "{"); 309 for (k = 0; k < (int32_t)sizeof(cfg.ncd_ptab.ports[i].ncd->ncd_key[k]); k++) 310 pos += snprintf(value + pos, needed-pos, "%02X", cfg.ncd_ptab.ports[i].ncd->ncd_key[k]); 311 pos += snprintf(value + pos, needed-pos, "}"); 312 } 313 314 pos += snprintf(value + pos, needed-pos, "@%04X", cfg.ncd_ptab.ports[i].ncd->ncd_ftab.filts[0].caid); 315 316 if (cfg.ncd_ptab.ports[i].ncd->ncd_ftab.filts[0].nprids > 0) { 317 dot2 = ":"; 318 for (j = 0; j < cfg.ncd_ptab.ports[i].ncd->ncd_ftab.filts[0].nprids; ++j) { 319 pos += snprintf(value + pos, needed-pos, "%s%06X", dot2, (int)cfg.ncd_ptab.ports[i].ncd->ncd_ftab.filts[0].prids[j]); 320 dot2 = ","; 321 } 318 322 } 319 323 } -
trunk/oscam-config-global.c
r8417 r8456 783 783 void config_free(void) { 784 784 config_sections_free(oscam_conf, &cfg); 785 clear_ptab(&cfg.ncd_ptab); 786 clear_ptab(&cfg.c35_tcp_ptab); 785 787 } 786 788 -
trunk/oscam-ecm.c
r8455 r8456 1177 1177 if (!er->prid && client->ncd_server) { 1178 1178 int32_t pi = client->port_idx; 1179 if (pi >= 0 && cfg.ncd_ptab.nports && cfg.ncd_ptab.nports >= pi )1180 er->prid = cfg.ncd_ptab.ports[pi]. ftab.filts[0].prids[0];1179 if (pi >= 0 && cfg.ncd_ptab.nports && cfg.ncd_ptab.nports >= pi && cfg.ncd_ptab.ports[pi].ncd) 1180 er->prid = cfg.ncd_ptab.ports[pi].ncd->ncd_ftab.filts[0].prids[0]; 1181 1181 } 1182 1182 -
trunk/oscam-net.c
r8455 r8456 566 566 ptxt[0], ptxt[1]); 567 567 568 for (i = 0; i < port->ftab.nfilts; i++) {568 for (i = 0; port->ncd && i < port->ncd->ncd_ftab.nfilts; i++) { 569 569 int32_t j, pos = 0; 570 char buf[30 + (8 * port-> ftab.filts[i].nprids)];571 pos += snprintf(buf, sizeof(buf), "-> CAID: %04X PROVID: ", port-> ftab.filts[i].caid );572 573 for (j = 0; j < port-> ftab.filts[i].nprids; j++)574 pos += snprintf(buf+pos, sizeof(buf)-pos, "%06X, ", port-> ftab.filts[i].prids[j]);570 char buf[30 + (8 * port->ncd->ncd_ftab.filts[i].nprids)]; 571 pos += snprintf(buf, sizeof(buf), "-> CAID: %04X PROVID: ", port->ncd->ncd_ftab.filts[i].caid ); 572 573 for (j = 0; j < port->ncd->ncd_ftab.filts[i].nprids; j++) 574 pos += snprintf(buf+pos, sizeof(buf)-pos, "%06X, ", port->ncd->ncd_ftab.filts[i].prids[j]); 575 575 576 576 if (pos > 2 && j > 0)
Note:
See TracChangeset
for help on using the changeset viewer.