vendredi 30 avril 2010

WebSSO (lemonLDAP) pour Centreon

Patch pour utiliser le WebSSO de LemonLDAP sur Centreon (2.1.6).

index.php (
Insérer avant  la  ligne 136 (

avant
if (isset($_POST["submit"]) || (isset($_GET["autologin"]) )
...

après
/// PATCH EDT
    if (isset($_SERVER['REMOTE_USER'])) {
                list( $KerbUser, $KerbDomain) = split("@",$_SERVER['REMOTE_USER']);

                $res =& $pearDB->query("SELECT * FROM contact WHERE contact_alias='". $_SERVER['REMOTE_USER']  ."' AND contact_activate = '1' LIMIT 1");
                if($res->numRows()) {
                        $res2 =& $pearDB->query("SELECT nagios_version FROM general_opt");
                        $version = $res2->fetchRow();
                        $user =& new User($res->fetchRow(), $version["nagios_version"]);
                        $oreon = new Oreon($user);
                        $_SESSION["oreon"] =& $oreon;
                        $pearDB->query("INSERT INTO `session` (`session_id` , `user_id` , `current_page` , `last_reload`, `ip_address`) VALUES ('".session_id()."', '".$oreon->user->user_id."', '1', '".time()."', '".$_SERVER["REMOTE_ADDR"]."')");
                        if (!isset($_POST["submit"]))   {
                                $args = NULL;
                                foreach($_GET as $key=>$value)
                                        $args ? $args .= "&".$key."=".$value : $args = $key."=".$value;
                                header("Location: ./main.php?".$args."");
                        } else {
                                header("Location: ./main.php");
                        }
                                $connect = true;
                }
        }
        //// END autologin with Kerberos
        elseif (isset($_POST["submit"]) || (isset($_GET["autologin"]) && isset($_GET["p"]) && $_GET["autologin"])) {

Aucun commentaire:

Enregistrer un commentaire