<%! 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; %> Active Services <% if (what == "add_serv") { struct icm_service_info_type icp_serv; icp_serv.protocol = anumenc(__icm_get_form_field ("prot")); icp_serv.service = anumenc(__icm_get_form_field ("serv")); icp_serv.hostname = fqhnenc(__icm_get_form_field ("host")); icp_serv.keep_alive = __icm_get_form_field ("keep_alive"); icp_serv.proc_timeout = __icm_get_form_field ("proc_timeout"); icp_serv.verify_client = 1; icp_serv.virt_host_idx = -1; token = __icm_get_form_field ("token"); if (__icm_get_form_field ("active") == "X") icp_serv.active = TRUE; if (__icm_get_form_field ("bind_to_host") == "X") icp_serv.bind_to_host = TRUE; if (__icm_get_form_field ("ext_bind") == "X") icp_serv.ext_bind = TRUE; if (__icm_get_form_field ("smtp_tls") == "2") icp_serv.smtp_tls = 2; else if (__icm_get_form_field ("smtp_tls") == "1") icp_serv.smtp_tls = 1; else icp_serv.smtp_tls = 0; icp_serv.aclfile = __icm_get_form_field ("aclfile"); icp_serv.authmechanisms = __icm_get_form_field ("authmechanisms"); icp_serv.authusers = __icm_get_form_field ("authusers"); servno = icp_serv.service; if ((icp_serv.protocol == "") || (icp_serv.service == "")) { msg = "Not all required data specified"; icon = "s_m_warn.gif"; } else if ((servno < 0) || (servno > 65536)) { msg = "Illegal value specified"; icon = "s_m_warn.gif"; } else { rc = __icm_execute (4, icp_serv, token); if (rc == 0) { msg = "Service successfully created"; icon = "s_m_info.gif"; } else if (rc == -11) { msg = "Session timeout. Please retry operation."; icon = "s_m_warn.gif"; } else { msg = "Service could not be created: " + __icm_get_error_text(rc) + "(" + rc + ")"; icon = "s_m_erro.gif"; } } %>
Information
 
 
<%=msg%>
 
 
Back

<% } 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); } } %>

<% if (bind_to_host) { %> <% } else { %> <% } %>
Confirm operation
 
 
Do you really want to <%=opstr%> the service <%=host%>:<%=serv%> (<%=prot%>)?
 
 
  Yes No  

<% } 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%>
 
 
Back

<% } else { serv_count = __icm_get_serv_info(icm_serv_info); if ((row < 0) || (row > serv_count)) row = 0; %>

<% if (icm_serv_info[row].bind_to_host) { %> <% } else { %> <% } %> <% for (nr = 0; nr < serv_count; nr++) { if ((what == "change_serv") && (nr == row)) { %> <% if (icm_serv_info[nr].active) is_checked = "checked"; else is_checked = ""; %> <% if (icm_serv_info[nr].bind_to_host) is_checked = "checked"; else is_checked = ""; %> <% if (icm_serv_info[nr].ext_bind) is_checked = "checked"; else is_checked = ""; %> <% if (icm_serv_info[nr].protocol == "SMTP") tls_string = icm_serv_info[nr].smtp_tls; else tls_string = "-"; %> <% } else { if (row == nr) is_checked = "checked"; else is_checked = ""; %> <% if (icm_serv_info[nr].active) { %> <% } else { %> <% } %> <% if (icm_serv_info[nr].bind_to_host) { %> <% } else { %> <% } %> <% if (icm_serv_info[nr].ext_bind) { %> <% } else { %> <% } %> <% if (icm_serv_info[nr].protocol == "SMTP") tls_string = icm_serv_info[nr].smtp_tls; else tls_string = "-"; %> <% } } %> <% if (what == "show_add_serv") { %> <% } %>
Active Services Refresh
  Active Protocol Services / Port Hostname / Port Keep Alive Proc Timeout Bind to host Ext Bind SMTP over TLS ACL File Authmechanisms Authusers
> > >
> Activated-<%= icm_serv_info[nr].protocol %> <%= icm_serv_info[nr].service %> <%= icm_serv_info[nr].hostname %> <%= icm_serv_info[nr].keep_alive %> <%= icm_serv_info[nr].proc_timeout %>Activated--<%= tls_string %> <%= icm_serv_info[nr].aclfile %> <%= icm_serv_info[nr].authmechanisms %> <%= icm_serv_info[nr].authusers %>
<% if (what == "show_add_serv") { token = __icm_get_token(4); %>

Add New Service Cancel <% } else if (what == "change_serv") { token = __icm_get_token(6); %>

Change Service Cancel <% } else if (is_admin) { %>

Change Service Add Service Activate/Deactivate Service Delete Service <% } %>

<% } %>