security::configured_locations (private)

 security::configured_locations [ -suppress_http_port ] \
    [ -secure_conn ]

Defined in packages/acs-tcl/tcl/security-procs.tcl

This function returns the configured locations. When the package parameter "SuppressHttpPort" of acs-tcl parameter is true, then an alternate location without a port is included. This proc also assumes hostnames from host_node_map table are accurate and legit. The term location refers to "protocol://domain:port" for website.

Switches:
-suppress_http_port (optional, boolean, defaults to "false")
-secure_conn (optional, boolean, defaults to "false")
Returns:
list of locations

Partial Call Graph (max 5 caller/called nodes):
%3 security::locations security::locations (public) security::configured_locations security::configured_locations security::locations->security::configured_locations acs::icanuse acs::icanuse (public) security::configured_locations->acs::icanuse db_list db_list (public) security::configured_locations->db_list security::configured_driver_info security::configured_driver_info (public) security::configured_locations->security::configured_driver_info util::join_location util::join_location (public) security::configured_locations->util::join_location

Testcases:
No testcase defined.
Source code:
    set locations [list]
    set portless_locations {}
    #
    # Get configuration information from the configured servers.
    #
    set driver_info [security::configured_driver_info]
    foreach d $driver_info {
        #
        # port == 0 means that the driver is just used for sending,
        # but not for receiving. In this case, this entry is not
        # regarded as a valid location.
        #
        if {[dict get $d port] != 0} {
            #
            # Add configured locations (deprecated, since this
            # conflicts with the concept of virtual servers).
            #
            set location [dict get $d location]
            if {$location ne "" && $location ni $locations} {
                lappend locations $location
            }

            set hosts [dict get $d host]
            if {[acs::icanuse "ns_set values"]} {
                set virtualservers  [ns_configsection ns/module/[dict get $d driver]/servers]
                if {$virtualservers ne ""} {
                    lappend hosts {*}[ns_set values $virtualservers]
                }
            }
            foreach entry $hosts {
                #
                # The value of the "DRIVER/servers" section might
                # contain also a port.
                #
                set d1 [dict merge $d [ns_parsehostport $entry]]
                set proto [dict get $d proto]
                set host [dict get $d1 host]
                set port [dict get $d1 port]
                if {$host in {0.0.0.0 ::}} {
                    #
                    # Don't add INADDR_ANY to locations
                    #
                    continue
                }
                #
                # Add always a variant with the omitted default port.
                #
                if {($proto eq "https" && $port eq "443")
                    || ($proto eq "http" && $port eq "80")
                } {
                    set location [util::join_location -proto $proto -hostname $host]
                    if {$location ni $locations} {
                        lappend locations $location
                    }
                }
                #
                # Add a variant with the omitted port to
                # portless_locations.
                #
                set location [util::join_location -proto $proto -hostname $host]
                if {$location ni $portless_locations
                    && $location ni $locations
                } {
                    lappend portless_locations $location
                }
                #
                # Add always a variant with the port to locations.
                #
                set location [util::join_location -proto $proto -hostname $host -port $port]
                if {$location ni $locations} {
                    lappend locations $location
                }
            }
        }
    }

    #
    # Add locations from host_node_map
    #
    set host_node_map_hosts_list  [db_list get_node_host_names {select host from host_node_map}]

    if { [llength $host_node_map_hosts_list] > 0 } {
        if { $suppress_http_port_p } {
            foreach hostname $host_node_map_hosts_list {
                lappend locations "http://${hostname}"
                if {$secure_conn_p} {
                    lappend locations "https://${hostname}"
                }
            }
        } else {
            foreach hostname $host_node_map_hosts_list {
                foreach d $driver_info {
                    if {[dict get $d proto] eq "http"} {
                        lappend locations "http://${hostname}[dict get $d suffix]"
                    }
                }
                if {$secure_conn_p} {
                    foreach d $driver_info {
                        if {[dict get $d proto] eq "https"} {
                            lappend locations "https://${hostname}[dict get $d suffix]"
                        }
                    }
                }
            }
        }
    }

    if {$suppress_http_port_p} {
        lappend locations {*}$portless_locations
    }

    return $locations
Generic XQL file:
packages/acs-tcl/tcl/security-procs.xql

PostgreSQL XQL file:
packages/acs-tcl/tcl/security-procs-postgresql.xql

Oracle XQL file:
packages/acs-tcl/tcl/security-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: