Index: openacs-4/packages/acs-tcl/tcl/security-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/security-procs.tcl,v diff -u -N -r1.78.2.39 -r1.78.2.40 --- openacs-4/packages/acs-tcl/tcl/security-procs.tcl 1 Dec 2016 14:37:42 -0000 1.78.2.39 +++ openacs-4/packages/acs-tcl/tcl/security-procs.tcl 29 Dec 2016 19:42:48 -0000 1.78.2.40 @@ -1930,20 +1930,38 @@ # # Check against the virtual server configuration of NaviServer. # - if {[ns_info name] ne "NaviServer"} { - foreach s [ns_info servers] { - foreach driver {nssock nsssl} { - set section [ns_driversection -driver $driver -server $s] - if {$section eq ""} continue - set vloc [ns_config ns/module/$driver/servers $s] - if {$vloc ne "" - && [util::split_location $vloc .proto vHost vPort] - && $vHost eq $hostName - } { - set $key 1 - return $host - } + if {[ns_info name] eq "NaviServer"} { + set s [ns_info server] + foreach driver {nssock nssock_v6 nssock_v4 nsssl} { + # + # Check ns_driversection for the current server + # + set section [ns_driversection -driver $driver -server $s] + if {$section eq ""} continue + set vloc [ns_config ns/module/$driver/servers $s] + if {$vloc ne "" + && [util::split_location $vloc .proto vHost vPort] + && $vHost eq $hostName + } { + ns_log notice "security::validated_host_header: found $host via config section" + set $key 1 + return $host } + # + # Check global driver installation with virtual servers + # + set section [ns_configsection ns/module/$driver/servers] + if {$section eq ""} continue + set names {} + foreach {key value} [ns_set array $section] { + if {$key ne $s} continue + lappend names $value + } + if {$host in $names} { + ns_log notice "security::validated_host_header: found $host via virtual server configuration" + set $key 1 + return $host + } } }