%! struct icm_service_info_type { string protocol; string service; string hostname; boolean bind_to_host; int keep_alive; int proc_timeout; boolean active; boolean ext_bind; int verify_client; int virt_host_idx; string aclfile; int smtp_tls; string authmechanisms; string authusers; }; %> <% int serv_count, servno; int nr, rc, row; int verify_client; string what, browser, fld, is_checked, op, opstr; string url, prot, serv, host, lastControlID; boolean bind_to_host; int smtp_tls; int verify_client; boolean is_admin; struct icm_service_info_type icm_serv_info[]; string token; string msg; string icon; string tls_string; is_admin = __icm_get_system_property ("is_admin"); browser = __icm_get_browser_type(); what = anumenc(__icm_get_form_field ("what")); lastControlID = htmlenc(__icm_get_form_field ("lastControlID")); fld = anumenc(__icm_get_form_field ("row_selected")); if (fld == "") row = 0; else row = fld; %>
Information | |||
<%=msg%> | |||
|
<% } else if ((what == "del_serv") || (what == "toggle_serv")) { serv_count = __icm_get_serv_info(icm_serv_info); if ((row < 0) || (row > serv_count)) row = 0; serv = icm_serv_info[row].service; prot = icm_serv_info[row].protocol; host = icm_serv_info[row].hostname; verify_client = icm_serv_info[row].verify_client; bind_to_host = icm_serv_info[row].bind_to_host; if (what == "del_serv") { op = "do_del_serv"; opstr = "delete"; token = __icm_get_token(5); } else { if (icm_serv_info[row].active) { op = "do_deact_serv"; opstr = "deactivate"; token = __icm_get_token(8); } else { op = "do_act_serv"; opstr = "activate"; token = __icm_get_token(7); } } %>
<% } else if ((what == "do_change_serv") || (what == "do_del_serv") || (what == "do_act_serv") || (what == "do_deact_serv")) { struct icm_service_info_type icp_serv_old; struct icm_service_info_type icp_serv_new; prot = anumenc(__icm_get_form_field ("prot_old")); serv = anumenc(__icm_get_form_field ("serv_old")); host = fqhnenc(__icm_get_form_field ("host_old")); verify_client = anumenc(__icm_get_form_field ("verify_client_old")); token = __icm_get_form_field ("token"); icp_serv_old.protocol = prot; icp_serv_old.service = serv; icp_serv_old.hostname = host; icp_serv_old.verify_client = verify_client; if (__icm_get_form_field ("bind_to_host_old") == "X") icp_serv_old.bind_to_host = TRUE; if (what == "do_change_serv") { opstr = "changed"; icp_serv_new.protocol = anumenc(__icm_get_form_field ("prot")); icp_serv_new.service = anumenc(__icm_get_form_field ("serv")); icp_serv_new.hostname = fqhnenc(__icm_get_form_field ("host")); icp_serv_new.keep_alive = __icm_get_form_field ("keep_alive"); icp_serv_new.proc_timeout = __icm_get_form_field ("proc_timeout"); icp_serv_new.verify_client = icp_serv_old.verify_client; icp_serv_new.virt_host_idx = -1; icp_serv_new.aclfile = __icm_get_form_field ("aclfile"); icp_serv_new.authmechanisms = __icm_get_form_field ("authmechanisms"); icp_serv_new.authusers = __icm_get_form_field ("authusers"); if (__icm_get_form_field ("active") == "X") icp_serv_new.active = TRUE; if (__icm_get_form_field ("bind_to_host") == "X") icp_serv_new.bind_to_host = TRUE; if (__icm_get_form_field ("ext_bind") == "X") icp_serv_new.ext_bind = TRUE; if (__icm_get_form_field ("smtp_tls") == "2") icp_serv_new.smtp_tls = 2; else if (__icm_get_form_field ("smtp_tls") == "1") icp_serv_new.smtp_tls = 1; else icp_serv_new.smtp_tls = 0; servno = icp_serv_new.service; if ((icp_serv_new.protocol == "") || (icp_serv_new.service == "")) rc = -100; else if ((servno < 0) || (servno > 65536)) rc = -101; else rc = __icm_execute (6, icp_serv_old, icp_serv_new, token); } else if (what == "do_del_serv") { opstr = "deleted"; rc = __icm_execute (5, icp_serv_old, token); } else if (what == "do_act_serv") { opstr = "activated"; rc = __icm_execute (7, icp_serv_old, token); } else { opstr = "deactivated"; rc = __icm_execute (8, icp_serv_old, token); } if (rc == 0) { msg = "Service successfully " + opstr; icon = "s_m_info.gif"; } else if (rc == -100) { msg = "Not all required data specified"; icon = "s_m_warn.gif"; } else if (rc == -101) { msg = "Illegal value specified"; icon = "s_m_warn.gif"; } else if (rc == -11) { msg = "Session timeout. Please retry operation."; icon = "s_m_warn.gif"; } else { msg = "Service could not be " + opstr + ": " + __icm_get_error_text(rc) + "(" + rc + ")"; icon = "s_m_erro.gif"; } %>Information | |||
<%=msg%> | |||
|
<% } else { serv_count = __icm_get_serv_info(icm_serv_info); if ((row < 0) || (row > serv_count)) row = 0; %>
<% } %>