Changeset 1046


Ignore:
Timestamp:
01/03/10 15:46:29 (12 years ago)
Author:
Admin
Message:

Fix chk_iprange and the functions to display nocrypt and allowed-fields in WebIf

Location:
branches/monitor-improvement
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/monitor-improvement/globals.h

    r1044 r1046  
    672672void create_rand_str(char *dst, int size);
    673673int file_exists(const char * filename);
     674void clear_sip(struct s_ip **sip);
    674675
    675676// oscam variables
  • branches/monitor-improvement/oscam-config.c

    r1044 r1046  
    7070void chk_iprange(char *value, struct s_ip **base)
    7171{
    72   //int i;
     72  int i = 0;
    7373  char *ptr1, *ptr2;
    7474  struct s_ip *lip, *cip;
     
    8989  for (ptr1=strtok(value, ","); ptr1; ptr1=strtok(NULL, ","))
    9090  {
     91    if (i == 0) ++i;
     92    else {
     93        if (!(cip=malloc(sizeof(struct s_ip)))){
     94            fprintf(stderr, "Error allocating memory (errno=%d)\n", errno);
     95            exit(1);
     96        }
     97        lip->next = cip;
     98        memset(cip, 0, sizeof(struct s_ip));
     99    }
    91100    if( (ptr2=strchr(trim(ptr1), '-')) )
    92101    {
     
    97106    else
    98107      cip->ip[0]=cip->ip[1]=cs_inet_addr(ptr1);
     108    lip = cip;
    99109  }
    100110}
  • branches/monitor-improvement/oscam-http.c

    r1044 r1046  
    9595            if ((strcmp((*params).params[i], "part")) && (strcmp((*params).params[i], "action"))){
    9696                tpl_printf(vars, 1, "MESSAGE", "Parameter: %s set to Value: %s<BR>\n", (*params).params[i], (*params).values[i]);
     97                if (strcmp((*params).params[i], "nocrypt") == 0){
     98                    clear_sip(&cfg->c33_plain);
     99                }
    97100                //we use the same function as used for parsing the config tokens
    98101                chk_t_camd33((*params).params[i], (*params).values[i]);
     
    109112      struct s_ip *cip;
    110113      char *dot="";
    111   for (cip = cfg->rad_allowed; cip; cip = cip->next){
    112     tpl_printf(vars, 1, "NOCRYPT", "%s%s", dot, inet_ntoa(*(struct in_addr *)&cip->ip[0]));
    113     if (cip->ip[0] == cip->ip[1])   tpl_printf(vars, 1, "NOCRYPT", "-%s", inet_ntoa(*(struct in_addr *)&cip->ip[1]));
     114  for (cip = cfg->c33_plain; cip; cip = cip->next){
     115    tpl_printf(vars, 1, "NOCRYPT", "%s%s", dot, cs_inet_ntoa(cip->ip[0]));
     116    if (cip->ip[0] != cip->ip[1])   tpl_printf(vars, 1, "NOCRYPT", "-%s", cs_inet_ntoa(cip->ip[1]));
    114117    dot=",";
    115118      }
     
    179182            if ((strcmp((*params).params[i], "part")) && (strcmp((*params).params[i], "action"))){
    180183                tpl_printf(vars, 1, "MESSAGE", "Parameter: %s set to Value: %s<BR>\n", (*params).params[i], (*params).values[i]);
     184                if (strcmp((*params).params[i], "allowed") == 0){
     185                    clear_sip(&cfg->rad_allowed);
     186                }
    181187                //we use the same function as used for parsing the config tokens
    182188                chk_t_radegast((*params).params[i], (*params).values[i]);
     
    193199      char *dot="";
    194200      for (cip=cfg->rad_allowed; cip; cip=cip->next){
    195     tpl_printf(vars, 1, "ALLOWED", "%s%s", dot, inet_ntoa(*(struct in_addr *)&cip->ip[0]));
    196     if (cip->ip[0] == cip->ip[1])   tpl_printf(vars, 1, "ALLOWED", "-%s", inet_ntoa(*(struct in_addr *)&cip->ip[1]));
     201    tpl_printf(vars, 1, "ALLOWED", "%s%s", dot, cs_inet_ntoa(cip->ip[0]));
     202    if (cip->ip[0] != cip->ip[1])   tpl_printf(vars, 1, "ALLOWED", "-%s", cs_inet_ntoa(cip->ip[1]));
    197203    dot=",";
    198204      }
     
    249255            if ((strcmp((*params).params[i], "part")) && (strcmp((*params).params[i], "action"))){
    250256                tpl_printf(vars, 1, "MESSAGE", "Parameter: %s set to Value: %s<BR>\n", (*params).params[i], (*params).values[i]);
     257                if (strcmp((*params).params[i], "nocrypt") == 0){
     258                    clear_sip(&cfg->mon_allowed);
     259                }
    251260                //we use the same function as used for parsing the config tokens
    252261                chk_t_monitor((*params).params[i], (*params).values[i]);
     
    271280      char *dot="";
    272281  for (cip = cfg->mon_allowed; cip; cip = cip->next){
    273     tpl_printf(vars, 1, "NOCRYPT", "%s%s", dot, inet_ntoa(*(struct in_addr *)&cip->ip[0]));
    274     if (cip->ip[0] == cip->ip[1])   tpl_printf(vars, 1, "NOCRYPT", "-%s", inet_ntoa(*(struct in_addr *)&cip->ip[1]));
     282    tpl_printf(vars, 1, "NOCRYPT", "%s%s", dot, cs_inet_ntoa(cip->ip[0]));
     283    if (cip->ip[0] != cip->ip[1])   tpl_printf(vars, 1, "NOCRYPT", "-%s", cs_inet_ntoa(cip->ip[1]));
    275284    dot=",";
    276285        }
  • branches/monitor-improvement/oscam-http.h

    r1041 r1046  
    484484        <TR><TD>Port:</TD><TD><input name=\"port\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"##MONPORT##\"></TD></TR>\n\
    485485        <TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##SERVERIP##\"></TD></TR>\n\
    486         <TR><TD>Nocrypt:</TD><TD><input name=\"nocrypt\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"##NOCRYPT##\">wrong, see Ticket #265</TD></TR>\n\
     486        <TR><TD>Nocrypt:</TD><TD><input name=\"nocrypt\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"##NOCRYPT##\"></TD></TR>\n\
    487487        <TR><TD>Aulow:</TD><TD><input name=\"aulow\" type=\"text\" size=\"5\" maxlength=\"1\" value=\"##AULOW##\"></TD></TR>\n\
    488488        <TR>\n\
     
    522522        <TR><TD>Port:</TD><TD><input name=\"port\" type=\"text\" size=\"5\" maxlength=\"5\" value=\"##PORT##\"></TD></TR>\n\
    523523        <TR><TD>Serverip:</TD><TD><input name=\"serverip\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##SERVERIP##\"></TD></TR>\n\
    524         <TR><TD>Allowed:</TD><TD><input name=\"allowed\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"##ALLOWED##\">wrong, see Ticket #265</TD></TR>\n\
     524        <TR><TD>Allowed:</TD><TD><input name=\"allowed\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"##ALLOWED##\"></TD></TR>\n\
    525525        <TR><TD>User:</TD><TD><input name=\"user\" type=\"text\" size=\"30\" maxlength=\"30\" value=\"##USER##\"></TD></TR>\n\
    526526    <TR><TD colspan=\"2\" align=\"right\"><input type=\"submit\" value=\"OK\">\n</TD></TR>\n\
     
    600600        <TR><TD>Key:</TD><TD><input name=\"key\" type=\"text\" size=\"35\" maxlength=\"28\" value=\"##KEY##\"></TD></TR>\n\
    601601        <TR><TD>Passive:</TD><TD><input name=\"passive\" type=\"text\" size=\"3\" maxlength=\"1\" value=\"##PASSIVE##\"></TD></TR>\n\
    602         <TR><TD>Nocrypt:</TD><TD><input name=\"nocrypt\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"##NOCRYPT##\">wrong, see Ticket #265</TD></TR>\n\
     602        <TR><TD>Nocrypt:</TD><TD><input name=\"nocrypt\" type=\"text\" size=\"50\" maxlength=\"50\" value=\"##NOCRYPT##\"></TD></TR>\n\
    603603    <TR><TD colspan=\"2\" align=\"right\"><input type=\"submit\" value=\"OK\">\n</TD></TR>\n\
    604604    </TABLE>\n\
  • branches/monitor-improvement/oscam-simples.c

    r1024 r1046  
    467467    return 0;
    468468}
     469
     470void clear_sip(struct s_ip **sip){
     471    struct s_ip *cip = *sip, *lip;
     472    for (*sip = NULL; cip != NULL; cip = lip){
     473        lip = cip->next;
     474        free(cip);
     475    }
     476}
Note: See TracChangeset for help on using the changeset viewer.