Changeset 1611


Ignore:
Timestamp:
02/18/10 22:11:09 (11 years ago)
Author:
alno
Message:

WebIf:

  • fix issue with server IP's in config. Use 0 (zero) to delete an entry.
Location:
branches/monitor-improvement
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/monitor-improvement/oscam-config.c

    r1607 r1611  
    10211021    /*global settings*/
    10221022    fprintf(f,"[global]\n");
    1023     fprintf_conf(f, CONFVARWIDTH, "serverip", "%s\n", inet_ntoa(*(struct in_addr *)&cfg->srvip));
     1023    if (cfg->srvip != 0)
     1024        fprintf_conf(f, CONFVARWIDTH, "serverip", "%s\n", inet_ntoa(*(struct in_addr *)&cfg->srvip));
    10241025    if (cfg->pidfile != NULL) fprintf_conf(f, CONFVARWIDTH, "pidfile", "%s\n", cfg->pidfile);
    10251026    if (cfg->usrfile != NULL) fprintf_conf(f, CONFVARWIDTH, "usrfile", "%s\n", cfg->usrfile);
     
    10461047    fprintf(f,"[monitor]\n");
    10471048    fprintf_conf(f, CONFVARWIDTH, "port", "%d\n", cfg->mon_port);
    1048     fprintf_conf(f, CONFVARWIDTH, "serverip", "%s\n", inet_ntoa(*(struct in_addr *)&cfg->mon_srvip));
     1049    if (cfg->mon_srvip != 0)
     1050        fprintf_conf(f, CONFVARWIDTH, "serverip", "%s\n", inet_ntoa(*(struct in_addr *)&cfg->mon_srvip));
    10491051
    10501052    fprintf_conf(f, CONFVARWIDTH, "nocrypt", "");
     
    10871089
    10881090        fputc((int)'\n', f);
    1089         fprintf_conf(f, CONFVARWIDTH, "serverip", "%s\n", inet_ntoa(*(struct in_addr *)&cfg->ncd_srvip));
     1091        if (cfg->ncd_srvip != 0)
     1092            fprintf_conf(f, CONFVARWIDTH, "serverip", "%s\n", inet_ntoa(*(struct in_addr *)&cfg->ncd_srvip));
    10901093        fprintf_conf(f, CONFVARWIDTH, "key", "");
    10911094        for (i=0;i<14;i++) fprintf(f,"%02X", cfg->ncd_key[i]);
     
    11081111        fprintf(f,"[camd33]\n");
    11091112        fprintf_conf(f, CONFVARWIDTH, "port", "%d\n", cfg->c33_port);
    1110         fprintf_conf(f, CONFVARWIDTH, "serverip", "%s\n", inet_ntoa(*(struct in_addr *)&cfg->c33_srvip));
     1113        if (cfg->c33_srvip != 0)
     1114            fprintf_conf(f, CONFVARWIDTH, "serverip", "%s\n", inet_ntoa(*(struct in_addr *)&cfg->c33_srvip));
    11111115        fprintf_conf(f, CONFVARWIDTH, "passive", "%d\n", cfg->c33_passive);
    11121116        fprintf_conf(f, CONFVARWIDTH, "key", ""); for (i = 0; i < (int) sizeof(cfg->c33_key); ++i) fprintf(f,"%02X", cfg->c33_key[i]); fputc((int)'\n', f);
     
    11251129        fprintf(f,"[cs357x]\n");
    11261130        fprintf_conf(f, CONFVARWIDTH, "port", "%d\n", cfg->c35_port);
    1127         if (cfg->c35_tcp_srvip)
     1131        if (cfg->c35_tcp_srvip != 0)
    11281132            fprintf_conf(f, CONFVARWIDTH, "serverip", "%s\n", inet_ntoa(*(struct in_addr *)&cfg->c35_tcp_srvip));
    11291133        if (cfg->c35_suppresscmd08)
     
    11511155
    11521156        fputc((int)'\n', f);
    1153         if (cfg->c35_tcp_srvip)
     1157        if (cfg->c35_tcp_srvip != 0)
    11541158            fprintf_conf(f, CONFVARWIDTH, "serverip", "%s\n", inet_ntoa(*(struct in_addr *)&cfg->c35_tcp_srvip));
    11551159        fputc((int)'\n', f);
     
    11601164        fprintf(f,"[radegast]\n");
    11611165        fprintf_conf(f, CONFVARWIDTH, "port", "%d\n", cfg->rad_port);
    1162         fprintf_conf(f, CONFVARWIDTH, "serverip", "%s\n", inet_ntoa(*(struct in_addr *)&cfg->rad_srvip));
     1166        if (cfg->rad_srvip != 0)
     1167            fprintf_conf(f, CONFVARWIDTH, "serverip", "%s\n", inet_ntoa(*(struct in_addr *)&cfg->rad_srvip));
    11631168        fprintf_conf(f, CONFVARWIDTH, "user", "%s\n", cfg->rad_usr);
    11641169        fprintf_conf(f, CONFVARWIDTH, "allowed", "");
  • branches/monitor-improvement/oscam-http.c

    r1605 r1611  
    6767                tpl_printf(vars, 1, "MESSAGE", "Parameter: %s set to Value: %s<BR>\n", (*params).params[i], (*params).values[i]);
    6868                //we use the same function as used for parsing the config tokens
     69
    6970                chk_t_global((*params).params[i], (*params).values[i]);
    7071            }
     
    7475        else tpl_addVar(vars, 1, "MESSAGE", "<B>Write Config failed</B><BR><BR>");
    7576    }
    76     tpl_addVar(vars, 0, "SERVERIP", inet_ntoa(*(struct in_addr *)&cfg->srvip));
     77    if (cfg->srvip != 0)
     78        tpl_addVar(vars, 0, "SERVERIP", inet_ntoa(*(struct in_addr *)&cfg->srvip));
    7779    if (cfg->pidfile != NULL) tpl_addVar(vars, 0, "PIDFILE", cfg->pidfile);
    7880    if (cfg->usrfile != NULL) tpl_addVar(vars, 0, "USERFILE", cfg->usrfile);
     
    117119    }
    118120    tpl_printf(vars, 0, "PORT", "%d", cfg->c33_port);
    119     tpl_addVar(vars, 0, "SERVERIP", inet_ntoa(*(struct in_addr *)&cfg->c33_srvip));
     121    if (cfg->c33_srvip != 0)
     122        tpl_addVar(vars, 0, "SERVERIP", inet_ntoa(*(struct in_addr *)&cfg->c33_srvip));
    120123    tpl_printf(vars, 0, "PASSIVE", "%d",  cfg->c33_passive);
    121124
     
    147150    }
    148151    tpl_printf(vars, 0, "PORT", "%d", cfg->c35_port);
    149     tpl_addVar(vars, 1, "SERVERIP", inet_ntoa(*(struct in_addr *)&cfg->c35_tcp_srvip));
     152    if (cfg->c35_tcp_srvip != 0)
     153        tpl_addVar(vars, 1, "SERVERIP", inet_ntoa(*(struct in_addr *)&cfg->c35_tcp_srvip));
    150154
    151155    if (cfg->c35_suppresscmd08)
     
    188192        }
    189193    }
    190     tpl_addVar(vars, 1, "SERVERIP", inet_ntoa(*(struct in_addr *)&cfg->c35_tcp_srvip));
     194    if (cfg->c35_tcp_srvip != 0)
     195        tpl_addVar(vars, 1, "SERVERIP", inet_ntoa(*(struct in_addr *)&cfg->c35_tcp_srvip));
    191196
    192197    fputs(tpl_getTpl(vars, "CONFIGCAMD35TCP"), f);
     
    211216        else tpl_addVar(vars, 1, "MESSAGE", "<B>Write Config failed</B><BR><BR>");
    212217    }
    213         int j;
    214         char *dot1, *dot2;
    215         if ((cfg->ncd_ptab.nports > 0) && (cfg->ncd_ptab.ports[0].s_port > 0)){
    216             dot1 = "";
    217             for(i = 0; i < cfg->ncd_ptab.nports; ++i){
    218                 tpl_printf(vars, 1, "PORT", "%s%d@%04X", dot1, cfg->ncd_ptab.ports[i].s_port, cfg->ncd_ptab.ports[i].ftab.filts[0].caid);
    219                 if (cfg->ncd_ptab.ports[i].ftab.filts[0].nprids > 0){
    220                     tpl_printf(vars, 1, "PORT", ":");
    221                     dot2 = "";
    222                     for (j = 0; j < cfg->ncd_ptab.ports[i].ftab.filts[0].nprids; ++j){
    223                         tpl_printf(vars, 1, "PORT", "%s%06X", dot2, cfg->ncd_ptab.ports[i].ftab.filts[0].prids[j]);
    224                         dot2 = ",";
    225                     }
     218    int j;
     219    char *dot1, *dot2;
     220    if ((cfg->ncd_ptab.nports > 0) && (cfg->ncd_ptab.ports[0].s_port > 0)){
     221        dot1 = "";
     222        for(i = 0; i < cfg->ncd_ptab.nports; ++i){
     223            tpl_printf(vars, 1, "PORT", "%s%d@%04X", dot1, cfg->ncd_ptab.ports[i].s_port, cfg->ncd_ptab.ports[i].ftab.filts[0].caid);
     224            if (cfg->ncd_ptab.ports[i].ftab.filts[0].nprids > 0){
     225                tpl_printf(vars, 1, "PORT", ":");
     226                dot2 = "";
     227                for (j = 0; j < cfg->ncd_ptab.ports[i].ftab.filts[0].nprids; ++j){
     228                    tpl_printf(vars, 1, "PORT", "%s%06X", dot2, cfg->ncd_ptab.ports[i].ftab.filts[0].prids[j]);
     229                    dot2 = ",";
    226230                }
    227                 dot1=";";
    228             }
    229         }
    230 
    231     tpl_addVar(vars, 0, "SERVERIP", inet_ntoa(*(struct in_addr *)&cfg->ncd_srvip));
     231            }
     232            dot1=";";
     233        }
     234    }
     235
     236    if (cfg->ncd_srvip != 0)
     237        tpl_addVar(vars, 0, "SERVERIP", inet_ntoa(*(struct in_addr *)&cfg->ncd_srvip));
    232238    for (i=0;i<14;i++) tpl_printf(vars, 1, "KEY", "%02X", cfg->ncd_key[i]);
    233239
     
    235241    char *dot="";
    236242    for (cip = cfg->ncd_allowed; cip; cip = cip->next){
    237     tpl_printf(vars, 1, "ALLOWED", "%s%s", dot, cs_inet_ntoa(cip->ip[0]));
    238     if (cip->ip[0] != cip->ip[1])   tpl_printf(vars, 1, "ALLOWED", "-%s", cs_inet_ntoa(cip->ip[1]));
     243        tpl_printf(vars, 1, "ALLOWED", "%s%s", dot, cs_inet_ntoa(cip->ip[0]));
     244        if (cip->ip[0] != cip->ip[1])   tpl_printf(vars, 1, "ALLOWED", "-%s", cs_inet_ntoa(cip->ip[1]));
    239245        dot=",";
    240246    }
     
    264270    }
    265271    tpl_printf(vars, 0, "PORT", "%d", cfg->rad_port);
    266     tpl_addVar(vars, 0, "SERVERIP", inet_ntoa(*(struct in_addr *)&cfg->rad_srvip));
     272    if (cfg->rad_srvip != 0)
     273        tpl_addVar(vars, 0, "SERVERIP", inet_ntoa(*(struct in_addr *)&cfg->rad_srvip));
    267274    tpl_addVar(vars, 0, "USER", cfg->rad_usr);
    268275
     
    347354    }
    348355    tpl_printf(vars, 0, "MONPORT", "%d", cfg->mon_port);
    349     tpl_addVar(vars, 0, "SERVERIP", inet_ntoa(*(struct in_addr *)&cfg->mon_srvip));
     356    if (cfg->mon_srvip != 0)
     357        tpl_addVar(vars, 0, "SERVERIP", inet_ntoa(*(struct in_addr *)&cfg->mon_srvip));
    350358    tpl_printf(vars, 0, "AULOW", "%d", cfg->mon_aulow);
    351359    tpl_printf(vars, 0, "HIDECLIENTTO", "%d", cfg->mon_hideclient_to);
  • branches/monitor-improvement/oscam-http.h

    r1604 r1611  
    826826        <TR><TH>&nbsp;</TH><TH>Edit Monitor Config</TH></TR>\n\
    827827        <TR><TD>Port:</TD><TD><input name=\"port\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"##MONPORT##\"></TD></TR>\n\
    828         <TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##SERVERIP##\"></TD></TR>\n\
     828        <TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##SERVERIP##\"> Use 0 (zero) to delete.</TD></TR>\n\
    829829        <TR><TD>Nocrypt:</TD><TD><input name=\"nocrypt\" type=\"text\" size=\"100\" maxlength=\"200\" value=\"##NOCRYPT##\"></TD></TR>\n\
    830830        <TR><TD>Aulow:</TD><TD><input name=\"aulow\" type=\"text\" size=\"5\" maxlength=\"1\" value=\"##AULOW##\"> min</TD></TR>\n\
     
    865865        <TR><TH>&nbsp;</TH><TH>Edit Radegast Config</TH></TR>\n\
    866866        <TR><TD>Port:</TD><TD><input name=\"port\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"##PORT##\"></TD></TR>\n\
    867         <TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##SERVERIP##\"></TD></TR>\n\
     867        <TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##SERVERIP##\"> Use 0 (zero) to delete.</TD></TR>\n\
    868868        <TR><TD>Allowed:</TD><TD><input name=\"allowed\" type=\"text\" size=\"100\" maxlength=\"200\" value=\"##ALLOWED##\"></TD></TR>\n\
    869869        <TR><TD>User:</TD><TD><input name=\"user\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##USER##\"></TD></TR>\n\
     
    886886        <TR><TH>&nbsp;</TH><TH>Edit Newcamd Config</TH></TR>\n\
    887887        <TR><TD>Port:</TD><TD><input name=\"port\" type=\"text\" size=\"100\" maxlength=\"200\" value=\"##PORT##\"></TD></TR>\n\
    888         <TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##SERVERIP##\"></TD></TR>\n\
     888        <TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##SERVERIP##\"> Use 0 (zero) to delete.</TD></TR>\n\
    889889        <TR><TD>Key:</TD><TD><input name=\"key\" type=\"text\" size=\"35\" maxlength=\"28\" value=\"##KEY##\"></TD></TR>\n\
    890890        <TR><TD>Allowed:</TD><TD><input name=\"allowed\" type=\"text\" size=\"100\" maxlength=\"200\" value=\"##ALLOWED##\"></TD></TR>\n\
     
    906906    <TABLE class=\"config\" cellspacing=\"0\">\n\
    907907        <TR><TH>&nbsp;</TH><TH>Edit Global Config</TH></TR>\n\
    908         <TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##SERVERIP##\"></TD></TR>\n\
     908        <TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##SERVERIP##\"> Use 0 (zero) to delete.</TD></TR>\n\
    909909        <TR><TD>PID File:</TD><TD><input name=\"pidfile\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##PIDFILE##\"></TD></TR>\n\
    910910        <TR><TD>Usrfile:</TD><TD><input name=\"usrfile\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##USERFILE##\"></TD></TR>\n\
     
    943943        <TR><TH>&nbsp;</TH><TH>Edit Camd33 Config</TH></TR>\n\
    944944        <TR><TD>Port:</TD><TD><input name=\"port\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"##PORT##\"></TD></TR>\n\
    945         <TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##SERVERIP##\"></TD></TR>\n\
     945        <TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##SERVERIP##\"> Use 0 (zero) to delete.</TD></TR>\n\
    946946        <TR><TD>Key:</TD><TD><input name=\"key\" type=\"text\" size=\"35\" maxlength=\"28\" value=\"##KEY##\"></TD></TR>\n\
    947947        <TR><TD>Passive:</TD><TD><input name=\"passive\" type=\"text\" size=\"3\" maxlength=\"1\" value=\"##PASSIVE##\"></TD></TR>\n\
     
    965965        <TR><TH>&nbsp;</TH><TH>Edit Camd35 Config</TH></TR>\n\
    966966        <TR><TD>Port:</TD><TD><input name=\"port\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"##PORT##\"></TD></TR>\n\
    967         <TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##SERVERIP##\"></TD></TR>\n\
     967        <TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##SERVERIP##\"> Use 0 (zero) to delete.</TD></TR>\n\
    968968        <TR><TD>Suppresscmd08:</TD><TD><input name=\"suppresscmd08\" type=\"checkbox\" value=\"1\" ##SUPPRESSCMD08##></TD></TR>\n\
    969969        <TR><TD colspan=\"2\" align=\"right\"><input type=\"submit\" value=\"OK\">\n</TD></TR>\n\
     
    984984        <TR><TH>&nbsp;</TH><TH>Edit Camd35 TCP Config</TH></TR>\n\
    985985        <TR><TD>Port:</TD><TD><input name=\"port\" type=\"text\" size=\"100\" maxlength=\"200\" value=\"##PORT##\"></TD></TR>\n\
    986         <TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##SERVERIP##\"></TD></TR>\n\
     986        <TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##SERVERIP##\"> Use 0 (zero) to delete.</TD></TR>\n\
    987987    <TR><TD colspan=\"2\" align=\"right\"><input type=\"submit\" value=\"OK\">\n</TD></TR>\n\
    988988    </TABLE>\n\
Note: See TracChangeset for help on using the changeset viewer.