trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iga...@apache.org
Subject svn commit: r1059333 - in /trafficserver/traffic/trunk/proxy/mgmt: html2/Makefile.am html2/checkCookies.ink html2/enableCookies.ink html2/plugin.ink html2/rename.ink html2/restart.ink html2/ssl_redirect.ink web2/WebHttp.cc
Date Sat, 15 Jan 2011 13:56:14 GMT
Author: igalic
Date: Sat Jan 15 13:56:14 2011
New Revision: 1059333

URL: http://svn.apache.org/viewvc?rev=1059333&view=rev
Log:
Collecting some low hanging fruits:
Remove all unreferenced *.ink files from html2

Removed:
    trafficserver/traffic/trunk/proxy/mgmt/html2/checkCookies.ink
    trafficserver/traffic/trunk/proxy/mgmt/html2/enableCookies.ink
    trafficserver/traffic/trunk/proxy/mgmt/html2/plugin.ink
    trafficserver/traffic/trunk/proxy/mgmt/html2/rename.ink
    trafficserver/traffic/trunk/proxy/mgmt/html2/restart.ink
    trafficserver/traffic/trunk/proxy/mgmt/html2/ssl_redirect.ink
Modified:
    trafficserver/traffic/trunk/proxy/mgmt/html2/Makefile.am
    trafficserver/traffic/trunk/proxy/mgmt/web2/WebHttp.cc

Modified: trafficserver/traffic/trunk/proxy/mgmt/html2/Makefile.am
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt/html2/Makefile.am?rev=1059333&r1=1059332&r2=1059333&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt/html2/Makefile.am (original)
+++ trafficserver/traffic/trunk/proxy/mgmt/html2/Makefile.am Sat Jan 15 13:56:14 2011
@@ -31,14 +31,8 @@ uninstall-hook:
 
 webuidir = $(pkgdatadir)
 dist_webui_DATA = \
-	checkCookies.ink \
-	enableCookies.ink \
 	index.ink \
 	inktomi.css \
 	inktomiLarge.css \
 	navigation_tree.xml \
-	plugin.ink \
-	rename.ink \
-	resize.js \
-	restart.ink \
-	ssl_redirect.ink
+	resize.js

Modified: trafficserver/traffic/trunk/proxy/mgmt/web2/WebHttp.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/mgmt/web2/WebHttp.cc?rev=1059333&r1=1059332&r2=1059333&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/mgmt/web2/WebHttp.cc (original)
+++ trafficserver/traffic/trunk/proxy/mgmt/web2/WebHttp.cc Sat Jan 15 13:56:14 2011
@@ -936,383 +936,6 @@ SetWarning(WebHttpContext * whc, char *a
   whc->request_state |= WEB_HTTP_STATE_SUBMIT_WARN;
 }
 
-//-------------------------------------------------------------------------
-// handle_submit_net_config
-//-------------------------------------------------------------------------
-// This handler is called when user wants to setup network of the appliance
-
-static int
-handle_submit_net_config(WebHttpContext * whc, const char *file)
-{
-  NOWARN_UNUSED(file);
-  char *cancel;
-  char *record_version;
-  char *submit_from_page;
-//  FILE* tmp;
-
-//  tmp=fopen("tmp","a");
-//  fprintf(tmp,"enter submit\n");
-
-  if (ink_hash_table_lookup(whc->post_data_ht, "submit_from_page", (void **) &submit_from_page))
{
-    ink_hash_table_delete(whc->post_data_ht, "submit_from_page");
-    whc->top_level_render_file = xstrdup(submit_from_page);
-  } else {
-    submit_from_page = NULL;
-  }
-  // check for cancel
-  if (ink_hash_table_lookup(whc->post_data_ht, "cancel", (void **) &cancel))
-    return WebHttpRender(whc, submit_from_page);
-
-  // check for record_version
-  if (ink_hash_table_lookup(whc->post_data_ht, "record_version", (void **) &record_version))
{
-    // TODO: Check return value?
-    record_version_valid(record_version);
-    ink_hash_table_delete(whc->post_data_ht, "record_version");
-    xfree(record_version);
-  }
-//  if (recs_out_of_date)
-//    goto Lout_of_date;
-
-#if defined(linux) || defined(solaris)
-
-  InkHashTableIteratorState htis;
-  InkHashTableEntry *hte;
-  char *key;
-  char *value;
-  int hn_change, gw_change, dn_change, dns_change;
-  int nic_change[5];
-  //  int nic_up[5];
-  char *dns_ip[3], old_value[265], old_hostname[80], old_gw_ip[80];
-  char nic_name[5][10], *nic[5][6], interface[80], *param;
-  char *hostname = 0, *gw_ip = 0;
-  const char *dn = 0;
-  int i, j, no;
-  char dns_ips[80];
-  bool warning, fail;
-
-  //This will be used as flags to verify whether anything changed by the user
-  hn_change = 0;
-  gw_change = 0;
-  dn_change = 0;
-  dns_change = 0;
-  warning = (fail = false);
-  //FIXNOW - we need to use SysAPI to find the numver of NICs instead of just constant 5
-  for (i = 0; i < 5; i++) {
-    nic_change[i] = 0;
-    ink_strncpy(nic_name[i], "", 1);
-    for (j = 0; j < 6; j++) {
-      nic[i][j] = NULL;
-    }
-  }
-
-  int old_euid;
-  Config_User_Root(&old_euid);
-  // Get the values the user entered
-  for (hte = ink_hash_table_iterator_first(whc->post_data_ht, &htis);
-       hte != NULL; hte = ink_hash_table_iterator_next(whc->post_data_ht, &htis))
{
-    key = (char *) ink_hash_table_entry_key(whc->post_data_ht, hte);
-    value = (char *) ink_hash_table_entry_value(whc->post_data_ht, hte);
-
-//    fprintf(stderr,"key=%s, value=%s\n",key,value);
-
-    if (strcmp(key, "HOSTNAME") == 0) {
-      hostname = value;
-      if (!Net_IsValid_Hostname(hostname)) {
-        SetWarning(whc, key);
-        warning = true;
-      } else {
-        if (!Config_GetHostname(old_value, sizeof(old_value))) {
-          if (hostname != NULL && strcmp(hostname, old_value) != 0) {
-            hn_change = 1;
-            ink_strncpy(old_hostname, old_value, sizeof(old_hostname)); //old hostname is
used in MGMT API
-          }
-        } else if (hostname != NULL) {
-          hn_change = 1;
-        }
-      }
-    } else if (strcmp(key, "GATEWAY") == 0) {
-      gw_ip = value;
-      if (!Net_IsValid_IP(gw_ip)) {
-        SetWarning(whc, key);
-        warning = true;
-      } else {
-        if (!Config_GetDefaultRouter(old_value, sizeof(old_value))) {
-          if (gw_ip != NULL && strcmp(gw_ip, old_value) != 0) {
-            ink_strncpy(old_gw_ip, old_value, sizeof(old_gw_ip));
-            gw_change = 1;
-          }
-        } else if (gw_ip != NULL) {
-          gw_change = 1;
-        }
-      }
-    } else if (strcmp(key, "domain") == 0) {
-      dn = value;
-      if (!Config_GetDomain(old_value, sizeof(old_value))) {
-        if (dn != NULL && strcmp(dn, old_value) != 0) {
-          dn_change = 1;
-        } else if (dn == NULL) {
-          dn_change = 1;
-          dn = "";
-        }
-      } else if (dn != NULL) {
-        dn_change = 1;
-      }
-    } else if (strstr(key, "DNS") != NULL) {
-      no = atoi(key + 3) - 1;
-      dns_ip[no] = value;
-      if (!Net_IsValid_IP(dns_ip[no])) {
-        SetWarning(whc, key);
-        warning = true;
-      } else {
-        if (Config_GetDNS_Server(old_value, sizeof(old_value), no)) {
-          if (dns_ip[no] != NULL && strcmp(dns_ip[no], old_value) != 0) {
-            dns_change = 1;
-          } else if (dns_ip[no] == NULL) {
-            dns_change = 1;
-          }
-        } else if (dns_ip[no] != NULL) {
-          dns_change = 1;
-        }
-      }
-    } else if (strstr(key, "NIC") != NULL) {
-      ink_strncpy(interface, key + 4, sizeof(interface));
-      param = strchr(interface, '_');
-      *param = '\0';
-      param++;
-      no = atoi(interface + 3);
-      ink_strncpy(nic_name[no], interface, sizeof(nic_name[no]));
-
-      //No DHCP support any more, hacking way is set it be static always
-      nic[no][2] = xstrdup("1");
-      if (strcmp(param, "enabled") == 0) {
-        nic[no][0] = value;
-
-        if (no == 0) {
-          //FIXNOW use SysAPI
-          if (strcmp(nic[no][0], "0") == 0) {
-            SetWarning(whc, key);
-            warning = true;
-          }
-        }
-        //FIXNOW - Use SysAPI
-        Config_GetNIC_Status(interface, old_value, sizeof(old_value));
-        if (strcmp(old_value, "up") == 0 && strcmp(nic[no][0], "0") == 0) {
-          nic_change[no] = 1;
-        } else if (strcmp(old_value, "down") == 0 && strcmp(nic[no][0], "1") == 0)
{
-          nic_change[no] = 1;
-        }
-      } else if (strcmp(param, "ONBOOT") == 0) {
-        nic[no][1] = value;
-
-        if (no == 0) {
-          //FIXNOW use SysAPI
-          if (strcmp(nic[no][1], "0") == 0) {
-            SetWarning(whc, key);
-            warning = true;
-          }
-        }
-        //FIXNOW - Use SysAPI
-        if (!Config_GetNIC_Start(interface, old_value, sizeof(old_value))) {
-          if (strcmp(nic[no][1], "1") == 0 && strcmp(old_value, "not-onboot") ==
0) {
-            nic_change[no] = 1;
-          } else if (strcmp(nic[no][1], "0") == 0 && strcmp(old_value, "onboot")
== 0) {
-            nic_change[no] = 1;
-          }
-        } else {
-          nic_change[no] = 1;
-        }
-      } else if (strcmp(param, "BOOTPROTO") == 0) {
-        nic[no][2] = value;
-        //FIXNOW - Use SysAPI
-        if (!Config_GetNIC_Protocol(interface, old_value, sizeof(old_value))) {
-          if (strcmp(nic[no][2], "0") == 0 && (strcmp(old_value, "none") == 0 ||
strcmp(old_value, "static") == 0)) {
-            nic_change[no] = 1;
-          } else if (strcmp(nic[no][2], "1") == 0 && strcmp(old_value, "dhcp") ==
0) {
-            nic_change[no] = 1;
-          }
-        } else {
-          nic_change[no] = 1;
-        }
-
-        //currently, force the protocol to become static if the old one is dhcp
-        if (strcmp(old_value, "dhcp") == 0) {
-          // XXX - changed it so we don't change value and instead duplicate the string
-          nic[no][2] = xstrdup("1");
-          nic_change[no] = 1;
-        }
-      } else if (strcmp(param, "IPADDR") == 0) {
-        nic[no][3] = value;
-        //FIXNOW - Use SysAPI
-        if (!Net_IsValid_IP(nic[no][3])) {
-          SetWarning(whc, key);
-          warning = true;
-        }
-        //FIXNOW - Use SysAPI
-        if (!Config_GetNIC_IP(interface, old_value, sizeof(old_value))) {
-          if (nic[no][3] != NULL && strcmp(nic[no][3], old_value) != 0) {
-            nic_change[no] = 1;
-          }
-          //For dhcp start, the static IP maybe same with the dhcp value
-          else {
-            char protocol[80];
-            Config_GetNIC_Protocol(interface, protocol, sizeof(protocol));
-            if (strcmp(protocol, "dhcp") == 0) {
-              nic_change[no] = 1;
-            }
-
-            if (nic[no][3] == NULL) {
-              nic_change[no] = 1;
-            }
-          }
-        } else if (nic[no][3] != NULL) {
-          nic_change[no] = 1;
-        }
-      } else if (strcmp(param, "NETMASK") == 0) {
-        nic[no][4] = value;
-        //FIXNOW - Use SysAPI
-        if (!Net_IsValid_IP(nic[no][4])) {
-          SetWarning(whc, key);
-          warning = true;
-        }
-        //FIXNOW - Use SysAPI
-        if (!Config_GetNIC_Netmask(interface, old_value, sizeof(old_value))) {
-          if (nic[no][4] != NULL && strcmp(nic[no][4], old_value) != 0) {
-            nic_change[no] = 1;
-          }
-          //For dhcp start, the static netmask maybe same with the dhcp value
-          else {
-            char protocol[80];
-            Config_GetNIC_Protocol(interface, protocol, sizeof(protocol));
-            if (strcmp(protocol, "dhcp") == 0) {
-              nic_change[no] = 1;
-            }
-
-            if (nic[no][4] == NULL) {
-              nic_change[no] = 1;
-            }
-          }
-        } else if (nic[no][4] != NULL) {
-          nic_change[no] = 1;
-        }
-      } else if (strcmp(param, "GATEWAY") == 0) {
-        nic[no][5] = value;
-        //FIXNOW - Use SysAPI
-        if (!Net_IsValid_IP(nic[no][5])) {
-          SetWarning(whc, key);
-          warning = true;
-        }
-        //FIXNOW - Use SysAPI
-        if (!Config_GetNIC_Gateway(interface, old_value, sizeof(old_value))) {
-          if (nic[no][5] != NULL && strcmp(nic[no][5], old_value) != 0) {
-            nic_change[no] = 1;
-          }
-          //For dhcp start, the gateway maybe same with the dhcp value
-          else {
-            char protocol[80];
-            Config_GetNIC_Protocol(interface, protocol, sizeof(protocol));
-            if (strcmp(protocol, "dhcp") == 0) {
-              nic_change[no] = 1;
-            }
-
-            if (nic[no][5] == NULL) {
-              nic_change[no] = 1;
-            }
-          }
-        } else if (nic[no][5] != NULL) {
-          nic_change[no] = 1;
-        }
-      }
-    }
-  }
-  Config_User_Inktomi(old_euid);
-
-  if (!warning) {
-    if (hn_change) {
-      if (Config_SetHostname(hostname) != 0) {
-        fail = true;
-      }
-    }
-    if (gw_change) {
-      if (Config_SetDefaultRouter(gw_ip) != 0) {
-        fail = true;
-      }
-    }
-    if (dn_change) {
-      if (Config_SetDomain(dn) != 0) {
-        fail = true;
-      }
-    }
-    if (dns_change) {
-      ink_strncpy(dns_ips, "", sizeof(dns_ips));
-      //FIXNOW - do we have no. of dns servers from SysAPI?
-      for (i = 0; i < 3; i++) {
-        if (dns_ip[i] != NULL) {
-          strncat(dns_ips, dns_ip[i], sizeof(dns_ips) - strlen(dns_ips) - 1);
-          strncat(dns_ips, " ", sizeof(dns_ips) - strlen(dns_ips) - 1);
-        }
-      }
-
-      if (Config_SetDNS_Servers(dns_ips) != 0) {
-        fail = true;
-      }
-    }
-    //FIXNOW - get the no. from SysAPI
-    for (i = 0; i < 5; i++) {
-      if (strlen(nic_name[i]) != 0) {
-        if (nic_change[i]) {
-          if (nic[i][0] != NULL && strcmp(nic[i][0], "1") == 0) {
-            char onboot[20], protocol[20];
-            if (strcmp(nic[i][1], "1") == 0) {
-              ink_strncpy(onboot, "onboot", sizeof(onboot));
-            } else {
-              ink_strncpy(onboot, "not-onboot", sizeof(onboot));
-            }
-
-            if (strcmp(nic[i][2], "1") == 0) {
-              ink_strncpy(protocol, "static", sizeof(protocol));
-            } else {
-              ink_strncpy(protocol, "dhcp", sizeof(protocol));
-            }
-            if (Config_SetNIC_Up(nic_name[i], onboot, protocol, nic[i][3], nic[i][4], nic[i][5])
!= 0) {
-              fail = true;
-            }
-          } else {
-            char status[80];
-            Config_GetNIC_Status(nic_name[i], status, sizeof(status));
-            if (strcmp(status, "up") == 0) {    //NIC is disabled
-              if (Config_SetNIC_Down(nic_name[i]) != 0) {
-                fail = true;
-              }
-            } else {            //NIC is down&changed, such changes are disallowed.
-              if (!(whc->request_state & WEB_HTTP_STATE_SUBMIT_WARN)) {
-                HtmlRndrText(whc->submit_warn, whc->lang_dict_ht, HTML_ID_NETWORK_CONFIG_DISALLOW);
-                HtmlRndrBr(whc->submit_warn);
-              }
-              whc->request_state |= WEB_HTTP_STATE_SUBMIT_WARN;
-            }
-          }                     //nic[i][0]
-        }                       //nic_change
-      }                         //nic_name
-    }                           //for
-  }                             //warning
-//FIXME, need a complete fail message system
-  if (fail == true) {
-    if (!(whc->request_state & WEB_HTTP_STATE_SUBMIT_WARN)) {
-      HtmlRndrText(whc->submit_warn, whc->lang_dict_ht, HTML_ID_NETWORK_CONFIG_FAIL);
-      HtmlRndrBr(whc->submit_warn);
-    }
-    whc->request_state |= WEB_HTTP_STATE_SUBMIT_WARN;
-  }
-
-  if (hn_change) {
-    if (submit_from_page)
-      xfree(submit_from_page);
-    submit_from_page = xstrdup("/rename.ink");
-  }
-#endif
-  return WebHttpRender(whc, submit_from_page);
-}
-
 
 //-------------------------------------------------------------------------
 // read_request
@@ -1602,7 +1225,6 @@ WebHttpInit()
   g_submit_bindings_ht = ink_hash_table_create(InkHashTableKeyType_String);
   ink_hash_table_insert(g_submit_bindings_ht, HTML_SUBMIT_ALARM_FILE, (void *) handle_submit_alarm);
   ink_hash_table_insert(g_submit_bindings_ht, HTML_SUBMIT_VIEW_LOGS_FILE, (void *) handle_submit_view_logs);
-  ink_hash_table_insert(g_submit_bindings_ht, HTML_SUBMIT_NET_CONFIG, (void *) handle_submit_net_config);
   // initialize file bindings
   g_file_bindings_ht = ink_hash_table_create(InkHashTableKeyType_String);
   ink_hash_table_insert(g_file_bindings_ht, HTML_CHART_FILE, (void *) handle_chart);



Mime
View raw message