X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FConfig%2FNix.git;a=blobdiff_plain;f=overlays%2Fshaarli%2Fshaarli_ldap.patch;fp=overlays%2Fshaarli%2Fshaarli_ldap.patch;h=e66a54f5e22663f22c66e2fd53bd83ca5f586d68;hp=9c7315a13b665f57fe3cd0c12ccf8009e1d42a87;hb=5752291a58832f05ffd6c9ccfb7bfd0fe93f535a;hpb=c5f1602f941d34ad1f9e7bdb69678d0c844c9db6 diff --git a/overlays/shaarli/shaarli_ldap.patch b/overlays/shaarli/shaarli_ldap.patch index 9c7315a..e66a54f 100644 --- a/overlays/shaarli/shaarli_ldap.patch +++ b/overlays/shaarli/shaarli_ldap.patch @@ -1,4 +1,4 @@ -commit bc82ebfd779b8641dadd6787f51639ea9105c3e8 +commit a19c24edc1057bd411821f9e3e7d1d309d38b1bb Author: Ismaël Bouya Date: Sun Feb 3 20:58:18 2019 +0100 @@ -268,10 +268,10 @@ index b8b8ab8..5eb4aac 100644 } diff --git a/index.php b/index.php -index 4b86a3e..85376e8 100644 +index 4b86a3e..58ae2dd 100644 --- a/index.php +++ b/index.php -@@ -121,7 +121,27 @@ +@@ -121,7 +121,32 @@ $_COOKIE['shaarli'] = session_id(); } @@ -292,6 +292,11 @@ index 4b86a3e..85376e8 100644 + exit; +} + ++if (!isset($userspace) && isset($_POST["login"])) { ++ $userspace = preg_replace("/[^-_A-Za-z0-9]/", '', $_POST["login"]); ++ error_log("debugImmae: setting userspace from POST: " . $userspace); ++} ++ +if (isset($userspace)) { + $conf = new ConfigManager(null, $userspace); +} else { @@ -300,7 +305,7 @@ index 4b86a3e..85376e8 100644 $sessionManager = new SessionManager($_SESSION, $conf); $loginManager = new LoginManager($GLOBALS, $conf, $sessionManager); $loginManager->generateStaySignedInToken($_SERVER['REMOTE_ADDR']); -@@ -175,7 +195,7 @@ +@@ -175,7 +200,7 @@ } // Display the installation form if no existing config is found @@ -309,7 +314,7 @@ index 4b86a3e..85376e8 100644 } $loginManager->checkLoginState($_COOKIE, $clientIpId); -@@ -205,6 +225,7 @@ function isLoggedIn() +@@ -205,6 +230,7 @@ function isLoggedIn() && $loginManager->checkCredentials($_SERVER['REMOTE_ADDR'], $clientIpId, $_POST['login'], $_POST['password']) ) { $loginManager->handleSuccessfulLogin($_SERVER); @@ -317,7 +322,7 @@ index 4b86a3e..85376e8 100644 $cookiedir = ''; if (dirname($_SERVER['SCRIPT_NAME']) != '/') { -@@ -241,25 +262,25 @@ function isLoggedIn() +@@ -241,25 +267,25 @@ function isLoggedIn() $uri .= '&'.$param.'='.urlencode($_GET[$param]); } } @@ -348,7 +353,7 @@ index 4b86a3e..85376e8 100644 $redir = '&username='. urlencode($_POST['login']); if (isset($_GET['post'])) { $redir .= '&post=' . urlencode($_GET['post']); -@@ -270,7 +291,7 @@ function isLoggedIn() +@@ -270,7 +296,7 @@ function isLoggedIn() } } // Redirect to login screen. @@ -357,7 +362,7 @@ index 4b86a3e..85376e8 100644 exit; } } -@@ -1719,7 +1740,7 @@ function buildLinkList($PAGE, $LINKSDB, $conf, $pluginManager, $loginManager) +@@ -1719,7 +1745,7 @@ function buildLinkList($PAGE, $LINKSDB, $conf, $pluginManager, $loginManager) * @param SessionManager $sessionManager SessionManager instance * @param LoginManager $loginManager LoginManager instance */ @@ -366,7 +371,7 @@ index 4b86a3e..85376e8 100644 // On free.fr host, make sure the /sessions directory exists, otherwise login will not work. if (endsWith($_SERVER['HTTP_HOST'],'.free.fr') && !is_dir($_SERVER['DOCUMENT_ROOT'].'/sessions')) mkdir($_SERVER['DOCUMENT_ROOT'].'/sessions',0705); -@@ -1755,7 +1776,7 @@ function install($conf, $sessionManager, $loginManager) { +@@ -1755,7 +1781,7 @@ function install($conf, $sessionManager, $loginManager) { } @@ -375,7 +380,7 @@ index 4b86a3e..85376e8 100644 { $tz = 'UTC'; if (!empty($_POST['continent']) && !empty($_POST['city']) -@@ -1764,15 +1785,15 @@ function install($conf, $sessionManager, $loginManager) { +@@ -1764,15 +1790,15 @@ function install($conf, $sessionManager, $loginManager) { $tz = $_POST['continent'].'/'.$_POST['city']; } $conf->set('general.timezone', $tz); @@ -395,7 +400,7 @@ index 4b86a3e..85376e8 100644 } $conf->set('translation.language', escape($_POST['language'])); $conf->set('updates.check_updates', !empty($_POST['updateCheck'])); -@@ -1841,7 +1862,12 @@ function install($conf, $sessionManager, $loginManager) { +@@ -1841,7 +1867,12 @@ function install($conf, $sessionManager, $loginManager) { $app = new \Slim\App($container); // REST API routes @@ -409,7 +414,7 @@ index 4b86a3e..85376e8 100644 $this->get('/info', '\Shaarli\Api\Controllers\Info:getInfo')->setName('getInfo'); $this->get('/links', '\Shaarli\Api\Controllers\Links:getLinks')->setName('getLinks'); $this->get('/links/{id:[\d]+}', '\Shaarli\Api\Controllers\Links:getLink')->setName('getLink'); -@@ -1860,7 +1886,7 @@ function install($conf, $sessionManager, $loginManager) { +@@ -1860,7 +1891,7 @@ function install($conf, $sessionManager, $loginManager) { $response = $app->run(true); // Hack to make Slim and Shaarli router work together: // If a Slim route isn't found and NOT API call, we call renderPage().