Changeset 1679 for branches/monitor-improvement/oscam-config.c
- Timestamp:
- 02/24/10 23:14:55 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/monitor-improvement/oscam-config.c
r1677 r1679 148 148 char *ptr1, *ptr2, *ptr3; 149 149 150 // ToDo: remove after using clear_tuntab() in Webif151 for (i = 0; i < CS_MAXTUNTAB; i++) {152 ttab->bt_caidfrom[i] = 0;153 ttab->bt_caidto[i] = 0;154 ttab->bt_srvid[i] = 0;155 }156 157 150 for (i = 0, ptr1 = strtok(tunasc, ","); (i < CS_MAXTUNTAB) && (ptr1); ptr1 = strtok(NULL, ",")) { 158 151 ulong bt_caidfrom, bt_caidto, bt_srvid; … … 515 508 void chk_t_ac(char *token, char *value) 516 509 { 517 if (!strcmp(token, "enabled")) 518 { 519 cfg->ac_enabled=atoi(value); 520 if( cfg->ac_enabled<=0 ) cfg->ac_enabled=0; 521 else cfg->ac_enabled=1; 522 return; 523 } 524 525 if (!strcmp(token, "numusers")) 526 { 527 cfg->ac_users=atoi(value); 528 if( cfg->ac_users<0 ) cfg->ac_users=0; 529 return; 530 } 531 if (!strcmp(token, "sampletime")) 532 { 533 cfg->ac_stime=atoi(value); 534 if( cfg->ac_stime<0 ) cfg->ac_stime=2; 535 return; 536 } 537 if (!strcmp(token, "samples")) 538 { 539 cfg->ac_samples=atoi(value); 540 if( cfg->ac_samples<2 || cfg->ac_samples>10) cfg->ac_samples=10; 541 return; 542 } 543 if (!strcmp(token, "penalty")) 544 { 545 cfg->ac_penalty=atoi(value); 546 if( cfg->ac_penalty<0 ) cfg->ac_penalty=0; 547 return; 548 } 549 if (!strcmp(token, "aclogfile")) 550 { 551 cs_strncpy(cfg->ac_logfile, value, sizeof(cfg->ac_logfile)); 552 return; 553 } 554 if( !strcmp(token, "fakedelay") ) 555 { 556 cfg->ac_fakedelay=atoi(value); 557 if( cfg->ac_fakedelay<100 || cfg->ac_fakedelay>1000 ) 558 cfg->ac_fakedelay=1000; 559 return; 560 } 561 if( !strcmp(token, "denysamples") ) 562 { 563 cfg->ac_denysamples=atoi(value); 564 if( cfg->ac_denysamples<2 || cfg->ac_denysamples>cfg->ac_samples-1 ) 565 cfg->ac_denysamples=cfg->ac_samples-1; 566 return; 567 } 568 if (token[0] != '#') 569 fprintf(stderr, "Warning: keyword '%s' in anticascading section not recognized\n",token); 570 //#endif moved this endif up two lines, I think this was erroneous - dingo35 510 if (!strcmp(token, "enabled")) { 511 cfg->ac_enabled = atoi(value); 512 if( cfg->ac_enabled <= 0 ) 513 cfg->ac_enabled = 0; 514 else 515 cfg->ac_enabled = 1; 516 return; 517 } 518 519 if (!strcmp(token, "numusers")) { 520 cfg->ac_users = atoi(value); 521 if( cfg->ac_users < 0 ) 522 cfg->ac_users = 0; 523 return; 524 } 525 526 if (!strcmp(token, "sampletime")) { 527 cfg->ac_stime = atoi(value); 528 if( cfg->ac_stime < 0 ) 529 cfg->ac_stime = 2; 530 return; 531 } 532 533 if (!strcmp(token, "samples")) { 534 cfg->ac_samples = atoi(value); 535 if( cfg->ac_samples < 2 || cfg->ac_samples > 10) 536 cfg->ac_samples = 10; 537 return; 538 } 539 540 if (!strcmp(token, "penalty")) { 541 cfg->ac_penalty = atoi(value); 542 if( cfg->ac_penalty < 0 ) 543 cfg->ac_penalty = 0; 544 return; 545 } 546 547 if (!strcmp(token, "aclogfile")) { 548 cs_strncpy(cfg->ac_logfile, value, sizeof(cfg->ac_logfile)); 549 return; 550 } 551 552 if( !strcmp(token, "fakedelay") ) { 553 cfg->ac_fakedelay = atoi(value); 554 if( cfg->ac_fakedelay < 100 || cfg->ac_fakedelay > 1000 ) 555 cfg->ac_fakedelay = 1000; 556 return; 557 } 558 559 if( !strcmp(token, "denysamples") ) { 560 cfg->ac_denysamples = atoi(value); 561 if( cfg->ac_denysamples < 2 || cfg->ac_denysamples > cfg->ac_samples - 1 ) 562 cfg->ac_denysamples=cfg->ac_samples-1; 563 return; 564 } 565 566 if (token[0] != '#') 567 cs_log( "Warning: keyword '%s' in anticascading section not recognized",token); 571 568 } 572 569 #endif … … 574 571 void chk_t_monitor(char *token, char *value) 575 572 { 576 if (!strcmp(token, "port")) { cfg->mon_port=atoi(value); return; } 577 if (!strcmp(token, "serverip")) { cfg->mon_srvip=inet_addr(value); return; } 578 if (!strcmp(token, "nocrypt")) { chk_iprange(value, &cfg->mon_allowed); return; } 579 if (!strcmp(token, "aulow")) { cfg->mon_aulow=atoi(value); return; } 580 if (!strcmp(token, "monlevel")) { cfg->mon_level=atoi(value); return; } 581 if (!strcmp(token, "httpport")) { cfg->http_port=atoi(value); return; } 582 if (!strcmp(token, "httpuser")) { cs_strncpy(cfg->http_user, value, sizeof(cfg->http_user)); return; } 583 if (!strcmp(token, "httppwd")) { cs_strncpy(cfg->http_pwd, value, sizeof(cfg->http_pwd)); return; } 584 if (!strcmp(token, "httpcss")) { cs_strncpy(cfg->http_css, value, sizeof(cfg->http_css)); return; } 585 if (!strcmp(token, "httpscript")) { cs_strncpy(cfg->http_script, value, sizeof(cfg->http_script)); return; } 586 if (!strcmp(token, "httptpl")) { 587 cs_strncpy(cfg->http_tpl, value, sizeof(cfg->http_tpl)); 588 if(strlen(cfg->http_tpl) < (sizeof(cfg->http_tpl)-2) && cfg->http_tpl[strlen(cfg->http_tpl)-1] != '/'){ 589 cfg->http_tpl[strlen(cfg->http_tpl)] = '/'; 590 cfg->http_tpl[strlen(cfg->http_tpl)] = '\0'; 591 } 592 return; 593 } 594 if (!strcmp(token, "httprefresh")) { cfg->http_refresh=atoi(value); return; } 595 if (!strcmp(token, "httphideidleclients")) { cfg->http_hide_idle_clients=atoi(value); return; } 596 if (!strcmp(token, "hideclient_to")) { cfg->mon_hideclient_to=atoi(value); return; } 597 if (token[0] != '#') 598 cs_log("Warning: keyword '%s' in monitor section not recognized",token); 573 if (!strcmp(token, "port")) { 574 if(strlen(value) == 0) { 575 cfg->mon_port = 0; 576 return; 577 } else { 578 cfg->mon_port=atoi(value); 579 return; 580 } 581 } 582 583 if (!strcmp(token, "serverip")) { 584 if(strlen(value) == 0) { 585 cfg->mon_srvip = 0; 586 return; 587 } else { 588 cfg->mon_srvip=inet_addr(value); 589 return; 590 } 591 } 592 593 if (!strcmp(token, "nocrypt")) { 594 if(strlen(value) == 0) { 595 clear_sip(&cfg->mon_allowed); 596 return; 597 } else { 598 chk_iprange(value, &cfg->mon_allowed); 599 return; 600 } 601 } 602 603 if (!strcmp(token, "aulow")) { 604 if(strlen(value) == 0) { 605 cfg->mon_aulow = 0; 606 return; 607 } else { 608 cfg->mon_aulow = atoi(value); 609 return; 610 } 611 } 612 613 if (!strcmp(token, "monlevel")) { 614 if(strlen(value) == 0) { 615 cfg->mon_level = 0; 616 return; 617 } else { 618 cfg->mon_level = atoi(value); 619 return; 620 } 621 } 622 623 if (!strcmp(token, "httpport")) { 624 if(strlen(value) == 0) { 625 cfg->http_port = 0; 626 return; 627 } else { 628 cfg->http_port = atoi(value); 629 return; 630 } 631 } 632 633 if (!strcmp(token, "httpuser")) { 634 cs_strncpy(cfg->http_user, value, sizeof(cfg->http_user)); 635 return; 636 } 637 638 if (!strcmp(token, "httppwd")) { 639 cs_strncpy(cfg->http_pwd, value, sizeof(cfg->http_pwd)); 640 return; 641 } 642 643 if (!strcmp(token, "httpcss")) { 644 cs_strncpy(cfg->http_css, value, sizeof(cfg->http_css)); 645 return; 646 } 647 648 if (!strcmp(token, "httpscript")) { 649 cs_strncpy(cfg->http_script, value, sizeof(cfg->http_script)); 650 return; 651 } 652 653 if (!strcmp(token, "httptpl")) { 654 cs_strncpy(cfg->http_tpl, value, sizeof(cfg->http_tpl)); 655 if(strlen(cfg->http_tpl) < (sizeof(cfg->http_tpl)-2) && cfg->http_tpl[strlen(cfg->http_tpl)-1] != '/') { 656 cfg->http_tpl[strlen(cfg->http_tpl)] = '/'; 657 cfg->http_tpl[strlen(cfg->http_tpl)] = '\0'; 658 } 659 return; 660 } 661 662 if (!strcmp(token, "httprefresh")) { 663 if(strlen(value) == 0) { 664 cfg->http_refresh = 0; 665 return; 666 } else { 667 cfg->http_refresh = atoi(value); 668 return; 669 } 670 } 671 672 if (!strcmp(token, "httphideidleclients")) { 673 if(strlen(value) == 0) { 674 cfg->http_hide_idle_clients = 0; 675 return; 676 } else { 677 cfg->http_hide_idle_clients=atoi(value); 678 return; 679 } 680 } 681 682 if (!strcmp(token, "hideclient_to")) { 683 if(strlen(value) == 0) { 684 cfg->mon_hideclient_to = 0; 685 return; 686 } else { 687 cfg->mon_hideclient_to = atoi(value); 688 return; 689 } 690 } 691 692 if (token[0] != '#') 693 cs_log("Warning: keyword '%s' in monitor section not recognized",token); 599 694 } 600 695 601 696 void chk_t_camd33(char *token, char *value) 602 697 { 603 if (!strcmp(token, "port")) { cfg->c33_port=atoi(value); return; } 604 if (!strcmp(token, "serverip")) { cfg->c33_srvip=inet_addr(value); return; } 605 if (!strcmp(token, "nocrypt")) { chk_iprange(value, &cfg->c33_plain); return; } 606 if (!strcmp(token, "passive")) { cfg->c33_passive=(value[0]!='0'); return; } 607 if (!strcmp(token, "key")) 608 { 609 if (key_atob(value, cfg->c33_key)) 610 { 611 fprintf(stderr, "Configuration camd3.3x: Error in Key\n"); 612 exit(1); 613 } 614 cfg->c33_crypted=1; 615 return; 616 } 617 if (token[0] != '#') 618 fprintf(stderr, "Warning: keyword '%s' in camd33 section not recognized\n",token); 698 if (!strcmp(token, "port")) { 699 if(strlen(value) == 0) { 700 cfg->c33_port = 0; 701 return; 702 } else { 703 cfg->c33_port = atoi(value); 704 return; 705 } 706 } 707 708 if (!strcmp(token, "serverip")) { 709 if(strlen(value) == 0) { 710 cfg->c33_srvip = 0; 711 return; 712 } else { 713 cfg->c33_srvip = inet_addr(value); 714 return; 715 } 716 } 717 718 if (!strcmp(token, "nocrypt")) { 719 if(strlen(value) == 0) { 720 return; 721 } else { 722 chk_iprange(value, &cfg->c33_plain); 723 return; 724 } 725 } 726 727 if (!strcmp(token, "passive")) { 728 cfg->c33_passive = (value[0]!='0'); 729 return; 730 } 731 732 if (!strcmp(token, "key")) { 733 if (key_atob(value, cfg->c33_key)) { 734 fprintf(stderr, "Configuration camd3.3x: Error in Key\n"); 735 exit(1); 736 } 737 cfg->c33_crypted=1; 738 return; 739 } 740 741 if (token[0] != '#') 742 cs_log( "Warning: keyword '%s' in camd33 section not recognized",token); 619 743 } 620 744 621 745 void chk_t_camd35(char *token, char *value) 622 746 { 623 if (!strcmp(token, "port")) { cfg->c35_port=atoi(value); return; } 624 if (!strcmp(token, "serverip")) { cfg->c35_tcp_srvip=inet_addr(value); return; } 625 if (!strcmp(token, "suppresscmd08")) { cfg->c35_suppresscmd08=atoi(value); return; } 626 if (token[0] != '#') 627 fprintf(stderr, "Warning: keyword '%s' in camd35 section not recognized\n",token); 747 if (!strcmp(token, "port")) { 748 if(strlen(value) == 0) { 749 cfg->c35_port = 0; 750 return; 751 } else { 752 cfg->c35_port = atoi(value); 753 return; 754 } 755 } 756 757 if (!strcmp(token, "serverip")) { 758 if(strlen(value) == 0) { 759 cfg->c35_tcp_srvip = 0; 760 return; 761 } else { 762 cfg->c35_tcp_srvip = inet_addr(value); 763 return; 764 } 765 } 766 767 if (!strcmp(token, "suppresscmd08")) { 768 if(strlen(value) == 0) { 769 cfg->c35_suppresscmd08 = 0; 770 return; 771 } else { 772 cfg->c35_suppresscmd08=atoi(value); 773 return; 774 } 775 } 776 777 if (token[0] != '#') 778 cs_log( "Warning: keyword '%s' in camd35 section not recognized", token); 628 779 } 629 780 630 781 void chk_t_camd35_tcp(char *token, char *value) 631 782 { 632 if (!strcmp(token, "port")) { chk_port_tab(value, &cfg->c35_tcp_ptab); return; } 633 if (!strcmp(token, "serverip")) { cfg->c35_tcp_srvip=inet_addr(value); return; } 634 if (!strcmp(token, "suppresscmd08")) { cfg->c35_suppresscmd08=atoi(value); return; } 635 if (token[0] != '#') 636 fprintf(stderr, "Warning: keyword '%s' in camd35 tcp section not recognized\n",token); 783 if (!strcmp(token, "port")) { 784 if(strlen(value) == 0) { 785 clear_ptab(&cfg->c35_tcp_ptab); 786 return; 787 } else { 788 chk_port_tab(value, &cfg->c35_tcp_ptab); 789 return; 790 } 791 } 792 793 if (!strcmp(token, "serverip")) { 794 if(strlen(value) == 0) { 795 cfg->c35_tcp_srvip = 0; 796 return; 797 } else { 798 cfg->c35_tcp_srvip = inet_addr(value); 799 return; 800 } 801 } 802 803 if (!strcmp(token, "suppresscmd08")) { 804 if(strlen(value) == 0) { 805 cfg->c35_suppresscmd08 = 0; 806 return; 807 } else { 808 cfg->c35_suppresscmd08 = atoi(value); 809 return; 810 } 811 } 812 813 if (token[0] != '#') 814 cs_log( "Warning: keyword '%s' in camd35 tcp section not recognized", token); 637 815 } 638 816 639 817 void chk_t_newcamd(char *token, char *value) 640 818 { 641 if (!strcmp(token, "port")) { chk_port_tab(value, &cfg->ncd_ptab); return; } 642 if (!strcmp(token, "serverip")) { cfg->ncd_srvip=inet_addr(value); return; } 643 if (!strcmp(token, "allowed")) { chk_iprange(value, &cfg->ncd_allowed); return; } 644 if (!strcmp(token, "key")) 645 { 646 if (key_atob14(value, cfg->ncd_key)) 647 { 648 fprintf(stderr, "Configuration newcamd: Error in Key\n"); 649 exit(1); 650 } 651 return; 652 } 653 if (!strcmp(token, "keepalive")) 654 { 655 cfg->ncd_keepalive = atoi(value); 656 return; 657 } 658 if (token[0] != '#') 659 fprintf(stderr, "Warning: keyword '%s' in newcamd section not recognized\n",token); 819 if (!strcmp(token, "port")) { 820 if(strlen(value) == 0) { 821 clear_ptab(&cfg->ncd_ptab); 822 return; 823 } else { 824 chk_port_tab(value, &cfg->ncd_ptab); 825 return; 826 } 827 } 828 829 if (!strcmp(token, "serverip")) { 830 if(strlen(value) == 0) { 831 cfg->ncd_srvip = 0; 832 return; 833 } else { 834 cfg->ncd_srvip = inet_addr(value); 835 return; 836 } 837 } 838 839 if (!strcmp(token, "allowed")) { 840 if(strlen(value) == 0) { 841 clear_sip(&cfg->ncd_allowed); 842 return; 843 } else { 844 chk_iprange(value, &cfg->ncd_allowed); 845 return; 846 } 847 } 848 849 if (!strcmp(token, "key")) { 850 if (key_atob14(value, cfg->ncd_key)) { 851 fprintf(stderr, "Configuration newcamd: Error in Key\n"); 852 exit(1); 853 } 854 return; 855 } 856 857 if (!strcmp(token, "keepalive")) { 858 if(strlen(value) == 0) { 859 cfg->ncd_keepalive = 1; 860 return; 861 } else { 862 cfg->ncd_keepalive = atoi(value); 863 return; 864 } 865 } 866 867 if (token[0] != '#') 868 cs_log( "Warning: keyword '%s' in newcamd section not recognized", token); 660 869 } 661 870 662 871 void chk_t_cccam(char *token, char *value) 663 872 { 664 if (!strcmp(token, "port")) { cfg->cc_port=atoi(value); return; } 665 //if (!strcmp(token, "serverip")) { cfg->cc_srvip=inet_addr(value); return; } 666 if (!strcmp(token, "reshare")) { cfg->cc_reshare=atoi(value); return; } 667 if (!strcmp(token, "version")) { // cccam version 668 if (strlen(value)>sizeof(cfg->cc_version)-1) { 669 fprintf(stderr, "cccam config: version too long\n"); 670 exit(1); 671 } 672 memset(cfg->cc_version, 0, sizeof(cfg->cc_version)); 673 strncpy((char*)cfg->cc_version, value, sizeof(cfg->cc_version)-1); 674 return; 675 } 676 if (!strcmp(token, "build")) { // cccam build number 677 if (strlen(value)>sizeof(cfg->cc_build)-1) { 678 fprintf(stderr, "cccam config build number too long\n"); 679 exit(1); 680 } 681 memset(cfg->cc_build, 0, sizeof(cfg->cc_build)); 682 strncpy((char*)cfg->cc_build, value, sizeof(cfg->cc_build)-1); 683 return; 684 } 685 if (token[0] != '#') 686 fprintf(stderr, "Warning: keyword '%s' in cccam section not recognized\n",token); 873 if (!strcmp(token, "port")) { 874 if(strlen(value) == 0) { 875 cfg->cc_port = 0; 876 return; 877 } else { 878 cfg->cc_port = atoi(value); 879 return; 880 } 881 } 882 //if (!strcmp(token, "serverip")) { cfg->cc_srvip=inet_addr(value); return; } 883 884 if (!strcmp(token, "reshare")) { 885 if(strlen(value) == 0) { 886 cfg->cc_reshare = 0; 887 return; 888 } else { 889 cfg->cc_reshare=atoi(value); 890 return; 891 } 892 } 893 // cccam version 894 if (!strcmp(token, "version")) { 895 if (strlen(value) > sizeof(cfg->cc_version) - 1) { 896 fprintf(stderr, "cccam config: version too long\n"); 897 exit(1); 898 } 899 memset(cfg->cc_version, 0, sizeof(cfg->cc_version)); 900 strncpy((char*)cfg->cc_version, value, sizeof(cfg->cc_version) - 1); 901 return; 902 } 903 // cccam build number 904 if (!strcmp(token, "build")) { 905 if (strlen(value) > sizeof(cfg->cc_build) - 1) { 906 fprintf(stderr, "cccam config build number too long\n"); 907 exit(1); 908 } 909 memset(cfg->cc_build, 0, sizeof(cfg->cc_build)); 910 strncpy((char*)cfg->cc_build, value, sizeof(cfg->cc_build)-1); 911 return; 912 } 913 914 if (token[0] != '#') 915 cs_log( "Warning: keyword '%s' in cccam section not recognized",token); 687 916 } 688 917 689 918 void chk_t_radegast(char *token, char *value) 690 919 { 691 if (!strcmp(token, "port")) { cfg->rad_port=atoi(value); return; } 692 if (!strcmp(token, "serverip")) { cfg->rad_srvip=inet_addr(value); return; } 693 if (!strcmp(token, "allowed")) { chk_iprange(value, &cfg->rad_allowed); return; } 694 if (!strcmp(token, "user")) { cs_strncpy(cfg->rad_usr, value, sizeof(cfg->rad_usr)); return; } 695 if (token[0] != '#') 696 fprintf(stderr, "Warning: keyword '%s' in radegast section not recognized\n",token); 920 if (!strcmp(token, "port")) { 921 if(strlen(value) == 0) { 922 cfg->rad_port = 0; 923 return; 924 } else { 925 cfg->rad_port = atoi(value); 926 return; 927 } 928 } 929 930 if (!strcmp(token, "serverip")) { 931 if(strlen(value) == 0) { 932 cfg->rad_srvip = 0; 933 return; 934 } else { 935 cfg->rad_srvip = inet_addr(value); 936 return; 937 } 938 } 939 940 if (!strcmp(token, "allowed")) { 941 if(strlen(value) == 0) { 942 clear_sip(&cfg->rad_allowed); 943 return; 944 } else { 945 chk_iprange(value, &cfg->rad_allowed); 946 return; 947 } 948 } 949 950 if (!strcmp(token, "user")) { 951 cs_strncpy(cfg->rad_usr, value, sizeof(cfg->rad_usr)); 952 return; 953 } 954 955 if (token[0] != '#') 956 cs_log( "Warning: keyword '%s' in radegast section not recognized", token); 697 957 } 698 958 … … 954 1214 if (!strcmp(token, "pwd")) { cs_strncpy(account->pwd, value, sizeof(account->pwd)); return; } 955 1215 if (!strcmp(token, "hostname")) { cs_strncpy((char *)account->dyndns, value, sizeof(account->dyndns));return; } 956 if (!strcmp(token, "betatunnel")) { chk_tuntab(value, &account->ttab); return; } 1216 1217 if (!strcmp(token, "betatunnel")) { 1218 if(strlen(value) == 0) { 1219 clear_tuntab(&account->ttab); 1220 return; 1221 } else { 1222 chk_tuntab(value, &account->ttab); 1223 return; 1224 } 1225 } 1226 957 1227 if (!strcmp(token, "uniq")) { account->uniq=atoi(value); return; } 958 1228 if (!strcmp(token, "sleep")) { account->tosleep=atoi(value); return; } 959 1229 if (!strcmp(token, "monlevel")) { account->monlvl=atoi(value); return; } 960 if (!strcmp(token, "caid")) { chk_caidtab(value, &account->ctab); return; } 1230 1231 if (!strcmp(token, "caid")) { 1232 if(strlen(value) == 0) { 1233 clear_caidtab(&account->ctab); 1234 return; 1235 } else { 1236 chk_caidtab(value, &account->ctab); 1237 return; 1238 } 1239 } 1240 961 1241 if (!strcmp(token, "disabled")) { account->disabled=atoi(value); return; } 962 1242 if (!strcmp(token, "suppresscmd08")) { account->c35_suppresscmd08=atoi(value); return; } … … 998 1278 if(!strcmp(token, "chid")) { chk_ftab(value, &account->fchid, "user", account->usr, "chid"); return; } 999 1279 1000 if (!strcmp(token, "expdate")) 1001 { 1002 if (!value[0]) { 1003 account->expirationdate=(time_t)NULL; 1004 return; 1005 } 1006 struct tm cstime; 1007 memset(&cstime,0,sizeof(cstime)); 1008 for (i=0, ptr1=strtok(value, "-/"); (i<3)&&(ptr1); ptr1=strtok(NULL, "-/"), i++) 1009 { 1010 switch(i) 1011 { 1012 case 0: cstime.tm_year=atoi(ptr1)-1900; break; 1013 case 1: cstime.tm_mon =atoi(ptr1)-1; break; 1014 case 2: cstime.tm_mday=atoi(ptr1); break; 1015 } 1016 } 1017 account->expirationdate=mktime(&cstime); 1018 return; 1019 } 1280 if (!strcmp(token, "expdate")) { 1281 if (!value[0]) { 1282 account->expirationdate=(time_t)NULL; 1283 return; 1284 } 1285 struct tm cstime; 1286 memset(&cstime,0,sizeof(cstime)); 1287 for (i=0, ptr1=strtok(value, "-/"); (i<3)&&(ptr1); ptr1=strtok(NULL, "-/"), i++) { 1288 switch(i) { 1289 case 0: cstime.tm_year=atoi(ptr1)-1900; break; 1290 case 1: cstime.tm_mon =atoi(ptr1)-1; break; 1291 case 2: cstime.tm_mday=atoi(ptr1); break; 1292 } 1293 } 1294 account->expirationdate=mktime(&cstime); 1295 return; 1296 } 1020 1297 1021 1298 #ifdef CS_ANTICASC
Note:
See TracChangeset
for help on using the changeset viewer.