Changeset 11473 for trunk/oscam-config-account.c
- Timestamp:
- 01/18/19 20:17:57 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/oscam-config-account.c
r11356 r11473 27 27 } 28 28 29 30 31 32 29 static void account_c35_suppresscmd08_fn(const char *token, char *value, void *setting, FILE *f) 33 30 { … … 54 51 } 55 52 */ 56 57 53 58 54 static void account_ncd_keepalive_fn(const char *token, char *value, void *setting, FILE *f) … … 84 80 for(i = 0, ptr = strtok_r(value, ",", &saveptr1); ptr; ptr = strtok_r(NULL, ",", &saveptr1), i++) 85 81 { 86 if(streq(ptr, "camd33")) { account->allowedprotocols |= LIS_CAMD33TCP; }82 if(streq(ptr, "camd33")) { account->allowedprotocols |= LIS_CAMD33TCP; } 87 83 else if(streq(ptr, "camd35")) { account->allowedprotocols |= LIS_CAMD35UDP; } 88 84 else if(streq(ptr, "cs357x")) { account->allowedprotocols |= LIS_CAMD35UDP; } … … 209 205 int32_t allowed[4]; 210 206 uint32_t tempo = 0; 211 207 212 208 char *ptr1, *ptr2, *ptr3, *saveptr1 = NULL, *saveptr2 = NULL; 213 209 214 210 if(value) 215 211 { 216 212 //First empty allowedtimeframe array very important otherwise new config won't be properly set 217 for(i=0;i<SIZE_SHORTDAY;i++) { 218 for(j=0;j<24;j++) { 219 account->allowedtimeframe[i][j][0]=0; 220 account->allowedtimeframe[i][j][1]=0; 213 for(i = 0; i < SIZE_SHORTDAY; i++) 214 { 215 for(j = 0; j < 24; j++) 216 { 217 account->allowedtimeframe[i][j][0] = 0; 218 account->allowedtimeframe[i][j][1] = 0; 221 219 } 222 220 } 223 221 account->allowedtimeframe_set=0; 224 222 strtoupper(value); 225 223 226 224 for(i = 0, ptr1 = strtok_r(value, ";", &saveptr1); (ptr1); ptr1 = strtok_r(NULL, ";", &saveptr1), i++) 227 225 { 228 226 if((ptr2 = strchr(trim(ptr1), '@'))) 229 227 { 230 *ptr2++ = '\0'; //clean up @ symbol231 // ptr1 is the day228 *ptr2++ = '\0'; // clean up @ symbol 229 // ptr1 is the day 232 230 dest = strstr(weekdstr,ptr1); 233 day_idx = (dest - weekdstr) /3;234 231 day_idx = (dest - weekdstr) / 3; 232 235 233 for(j = 0, ptr3 = strtok_r(ptr2, ",", &saveptr2); (ptr3); ptr3 = strtok_r(NULL, ",", &saveptr2), j++) 236 234 { 237 if((sscanf(ptr3, "%2d:%2d-%2d:%2d", &allowed[0], &allowed[1], &allowed[2], &allowed[3]) == 4) && (day_idx <SIZE_SHORTDAY))235 if((sscanf(ptr3, "%2d:%2d-%2d:%2d", &allowed[0], &allowed[1], &allowed[2], &allowed[3]) == 4) && (day_idx < SIZE_SHORTDAY)) 238 236 { 239 237 startt = allowed[0] * 60 + allowed[1]; 240 238 endt = allowed[2] * 60 + allowed[3]; 241 if(startt == endt) { endt++; } //end time cannot be the same as the star time 242 if((startt <0) || (startt > 1439)) { startt = 0; } //could not start later than 23H59, avoid overflow 243 if((endt <0) || (endt > 1440)) { endt = 1440; } //could not be higher than 24H00, avoid overflow 244 account->allowedtimeframe_set=1; 245 if(startt > endt) { 246 for(t=startt; t<1440 ;t++) 247 { 239 240 if(startt == endt) { endt++; } // end time cannot be the same as the star time 241 if((startt < 0) || (startt > 1439)) { startt = 0; } // could not start later than 23H59, avoid overflow 242 if((endt < 0) || (endt > 1440)) { endt = 1440; } // could not be higher than 24H00, avoid overflow 243 244 account->allowedtimeframe_set = 1; 245 246 if(startt > endt) 247 { 248 for(t = startt; t < 1440; t++) 249 { 248 250 tempo = (1 << (t % 30)); 249 account->allowedtimeframe[day_idx][t /60][(t/30)%2]=account->allowedtimeframe[day_idx][t/60][(t/30)%2]|tempo;251 account->allowedtimeframe[day_idx][t / 60][(t / 30) % 2] = account->allowedtimeframe[day_idx][t / 60][(t / 30) % 2] | tempo; 250 252 } 251 startt=0; 252 } 253 for(t=startt; t<endt ;t++) 254 { 253 startt = 0; 254 } 255 256 for(t = startt; t < endt; t++) 257 { 255 258 tempo = (1 << (t % 30)); 256 account->allowedtimeframe[day_idx][t /60][((t/30)%2)]=account->allowedtimeframe[day_idx][t/60][(t/30)%2]|tempo;259 account->allowedtimeframe[day_idx][t / 60][((t / 30) % 2)] = account->allowedtimeframe[day_idx][t / 60][(t / 30) % 2] | tempo; 257 260 } 258 261 } … … 263 266 } 264 267 } 265 else // No day specified so whole week (ALL)268 else // No day specified so whole week (ALL) 266 269 { 267 270 if(sscanf(ptr1, "%2d:%2d-%2d:%2d", &allowed[0], &allowed[1], &allowed[2], &allowed[3]) == 4) … … 269 272 startt = allowed[0] * 60 + allowed[1]; 270 273 endt = allowed[2] * 60 + allowed[3]; 271 if(startt == endt) { endt++; } //end time cannot be the same as the star time 272 if((startt <0) || (startt > 1439)) { startt = 0; } //could not start later than 23H59, avoid overflow 273 if((endt <0) || (endt > 1440)) { endt = 1440; } //could not be higher than 24H00, avoid overflow 274 account->allowedtimeframe_set=1; 274 275 if(startt == endt) { endt++; } // end time cannot be the same as the star time 276 if((startt <0) || (startt > 1439)) { startt = 0; } // could not start later than 23H59, avoid overflow 277 if((endt <0) || (endt > 1440)) { endt = 1440; } // could not be higher than 24H00, avoid overflow 278 279 account->allowedtimeframe_set = 1; 275 280 dest = strstr(weekdstr,"ALL"); 276 day_idx = (dest - weekdstr)/3; 277 if(startt > endt) 278 { 279 for(t=startt; t<1440 ;t++) 281 day_idx = (dest - weekdstr) / 3; 282 283 if(startt > endt) 284 { 285 for(t = startt; t < 1440; t++) 280 286 { 281 287 tempo = (1 << (t % 30)); 282 account->allowedtimeframe[day_idx][t/60][(t/30)%2]=account->allowedtimeframe[7][t/60][(t/30)%2]|tempo; 283 } 284 startt=0; 285 } 286 for(t=startt; t<endt ;t++) 287 { 288 account->allowedtimeframe[day_idx][t / 60][(t / 30) % 2] = account->allowedtimeframe[7][t / 60][(t / 30) % 2] | tempo; 289 } 290 startt=0; 291 } 292 293 for(t = startt; t < endt; t++) 294 { 288 295 tempo = (1 << (t % 30)); 289 account->allowedtimeframe[day_idx][t /60][(t/30)%2]=account->allowedtimeframe[7][t/60][(t/30)%2]|tempo;296 account->allowedtimeframe[day_idx][t / 60][(t / 30) % 2] = account->allowedtimeframe[7][t / 60][(t / 30) % 2] | tempo; 290 297 } 291 298 } … … 294 301 fprintf(stderr, "WARNING: Value '%s' is not valid for allowedtimeframe (hh:mm-hh:mm)\n", value); 295 302 } 296 303 297 304 } 298 305 } … … 412 419 DEF_OPT_FIXUP_FUNC(account_fixups_fn), 413 420 #endif 414 DEF_OPT_INT8("disabled" , OFS(disabled), 0),415 DEF_OPT_SSTR("user" , OFS(usr), "", SIZEOF(usr)),416 DEF_OPT_STR("pwd" , OFS(pwd), NULL),421 DEF_OPT_INT8("disabled" , OFS(disabled), 0), 422 DEF_OPT_SSTR("user" , OFS(usr), "", SIZEOF(usr)), 423 DEF_OPT_STR("pwd" , OFS(pwd), NULL), 417 424 #ifdef WEBIF 418 DEF_OPT_STR("description" , OFS(description), NULL),419 #endif 420 DEF_OPT_STR("hostname" , OFS(dyndns), NULL),421 DEF_OPT_FUNC("caid" , OFS(ctab), check_caidtab_fn),422 DEF_OPT_INT8("uniq" , OFS(uniq), 0),423 DEF_OPT_UINT8("sleepsend" , OFS(c35_sleepsend), 0),424 DEF_OPT_INT32("failban" , OFS(failban), 0),425 DEF_OPT_INT8("monlevel" , OFS(monlvl), 0),426 DEF_OPT_FUNC("sleep" , OFS(tosleep), account_tosleep_fn),427 DEF_OPT_FUNC("suppresscmd08" , OFS(c35_suppresscmd08), account_c35_suppresscmd08_fn),428 DEF_OPT_INT32("umaxidle" , OFS(umaxidle), -1),429 DEF_OPT_FUNC("keepalive" , OFS(ncd_keepalive), account_ncd_keepalive_fn),430 DEF_OPT_FUNC("au" , 0, account_au_fn),431 DEF_OPT_UINT8("emmreassembly" , OFS(emm_reassembly), 2),432 DEF_OPT_FUNC("expdate" , 0, account_expdate_fn),433 DEF_OPT_FUNC("allowedprotocols" , 0, account_allowedprotocols_fn),434 DEF_OPT_FUNC("allowedtimeframe" , 0,account_allowedtimeframe_fn),435 DEF_OPT_FUNC("betatunnel" , OFS(ttab), account_tuntab_fn),436 DEF_OPT_FUNC("group" , OFS(grp), group_fn),437 DEF_OPT_FUNC("services" , OFS(sidtabs), services_fn),438 DEF_OPT_INT8("preferlocalcards" , OFS(preferlocalcards), -1),439 DEF_OPT_FUNC_X("ident" , OFS(ftab), ftab_fn, FTAB_ACCOUNT | FTAB_PROVID),440 DEF_OPT_FUNC_X("chid" , OFS(fchid), ftab_fn, FTAB_ACCOUNT | FTAB_CHID),441 DEF_OPT_FUNC("class" , OFS(cltab), class_fn),442 DEF_OPT_UINT32("max_connections" , OFS(max_connections), 1),425 DEF_OPT_STR("description" , OFS(description), NULL), 426 #endif 427 DEF_OPT_STR("hostname" , OFS(dyndns), NULL), 428 DEF_OPT_FUNC("caid" , OFS(ctab), check_caidtab_fn), 429 DEF_OPT_INT8("uniq" , OFS(uniq), 0), 430 DEF_OPT_UINT8("sleepsend" , OFS(c35_sleepsend), 0), 431 DEF_OPT_INT32("failban" , OFS(failban), 0), 432 DEF_OPT_INT8("monlevel" , OFS(monlvl), 0), 433 DEF_OPT_FUNC("sleep" , OFS(tosleep), account_tosleep_fn), 434 DEF_OPT_FUNC("suppresscmd08" , OFS(c35_suppresscmd08), account_c35_suppresscmd08_fn), 435 DEF_OPT_INT32("umaxidle" , OFS(umaxidle), -1), 436 DEF_OPT_FUNC("keepalive" , OFS(ncd_keepalive), account_ncd_keepalive_fn), 437 DEF_OPT_FUNC("au" , 0, account_au_fn), 438 DEF_OPT_UINT8("emmreassembly" , OFS(emm_reassembly), 2), 439 DEF_OPT_FUNC("expdate" , 0, account_expdate_fn), 440 DEF_OPT_FUNC("allowedprotocols" , 0, account_allowedprotocols_fn), 441 DEF_OPT_FUNC("allowedtimeframe" , 0, account_allowedtimeframe_fn), 442 DEF_OPT_FUNC("betatunnel" , OFS(ttab), account_tuntab_fn), 443 DEF_OPT_FUNC("group" , OFS(grp), group_fn), 444 DEF_OPT_FUNC("services" , OFS(sidtabs), services_fn), 445 DEF_OPT_INT8("preferlocalcards" , OFS(preferlocalcards), -1), 446 DEF_OPT_FUNC_X("ident" , OFS(ftab), ftab_fn, FTAB_ACCOUNT | FTAB_PROVID), 447 DEF_OPT_FUNC_X("chid" , OFS(fchid), ftab_fn, FTAB_ACCOUNT | FTAB_CHID), 448 DEF_OPT_FUNC("class" , OFS(cltab), class_fn), 449 DEF_OPT_UINT32("max_connections" , OFS(max_connections), 1), 443 450 #ifdef CS_CACHEEX 444 DEF_OPT_INT8("cacheex" , OFS(cacheex.mode), 0),445 DEF_OPT_INT8("cacheex_maxhop" , OFS(cacheex.maxhop), 0),446 DEF_OPT_FUNC("cacheex_ecm_filter" , OFS(cacheex.filter_caidtab), cacheex_hitvaluetab_fn),447 DEF_OPT_UINT8("cacheex_drop_csp" , OFS(cacheex.drop_csp), 0),448 DEF_OPT_UINT8("cacheex_allow_request" , OFS(cacheex.allow_request), 0),449 DEF_OPT_UINT8("no_wait_time" , OFS(no_wait_time), 0),450 DEF_OPT_UINT8("cacheex_allow_filter" , OFS(cacheex.allow_filter), 1),451 DEF_OPT_UINT8("cacheex_block_fakecws" ,OFS(cacheex.block_fakecws), 0),452 DEF_OPT_UINT8("disablecrccacheex" ,OFS(disablecrccacheex), 0),451 DEF_OPT_INT8("cacheex" , OFS(cacheex.mode), 0), 452 DEF_OPT_INT8("cacheex_maxhop" , OFS(cacheex.maxhop), 0), 453 DEF_OPT_FUNC("cacheex_ecm_filter" , OFS(cacheex.filter_caidtab), cacheex_hitvaluetab_fn), 454 DEF_OPT_UINT8("cacheex_drop_csp" , OFS(cacheex.drop_csp), 0), 455 DEF_OPT_UINT8("cacheex_allow_request" , OFS(cacheex.allow_request), 0), 456 DEF_OPT_UINT8("no_wait_time" , OFS(no_wait_time), 0), 457 DEF_OPT_UINT8("cacheex_allow_filter" , OFS(cacheex.allow_filter), 1), 458 DEF_OPT_UINT8("cacheex_block_fakecws" , OFS(cacheex.block_fakecws), 0), 459 DEF_OPT_UINT8("disablecrccacheex" , OFS(disablecrccacheex), 0), 453 460 DEF_OPT_FUNC_X("disablecrccacheex_only_for", OFS(disablecrccacheex_only_for), ftab_fn, FTAB_ACCOUNT | FTAB_IGNCRCCEX4USERONLYFOR), 454 461 #endif 455 462 #ifdef MODULE_CCCAM 456 DEF_OPT_INT32("cccmaxhops" , OFS(cccmaxhops), DEFAULT_CC_MAXHOPS),457 DEF_OPT_INT8("cccreshare" , OFS(cccreshare), DEFAULT_CC_RESHARE),458 DEF_OPT_INT8("cccignorereshare" , OFS(cccignorereshare), DEFAULT_CC_IGNRSHR),459 DEF_OPT_INT8("cccstealth" , OFS(cccstealth), DEFAULT_CC_STEALTH),463 DEF_OPT_INT32("cccmaxhops" , OFS(cccmaxhops), DEFAULT_CC_MAXHOPS), 464 DEF_OPT_INT8("cccreshare" , OFS(cccreshare), DEFAULT_CC_RESHARE), 465 DEF_OPT_INT8("cccignorereshare" , OFS(cccignorereshare), DEFAULT_CC_IGNRSHR), 466 DEF_OPT_INT8("cccstealth" , OFS(cccstealth), DEFAULT_CC_STEALTH), 460 467 #endif 461 468 #ifdef CS_ANTICASC 462 DEF_OPT_INT32("fakedelay" , OFS(ac_fakedelay), -1),463 DEF_OPT_INT32("numusers" , OFS(ac_users), DEFAULT_AC_USERS),464 DEF_OPT_INT8("penalty" , OFS(ac_penalty), DEFAULT_AC_PENALTY),465 DEF_OPT_INT8("acosc_max_active_sids" , OFS(acosc_max_active_sids),-1 ),466 DEF_OPT_INT8("acosc_zap_limit" , OFS(acosc_zap_limit),-1 ),467 DEF_OPT_INT8("acosc_penalty" , OFS(acosc_penalty),-1 ),468 DEF_OPT_INT32("acosc_penalty_duration" , OFS(acosc_penalty_duration),-1 ),469 DEF_OPT_INT32("acosc_delay" , OFS(acosc_delay),-1 ),469 DEF_OPT_INT32("fakedelay" , OFS(ac_fakedelay), -1), 470 DEF_OPT_INT32("numusers" , OFS(ac_users), DEFAULT_AC_USERS), 471 DEF_OPT_INT8("penalty" , OFS(ac_penalty), DEFAULT_AC_PENALTY), 472 DEF_OPT_INT8("acosc_max_active_sids" , OFS(acosc_max_active_sids), -1 ), 473 DEF_OPT_INT8("acosc_zap_limit" , OFS(acosc_zap_limit), -1 ), 474 DEF_OPT_INT8("acosc_penalty" , OFS(acosc_penalty), -1 ), 475 DEF_OPT_INT32("acosc_penalty_duration" , OFS(acosc_penalty_duration), -1 ), 476 DEF_OPT_INT32("acosc_delay" , OFS(acosc_delay), -1 ), 470 477 #endif 471 478 #ifdef WITH_LB 472 DEF_OPT_INT32("lb_nbest_readers" , OFS(lb_nbest_readers), -1),473 DEF_OPT_INT32("lb_nfb_readers" , OFS(lb_nfb_readers), -1),474 DEF_OPT_FUNC("lb_nbest_percaid" , OFS(lb_nbest_readers_tab), caidvaluetab_fn),479 DEF_OPT_INT32("lb_nbest_readers" , OFS(lb_nbest_readers), -1), 480 DEF_OPT_INT32("lb_nfb_readers" , OFS(lb_nfb_readers), -1), 481 DEF_OPT_FUNC("lb_nbest_percaid" , OFS(lb_nbest_readers_tab), caidvaluetab_fn), 475 482 #endif 476 483 #ifdef CW_CYCLE_CHECK 477 DEF_OPT_INT8("cwc_disable" , OFS(cwc_disable),0),484 DEF_OPT_INT8("cwc_disable" , OFS(cwc_disable), 0), 478 485 #endif 479 486 DEF_LAST_OPT … … 582 589 tuntab_clear(&ptr->ttab); 583 590 caidtab_clear(&ptr->ctab); 584 585 591 NULLFREE(ptr->cltab.aclass); 592 NULLFREE(ptr->cltab.bclass); 586 593 #ifdef CS_CACHEEX 587 594 cecspvaluetab_clear(&ptr->cacheex.filter_caidtab);
Note:
See TracChangeset
for help on using the changeset viewer.