Changeset 973
- Timestamp:
- 12/28/09 00:09:12 (14 years ago)
- Location:
- branches/monitor-improvement
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/monitor-improvement/globals.h
r966 r973 754 754 extern void chk_ftab(char *zFilterAsc, FTAB *ftab, const char *zType, const char *zName, const char *zFiltName); 755 755 extern void chk_cltab(char *classasc, CLASSTAB *clstab); 756 extern void chk_iprange(char *value, struct s_ip **base); 757 void chk_port_tab(char *portasc, PTAB *ptab); 758 #ifdef CS_ANTICASC 759 void chk_t_ac(char *token, char *value); 760 #endif 761 void chk_t_camd33(char *token, char *value); 762 void chk_t_camd35(char *token, char *value); 763 void chk_t_camd35_tcp(char *token, char *value); 764 void chk_t_newcamd(char *token, char *value); 765 void chk_t_radegast(char *token, char *value); 766 void chk_t_serial(char *token, char *value); 767 void chk_t_gbox(char *token, char *value); 768 void chk_t_cccam(char *token, char *value); 769 void chk_t_global(char *token, char *value); 770 void chk_t_monitor(char *token, char *value); 771 void chk_account(char *token, char *value, struct s_auth *account); 756 772 757 773 // oscam-reader -
branches/monitor-improvement/oscam-config.c
r966 r973 67 67 #endif 68 68 69 staticvoid chk_iprange(char *value, struct s_ip **base)69 void chk_iprange(char *value, struct s_ip **base) 70 70 { 71 71 //int i; … … 221 221 } 222 222 223 staticvoid chk_port_tab(char *portasc, PTAB *ptab)223 void chk_port_tab(char *portasc, PTAB *ptab) 224 224 { 225 225 int i,j,nfilts,ifilt,iport; … … 279 279 #endif 280 280 281 staticvoid chk_t_global(char *token, char *value)281 void chk_t_global(char *token, char *value) 282 282 { 283 283 if (!strcmp(token, "serverip")) { cfg->srvip=inet_addr(value); return; } … … 340 340 341 341 #ifdef CS_ANTICASC 342 staticvoid chk_t_ac(char *token, char *value)342 void chk_t_ac(char *token, char *value) 343 343 { 344 344 if (!strcmp(token, "enabled")) … … 399 399 #endif 400 400 401 staticvoid chk_t_monitor(char *token, char *value)401 void chk_t_monitor(char *token, char *value) 402 402 { 403 403 if (!strcmp(token, "port")) { cfg->mon_port=atoi(value); return; } … … 416 416 } 417 417 418 staticvoid chk_t_camd33(char *token, char *value)418 void chk_t_camd33(char *token, char *value) 419 419 { 420 420 if (!strcmp(token, "port")) { cfg->c33_port=atoi(value); return; } … … 436 436 } 437 437 438 staticvoid chk_t_camd35(char *token, char *value)438 void chk_t_camd35(char *token, char *value) 439 439 { 440 440 if (!strcmp(token, "port")) { cfg->c35_port=atoi(value); return; } … … 444 444 } 445 445 446 staticvoid chk_t_camd35_tcp(char *token, char *value)446 void chk_t_camd35_tcp(char *token, char *value) 447 447 { 448 448 if (!strcmp(token, "port")) { chk_port_tab(value, &cfg->c35_tcp_ptab); return; } … … 452 452 } 453 453 454 staticvoid chk_t_newcamd(char *token, char *value)454 void chk_t_newcamd(char *token, char *value) 455 455 { 456 456 if (!strcmp(token, "port")) { chk_port_tab(value, &cfg->ncd_ptab); return; } … … 469 469 } 470 470 471 staticvoid chk_t_radegast(char *token, char *value)471 void chk_t_radegast(char *token, char *value) 472 472 { 473 473 if (!strcmp(token, "port")) { cfg->rad_port=atoi(value); return; } … … 479 479 } 480 480 481 staticvoid chk_t_serial(char *token, char *value)481 void chk_t_serial(char *token, char *value) 482 482 { 483 483 if (!strcmp(token, "device")) … … 493 493 } 494 494 495 staticvoid chk_t_gbox(char *token, char *value)495 void chk_t_gbox(char *token, char *value) 496 496 { 497 497 // if (!strcmp(token, "password")) strncpy(cfg->gbox_pwd, i2b(4, a2i(value, 4)), 4); … … 517 517 } 518 518 519 staticvoid chk_t_cccam(char *token, char *value)519 void chk_t_cccam(char *token, char *value) 520 520 { 521 521 // placeholder for ccam server support … … 697 697 } 698 698 699 staticvoid chk_account(char *token, char *value, struct s_auth *account)699 void chk_account(char *token, char *value, struct s_auth *account) 700 700 { 701 701 int i; -
branches/monitor-improvement/oscam-http.c
r967 r973 164 164 165 165 void refresh_oscam(enum refreshtypes refreshtype){ 166 166 int i; 167 167 switch (refreshtype){ 168 168 case REFR_ACCOUNTS: 169 cs_reinit_clients(); 170 cs_log("Refresh Accounts"); 169 cs_log("Refresh Accounts requested by WebIF"); 170 //init_userdb(); 171 cs_reinit_clients(); 172 #ifdef CS_ANTICASC 173 for (i=0; i<CS_MAXPID; i++) 174 if (client[i].typ=='a') { 175 kill(client[i].pid, SIGHUP); 176 break; 177 } 178 #endif 171 179 break; 172 180 … … 177 185 178 186 case REFR_SERVER: 179 cs_log("Refresh Server"); 187 cs_log("Refresh Server requested by WebIF"); 188 //kill(client[0].pid, SIGHUP); 180 189 //todo how I can refresh the server after global settings 181 190 break; 191 182 192 #ifdef CS_ANTICASC 183 193 case REFR_ANTICASC: 184 cs_log("Refresh Anticascading"); 185 //todo how I can refresh the server after Anticascading settings 194 cs_log("Refresh Anticascading requested by WebIF"); 195 for (i=0; i<CS_MAXPID; i++) 196 if (client[i].typ=='a') { 197 kill(client[i].pid, SIGHUP); 198 break; 199 } 186 200 break; 187 201 #endif … … 289 303 if (paramcount>0){ 290 304 for(i=0;i<paramcount;i++){ 291 fprintf(f,"Parameter: %s ->>> Value: %s<BR>\r\n",uriparams[i],urivalues[i]); 305 306 if ((strcmp(uriparams[i], "part")) && (strcmp(uriparams[i], "action"))){ 307 fprintf(f,"Parameter: %s set to Value: %s<BR>\r\n", uriparams[i], urivalues[i]); 308 chk_t_global(uriparams[i], urivalues[i]); 309 } 292 310 } 293 311 } … … 317 335 318 336 //ServerIP 319 fprintf(f,"\t<TR><TD>Serverip:</TD><TD><input name=\"s rvip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", inet_ntoa(*(struct in_addr *)&cfg->srvip));337 fprintf(f,"\t<TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", inet_ntoa(*(struct in_addr *)&cfg->srvip)); 320 338 //Logfile 321 339 fprintf(f,"\t<TR><TD>Logfile:</TD><TD><input name=\"logfile\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", logfile); … … 372 390 if (paramcount>0){ 373 391 for(i=0;i<paramcount;i++){ 374 fprintf(f,"Parameter: %s ->>> Value: %s<BR>\r\n",uriparams[i],urivalues[i]); 392 393 if ((strcmp(uriparams[i], "part")) && (strcmp(uriparams[i], "action"))){ 394 fprintf(f,"Parameter: %s set to Value: %s<BR>\r\n", uriparams[i], urivalues[i]); 395 chk_t_camd33(uriparams[i], urivalues[i]); 396 } 375 397 } 376 398 } 377 399 //Disclaimer 378 fprintf(f,"<BR><BR> Configuration camd33 not yet implemented<BR><BR>");400 fprintf(f,"<BR><BR><B>Configuration camd33 *DONE*</B><BR><BR>"); 379 401 refresh_oscam(REFR_SERVER); 380 402 } … … 401 423 402 424 //Port 403 fprintf(f,"\t<TR><TD>Port:</TD><TD><input name=\" c33_port\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->c33_port);425 fprintf(f,"\t<TR><TD>Port:</TD><TD><input name=\"port\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->c33_port); 404 426 //ServerIP 405 fprintf(f,"\t<TR><TD>Serverip:</TD><TD><input name=\" c33_srvip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", inet_ntoa(*(struct in_addr *)&cfg->c33_srvip));427 fprintf(f,"\t<TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", inet_ntoa(*(struct in_addr *)&cfg->c33_srvip)); 406 428 //Key 407 429 int keysize =sizeof(cfg->c33_key); 408 fprintf(f,"\t<TR><TD>Key:</TD><TD><input name=\" c33_key\" type=\"text\" size=\"35\" maxlength=\"28\" value=\"");430 fprintf(f,"\t<TR><TD>Key:</TD><TD><input name=\"key\" type=\"text\" size=\"35\" maxlength=\"28\" value=\""); 409 431 for (i=0;i<keysize;i++) 410 432 fprintf(f,"%02X",cfg->c33_key[i]); … … 438 460 if (paramcount>0){ 439 461 for(i=0;i<paramcount;i++){ 440 fprintf(f,"Parameter: %s ->>> Value: %s<BR>\r\n",uriparams[i],urivalues[i]); 462 463 if ((strcmp(uriparams[i], "part")) && (strcmp(uriparams[i], "action"))){ 464 fprintf(f,"Parameter: %s set to Value: %s<BR>\r\n", uriparams[i], urivalues[i]); 465 chk_t_camd35(uriparams[i], urivalues[i]); 466 } 441 467 } 442 468 } … … 466 492 467 493 //Port 468 fprintf(f,"\t<TR><TD>Port:</TD><TD><input name=\" c35_port\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->c33_port);494 fprintf(f,"\t<TR><TD>Port:</TD><TD><input name=\"port\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->c33_port); 469 495 //ServerIP 470 fprintf(f,"\t<TR><TD>Serverip:</TD><TD><input name=\" c35_tcp_srvip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", inet_ntoa(*(struct in_addr *)&cfg->c35_tcp_srvip));496 fprintf(f,"\t<TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", inet_ntoa(*(struct in_addr *)&cfg->c35_tcp_srvip)); 471 497 472 498 //Tablefoot and finish form … … 484 510 if (paramcount>0){ 485 511 for(i=0;i<paramcount;i++){ 486 fprintf(f,"Parameter: %s ->>> Value: %s<BR>\r\n",uriparams[i],urivalues[i]); 512 513 if ((strcmp(uriparams[i], "part")) && (strcmp(uriparams[i], "action"))){ 514 fprintf(f,"Parameter: %s set to Value: %s<BR>\r\n", uriparams[i], urivalues[i]); 515 chk_t_newcamd(uriparams[i], urivalues[i]); 516 } 487 517 } 488 518 } 489 519 490 520 //Disclaimer 491 fprintf(f,"<BR><BR> Configuration newcamd Do not yet implemented<BR><BR>");521 fprintf(f,"<BR><BR><B>Configuration newcamd *DONE*</B><BR><BR>"); 492 522 refresh_oscam(REFR_SERVER); 493 523 } … … 499 529 for(i=0;i<paramcount;i++){ 500 530 if (!strcmp(uriparams[i], "action") && (!strcmp(urivalues[i], "execute"))) { 501 send_oscam_config_ camd35_do(f, uriparams, urivalues, paramcount);531 send_oscam_config_newcamd_do(f, uriparams, urivalues, paramcount); 502 532 return; 503 533 } … … 513 543 514 544 //Port 515 fprintf(f,"\t<TR><TD>Port:</TD><TD><input name=\" ncd_ptab\" type=\"text\" size=\"80\" maxlength=\"200\" value=\"");545 fprintf(f,"\t<TR><TD>Port:</TD><TD><input name=\"port\" type=\"text\" size=\"80\" maxlength=\"200\" value=\""); 516 546 int j; 517 547 char *dot1, *dot2; … … 536 566 537 567 //ServerIP 538 fprintf(f,"\t<TR><TD>Serverip:</TD><TD><input name=\" ncd_srvip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", inet_ntoa(*(struct in_addr *)&cfg->ncd_srvip));568 fprintf(f,"\t<TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", inet_ntoa(*(struct in_addr *)&cfg->ncd_srvip)); 539 569 //Key 540 fprintf(f,"\t<TR><TD>Key:</TD><TD><input name=\" ncd_key\" type=\"text\" size=\"35\" maxlength=\"28\" value=\"");570 fprintf(f,"\t<TR><TD>Key:</TD><TD><input name=\"key\" type=\"text\" size=\"35\" maxlength=\"28\" value=\""); 541 571 542 572 for (i=0;i<14;i++) … … 547 577 fprintf(f,"</TABLE>\r\n"); 548 578 fprintf(f,"<input type=\"submit\" value=\"OK\"></form>\r\n"); 579 } 580 581 void send_oscam_config_radegast_do(FILE *f, char *uriparams[], char *urivalues[], int paramcount) { 582 fprintf(f,"<BR><BR>"); 583 int i; 584 585 if (paramcount>0){ 586 for(i=0;i<paramcount;i++){ 587 588 if ((strcmp(uriparams[i], "part")) && (strcmp(uriparams[i], "action"))){ 589 fprintf(f,"Parameter: %s set to Value: %s<BR>\r\n", uriparams[i], urivalues[i]); 590 chk_t_radegast(uriparams[i], urivalues[i]); 591 } 592 } 593 } 549 594 550 595 //Disclaimer 551 fprintf(f,"<BR><BR>Configuration newcamd not yet implemented<BR><BR>"); 552 } 553 554 void send_oscam_config_radegast_do(FILE *f, char *uriparams[], char *urivalues[], int paramcount) { 555 fprintf(f,"<BR><BR>"); 556 int i; 557 558 if (paramcount>0){ 559 for(i=0;i<paramcount;i++){ 560 fprintf(f,"Parameter: %s ->>> Value: %s<BR>\r\n",uriparams[i],urivalues[i]); 561 } 562 } 563 564 //Disclaimer 565 fprintf(f,"<BR><BR>Configuration Radegast Do not yet implemented<BR><BR>"); 596 fprintf(f,"<BR><BR><B>Configuration Radegast *DONE*</B><BR><BR>"); 566 597 refresh_oscam(REFR_SERVER); 567 598 } … … 588 619 589 620 //Port 590 fprintf(f,"\t<TR><TD>Port:</TD><TD><input name=\" rad_port\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->rad_port);621 fprintf(f,"\t<TR><TD>Port:</TD><TD><input name=\"port\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->rad_port); 591 622 //ServerIP 592 fprintf(f,"\t<TR><TD>Serverip:</TD><TD><input name=\" rad_srvip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", inet_ntoa(*(struct in_addr *)&cfg->rad_srvip));623 fprintf(f,"\t<TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", inet_ntoa(*(struct in_addr *)&cfg->rad_srvip)); 593 624 //Allowed 594 fprintf(f,"\t<TR><TD>Allowed:</TD><TD><input name=\" rad_allowed\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"");625 fprintf(f,"\t<TR><TD>Allowed:</TD><TD><input name=\"allowed\" type=\"text\" size=\"50\" maxlength=\"50\" value=\""); 595 626 struct s_ip *cip; 596 627 char *dot=""; … … 602 633 } 603 634 fprintf(f,"\">wrong, see Ticket #265</TD></TR>\r\n"); 635 //Port 636 fprintf(f,"\t<TR><TD>User:</TD><TD><input name=\"user\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", cfg->rad_usr); 604 637 605 638 //Tablefoot and finish form 606 639 fprintf(f,"</TABLE>\r\n"); 607 640 fprintf(f,"<input type=\"submit\" value=\"OK\"></form>\r\n"); 608 609 //Disclaimer610 fprintf(f,"<BR><BR>Configuration Radegast not yet implemented<BR><BR>");611 641 } 612 642 … … 617 647 if (paramcount>0){ 618 648 for(i=0;i<paramcount;i++){ 619 fprintf(f,"Parameter: %s ->>> Value: %s<BR>\r\n",uriparams[i],urivalues[i]); 649 650 if ((strcmp(uriparams[i], "part")) && (strcmp(uriparams[i], "action"))){ 651 fprintf(f,"Parameter: %s set to Value: %s<BR>\r\n", uriparams[i], urivalues[i]); 652 chk_t_cccam(uriparams[i], urivalues[i]); 653 } 620 654 } 621 655 } … … 661 695 if (paramcount>0){ 662 696 for(i=0;i<paramcount;i++){ 663 fprintf(f,"Parameter: %s ->>> Value: %s<BR>\r\n",uriparams[i],urivalues[i]); 697 698 if ((strcmp(uriparams[i], "part")) && (strcmp(uriparams[i], "action"))){ 699 fprintf(f,"Parameter: %s set to Value: %s<BR>\r\n", uriparams[i], urivalues[i]); 700 chk_t_gbox(uriparams[i], urivalues[i]); 701 } 664 702 } 665 703 } 666 704 667 705 //Disclaimer 668 fprintf(f,"<BR><BR> Configuration Gbox Do not yet implemented<BR><BR>");706 fprintf(f,"<BR><BR><B>Configuration Gbox *DONE*</B><BR><BR>"); 669 707 refresh_oscam(REFR_SERVER); 670 708 } … … 676 714 for(i=0;i<paramcount;i++){ 677 715 if (!strcmp(uriparams[i], "action") && (!strcmp(urivalues[i], "execute"))) { 678 send_oscam_config_ cccam_do(f, uriparams, urivalues, paramcount);716 send_oscam_config_gbox_do(f, uriparams, urivalues, paramcount); 679 717 return; 680 718 } … … 715 753 fprintf(f,"</TABLE>\r\n"); 716 754 fprintf(f,"<input type=\"submit\" value=\"OK\"></form>\r\n"); 755 } 756 757 void send_oscam_config_monitor_do(FILE *f, char *uriparams[], char *urivalues[], int paramcount) { 758 fprintf(f,"<BR><BR>"); 759 int i; 760 761 if (paramcount>0){ 762 for(i=0;i<paramcount;i++){ 763 764 if ((strcmp(uriparams[i], "part")) && (strcmp(uriparams[i], "action"))){ 765 fprintf(f,"Parameter: %s set to Value: %s<BR>\r\n", uriparams[i], urivalues[i]); 766 chk_t_monitor(uriparams[i], urivalues[i]); 767 } 768 } 769 } 717 770 718 771 //Disclaimer 719 fprintf(f,"<BR><BR>Configuration Gbox not yet implemented<BR><BR>"); 720 } 721 722 void send_oscam_config_monitor_do(FILE *f, char *uriparams[], char *urivalues[], int paramcount) { 723 fprintf(f,"<BR><BR>"); 724 int i; 725 726 if (paramcount>0){ 727 for(i=0;i<paramcount;i++){ 728 fprintf(f,"Parameter: %s ->>> Value: %s<BR>\r\n",uriparams[i],urivalues[i]); 729 } 730 } 731 732 //Disclaimer 733 fprintf(f,"<BR><BR>Configuration Monitor Do not yet implemented<BR><BR>"); 772 fprintf(f,"<BR><BR><B>Configuration Monitor *DONE*</B><BR><BR>"); 734 773 refresh_oscam(REFR_SERVER); 735 774 } … … 798 837 fprintf(f,"<input type=\"submit\" value=\"OK\"></form>\r\n"); 799 838 839 } 840 841 #ifdef CS_ANTICASC 842 843 void send_oscam_config_anticasc_do(FILE *f, char *uriparams[], char *urivalues[], int paramcount) { 844 fprintf(f,"<BR><BR>"); 845 int i; 846 847 if (paramcount>0){ 848 849 //set to 0 because an empty checkbox gives no parameter 850 cfg->ac_enabled = 0; 851 852 for(i=0;i<paramcount;i++){ 853 854 if ((strcmp(uriparams[i], "part")) && (strcmp(uriparams[i], "action"))){ 855 fprintf(f,"Parameter: %s set to Value: %s<BR>\r\n", uriparams[i], urivalues[i]); 856 chk_t_ac(uriparams[i], urivalues[i]); 857 } 858 } 859 } 860 800 861 //Disclaimer 801 fprintf(f,"<BR><BR>Configuration Monitor not yet implemented<BR><BR>"); 802 } 803 804 #ifdef CS_ANTICASC 805 806 void send_oscam_config_anticasc_do(FILE *f, char *uriparams[], char *urivalues[], int paramcount) { 807 fprintf(f,"<BR><BR>"); 808 int i; 809 810 if (paramcount>0){ 811 for(i=0;i<paramcount;i++){ 812 fprintf(f,"Parameter: %s ->>> Value: %s<BR>\r\n",uriparams[i],urivalues[i]); 813 } 814 } 815 816 //Disclaimer 817 fprintf(f,"<BR><BR>Configuration Anticascading Do not yet implemented<BR><BR>"); 862 fprintf(f,"<BR><BR><B>Configuration Anticascading *DONE*</B><BR><BR>"); 818 863 refresh_oscam(REFR_ANTICASC); 819 864 } … … 839 884 fprintf(f,"\t<TH> </TH><TH>Edit Anticascading Config </TH>"); 840 885 841 886 //Port 887 char *checked=""; 888 if (cfg->ac_enabled > 0) checked="checked"; 889 fprintf(f,"\t<TR><TD>Enabled:</TD><TD><input name=\"enabled\" type=\"checkbox\" value=\"1\" %s>\r\n", checked); 890 //numusers 891 fprintf(f,"\t<TR><TD>Numusers:</TD><TD><input name=\"numusers\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->ac_users); 892 //sampletime 893 fprintf(f,"\t<TR><TD>Sampletime:</TD><TD><input name=\"sampletime\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->ac_stime); 894 //samples 895 fprintf(f,"\t<TR><TD>Samples:</TD><TD><input name=\"samples\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->ac_samples); 896 //penalty 897 fprintf(f,"\t<TR><TD>Penalty:</TD><TD><input name=\"penalty\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->ac_penalty); 898 //aclogfile 899 fprintf(f,"\t<TR><TD>AClogfile:</TD><TD><input name=\"aclogfile\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"%s\"></TD></TR>\r\n", cfg->ac_logfile); 900 //fakedelay 901 fprintf(f,"\t<TR><TD>Fakedelay:</TD><TD><input name=\"fakedelay\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->ac_fakedelay); 902 //denysamples 903 fprintf(f,"\t<TR><TD>Denysamples:</TD><TD><input name=\"denysamples\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"%d\"></TD></TR>\r\n", cfg->ac_denysamples); 842 904 843 905 //Tablefoot and finish form 844 906 fprintf(f,"</TABLE>\r\n"); 845 907 fprintf(f,"<input type=\"submit\" value=\"OK\"></form>\r\n"); 846 847 //Disclaimer848 fprintf(f,"<BR><BR>Configuration Anticascading not yet implemented<BR><BR>");849 908 } 850 909 … … 1067 1126 1068 1127 struct s_auth *account; 1069 int i,j; 1070 int updateservices=0; 1071 int paramidx = -1; 1072 char *ptr; 1128 int i; 1073 1129 char servicelabels[255]=""; 1074 int tabidx; 1075 1076 char *params[]={"pwd", 1077 "grp", 1078 "dyndns", 1079 "uniq", 1080 "tosleep", 1081 "monlevel", 1082 "au", 1083 "caid", 1084 "betatunnel", 1085 "services" 1086 #ifdef CS_ANTICASC 1087 ,"numusers" 1088 ,"penalty" 1089 #endif 1090 }; 1091 1092 /* Calculate the amount of items in array */ 1093 int paramcnt = sizeof(params)/sizeof(char *); 1094 1130 1131 //find username within params 1095 1132 for(i=0;i<paramcount;i++) 1096 1133 if (!strcmp(uriparams[i], "user")) break; 1097 1134 1098 / *identfy useraccount*/1135 //identfy useraccount 1099 1136 for (account=cfg->account; (account) ; account=account->next){ 1100 1137 if(!strcmp(urivalues[i], account->usr)) … … 1102 1139 } 1103 1140 1104 for(j=0; j<paramcount; j++){ 1105 1106 /* Map page to our static page definitions */ 1107 for (i=0; i<paramcnt; i++) 1108 if (!strcmp(uriparams[j], params[i])) paramidx = i; 1109 1110 switch(paramidx){ 1111 case 0: strncpy((char *)account->pwd, urivalues[j], sizeof(account->pwd)-1); 1112 break; 1113 case 1: account->grp = 0; 1114 if (urivalues[j]){ 1115 for (ptr=strtok(urivalues[j], ","); ptr; ptr=strtok(NULL, ",")) { 1116 int g; 1117 g = atoi(ptr); 1118 if ((g>0) && (g<33)) account->grp|=(1<<(g-1)); 1119 } 1120 } 1121 break; 1122 case 2: strncpy((char *)account->dyndns, urivalues[j], sizeof(account->dyndns)-1); 1123 break; 1124 case 3: if (strlen(urivalues[j])>0) 1125 account->uniq = atoi(urivalues[j]); 1126 break; 1127 case 4: if (strlen(urivalues[j])>0) 1128 account->tosleep = atoi(urivalues[j]); 1129 else 1130 account->tosleep = 0; 1131 break; 1132 case 5: if (strlen(urivalues[j])>0) 1133 if (atoi(urivalues[j])>4) 1134 account->monlvl = 4; 1135 else 1136 account->monlvl = atoi(urivalues[j]); 1137 else 1138 account->monlvl = 0; 1139 1140 break; 1141 case 6: if (strlen(urivalues[j])>0) 1142 account->au = atoi(urivalues[j]); 1143 break; 1144 case 7: for (tabidx=0;tabidx<CS_MAXCAIDTAB;tabidx++) 1145 account->ctab.caid[tabidx]=0; 1146 chk_caidtab(urivalues[j], &account->ctab); 1147 break; 1148 case 8: for (tabidx=0;tabidx<CS_MAXTUNTAB;tabidx++) 1149 account->ttab.bt_caidfrom[tabidx]=0; 1150 chk_tuntab(urivalues[j], &account->ttab); 1151 break; 1152 case 9: sprintf(servicelabels + strlen(servicelabels), "%s,", urivalues[j]); 1153 updateservices = 1; 1154 break; 1155 #ifdef CS_ANTICASC 1156 case 10:account->ac_users = atoi(urivalues[j]); 1157 break; 1158 case 11:account->ac_penalty = atoi(urivalues[j]); 1159 break; 1160 #endif 1161 default: break; 1162 1163 // case 5: chk_services(argarray[2], &account->sidtabok, &account->sidtabno); 1164 // break; //services 1165 // 1166 // case 7: chk_ftab(argarray[2], &account->ftab, "user", account->usr, "provid"); 1167 // break; //ident 1168 // 1169 // case 9: chk_ftab(argarray[2], &account->fchid, "user", account->usr, "chid"); 1170 // break; //chid 1171 // case 10:chk_cltab(argarray[2], &account->cltab); 1172 // break; //class 1173 // 1174 // default: continue; 1175 } 1176 } 1177 if (updateservices==1) 1178 chk_services(servicelabels, &account->sidtabok, &account->sidtabno); 1141 for(i=0;i<paramcount;i++){ 1142 if ((strcmp(uriparams[i], "action")) && (strcmp(uriparams[i], "user"))){ 1143 fprintf(f,"Parameter: %s set to Value: %s<BR>\r\n", uriparams[i], urivalues[i]); 1144 if (!strcmp(uriparams[i], "services")) 1145 sprintf(servicelabels + strlen(servicelabels), "%s,", urivalues[i]); 1146 else 1147 chk_account(uriparams[i], urivalues[i], account); 1148 } 1149 } 1150 1151 chk_account("services", servicelabels, account); 1179 1152 1180 1153 refresh_oscam(REFR_ACCOUNTS); … … 1234 1207 fprintf(f,"<TR><TD>Password:</TD><TD><input name=\"pwd\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", account->pwd); 1235 1208 //Group 1236 fprintf(f,"<TR><TD>Group:</TD><TD><input name=\"gr p\" type=\"text\" size=\"10\" maxlength=\"10\" value=\"");1209 fprintf(f,"<TR><TD>Group:</TD><TD><input name=\"group\" type=\"text\" size=\"10\" maxlength=\"10\" value=\""); 1237 1210 /*restore the settings format of group from long over bitarray*/ 1238 1211 char *dot = ""; //flag for comma … … 1248 1221 //Hostname 1249 1222 if (strlen((char *)account->dyndns)>0) 1250 fprintf(f,"<TR><TD>Hostname:</TD><TD><input name=\"dyndns\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", account->dyndns); 1251 else 1252 fprintf(f,"<TR><TD>Hostname:</TD><TD><input name=\"dyndns\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"\"></TD></TR>\r\n"); 1223 fprintf(f,"<TR><TD>Hostname:</TD><TD><input name=\"hostname\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"%s\"></TD></TR>\r\n", account->dyndns); 1253 1224 //Uniq 1254 1225 fprintf(f,"<TR><TD>Uniq:</TD><TD><select name=\"uniq\" >\r\n"); … … 1262 1233 //Sleep 1263 1234 if(!account->tosleep) 1264 fprintf(f,"<TR><TD>Sleep:</TD><TD><input name=\" tosleep\" type=\"text\" size=\"4\" maxlength=\"4\" value=\"0\"></TD></TR>\r\n");1235 fprintf(f,"<TR><TD>Sleep:</TD><TD><input name=\"sleep\" type=\"text\" size=\"4\" maxlength=\"4\" value=\"0\"></TD></TR>\r\n"); 1265 1236 else 1266 fprintf(f,"<TR><TD>Sleep:</TD><TD><input name=\" tosleep\" type=\"text\" size=\"4\" maxlength=\"4\" value=\"%d\"></TD></TR>\r\n", account->tosleep);1237 fprintf(f,"<TR><TD>Sleep:</TD><TD><input name=\"sleep\" type=\"text\" size=\"4\" maxlength=\"4\" value=\"%d\"></TD></TR>\r\n", account->tosleep); 1267 1238 //Monlevel selector 1268 1239 fprintf(f,"<TR><TD>Monlevel:</TD><TD><select name=\"monlevel\" >\r\n");
Note:
See TracChangeset
for help on using the changeset viewer.