@@ -338,6 +338,11 @@ private function get_cookie_domain() {
338338 if ($ proxy_panel_allowed == 'all ' ) {
339339 return '' ;
340340 }
341+ /*
342+ * See ticket #5238: It should be ensured, that _SERVER_NAME is always set.
343+ * Otherwise the security improvement doesn't work with nginx. If this is done,
344+ * the check for HTTP_HOST and workaround for nginx is obsolete.
345+ */
341346 $ cookie_domain = (isset ($ _SERVER ['SERVER_NAME ' ]) ? $ _SERVER ['SERVER_NAME ' ] : $ _SERVER ['HTTP_HOST ' ]);
342347 // Workaround for Nginx servers
343348 if ($ cookie_domain == '_ ' ) {
@@ -348,6 +353,7 @@ private function get_cookie_domain() {
348353 if ($ proxy_panel_allowed == 'sites ' ) {
349354 $ forwarded_host = (isset ($ _SERVER ['HTTP_X_FORWARDED_HOST ' ]) ? $ _SERVER ['HTTP_X_FORWARDED_HOST ' ] : null );
350355 if ($ forwarded_host !== null && $ forwarded_host !== $ cookie_domain ) {
356+ // Just check for complete domain name and not auto subdomains
351357 $ sql = "SELECT domain_id from web_domain where domain = ' $ forwarded_host' " ;
352358 $ recs = $ this ->db ->queryOneRecord ($ sql );
353359 if ($ recs !== null ) {
@@ -365,7 +371,8 @@ private function get_cookie_domain() {
365371//** Initialize application (app) object
366372//* possible future = new app($conf);
367373$ app = new app ();
368- /* split session creation out of constructor is IMHO better.
374+ /*
375+ split session creation out of constructor is IMHO better.
369376 otherwise we have some circular references to global $app like in
370377 getconfig property of App - RA
371378*/
0 commit comments