From 73efa5e94fadcdcf8ed72b0b46ed247b662adc03 Mon Sep 17 00:00:00 2001
From: Brian Weaver <weaver.299@osu.edu>
Date: Mon, 30 Mar 2020 11:51:44 -0400
Subject: [PATCH] SimpleSAML tmp path fix

---
 .../simplesamlphp/simplesamlphp/config/config.php   | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/vendor/simplesamlphp/simplesamlphp/config/config.php b/vendor/simplesamlphp/simplesamlphp/config/config.php
index c4b5de123a..578d36b001 100644
--- a/vendor/simplesamlphp/simplesamlphp/config/config.php
+++ b/vendor/simplesamlphp/simplesamlphp/config/config.php
@@ -6,7 +6,7 @@
 if (empty($_SERVER['PATH_INFO']) && !empty($_SERVER['DOCUMENT_URI'])) {
     $index = strpos($_SERVER['DOCUMENT_URI'], '.php');
     if($index) {
-            $_SERVER['PATH_INFO'] = substr($_SERVER['DOCUMENT_URI'], $index+4);
+      $_SERVER['PATH_INFO'] = substr($_SERVER['DOCUMENT_URI'], $index+4);
     }
 }
 
@@ -22,6 +22,15 @@
 $drop_id = $ps['conf']['pantheon_binding'];
 $db = $ps['databases']['default']['default'];
 
+
+if($_SERVER['HOME'] == '/') {
+  $temp_path = '/tmp';
+}
+else {
+  $temp_path = $_SERVER['HOME'] . '/tmp/simplesaml';
+}
+// error_log("temp_path: " . $temp_path);
+
 //  Set metadata path
 $metadata_folder = __DIR__ . '/../../../../web/sites/default/files/private/simplesamlphp/metadata';
 // error_log("config.php - metadata_folder: $metadata_folder");
@@ -126,7 +135,7 @@
     'certdir' => $cert_folder,
     'loggingdir' => 'log/',
     'datadir' => 'data/',
-    'tempdir'               =>  '/srv/bindings/' . $drop_id . '/tmp/simplesaml',
+    'tempdir'               =>  $temp_path,
     'supressportnumber'     => TRUE,
     'cronkey'				=> '5nvD3MgHLDDStnEKgK0au3vhqEjNNnvkHLmbVWvObIl2lpx0guXx5h',
 
-- 
GitLab