Changeset 2911
Legend:
- Unmodified
- Added
- Removed
-
trunk/globals.h
r2905 r2911 426 426 time_t lastecm; 427 427 time_t expirationdate; 428 int allowedtimeframe[2]; 428 429 int c35_suppresscmd08; 429 430 int c35_sleepsend; … … 706 707 uchar dyndns[64]; 707 708 time_t expirationdate; 709 int allowedtimeframe[2]; 708 710 int c35_suppresscmd08; 709 711 int c35_sleepsend; -
trunk/oscam-config.c
r2906 r2911 1622 1622 return; 1623 1623 } 1624 1625 if (!strcmp(token, "allowedtimeframe")) { 1626 if(strlen(value) == 0) { 1627 account->allowedtimeframe[0] = 0; 1628 account->allowedtimeframe[1] = 0; 1629 } else { 1630 int allowed[4]; 1631 if (sscanf(value, "%d:%d-%d:%d", &allowed[0], &allowed[1], &allowed[2], &allowed[3]) != 4) { 1632 account->allowedtimeframe[0] = 0; 1633 account->allowedtimeframe[1] = 0; 1634 fprintf(stderr, "Warning: value '%s' is not valid for allowedtimeframe (hh:mm-hh:mm)\n", value); 1635 } else { 1636 if(account->allowedtimeframe[0] > account->allowedtimeframe[2]) { 1637 account->allowedtimeframe[0] = 0; 1638 account->allowedtimeframe[1] = 0; 1639 fprintf(stderr, "Warning: value '%s' is not valid for allowedtimeframe (starttime > endtime)\n", value); 1640 } else { 1641 account->allowedtimeframe[0] = (allowed[0]*60) + allowed[1]; 1642 account->allowedtimeframe[1] = (allowed[2]*60) + allowed[3]; 1643 printf("tm ok %d to %d \n",account->allowedtimeframe[0],account->allowedtimeframe[1] ); 1644 } 1645 } 1646 } 1647 return; 1648 } 1649 1624 1650 1625 1651 #ifdef CS_ANTICASC -
trunk/oscam.c
r2898 r2911 382 382 client[i].autoau = account->autoau; 383 383 client[i].expirationdate = account->expirationdate; 384 client[i].allowedtimeframe[0] = account->allowedtimeframe[0]; 385 client[i].allowedtimeframe[1] = account->allowedtimeframe[1]; 384 386 client[i].ncd_keepalive = account->ncd_keepalive; 385 387 client[i].c35_suppresscmd08 = account->c35_suppresscmd08; … … 2294 2296 if(client[cs_idx].expirationdate && client[cs_idx].expirationdate < client[cs_idx].lastecm) 2295 2297 er->rc = 11; 2298 2299 // out of timeframe 2300 if(client[cs_idx].allowedtimeframe[0] && client[cs_idx].allowedtimeframe[1]) { 2301 struct tm *acttm; 2302 acttm = localtime(&now); 2303 int curtime = (acttm->tm_hour * 60) + acttm->tm_min; 2304 int mintime = client[cs_idx].allowedtimeframe[0]; 2305 int maxtime = client[cs_idx].allowedtimeframe[1]; 2306 if(!((mintime <= maxtime && curtime > mintime && curtime < maxtime) || (mintime > maxtime && (curtime > mintime || curtime < maxtime)))) 2307 er->rc = 11; 2308 } 2296 2309 2297 2310 // user disabled
Note:
See TracChangeset
for help on using the changeset viewer.