Commit 91738e64 authored by Romain Therville's avatar Romain Therville 🐭

Fix for class.tx_nG6_eid.php

There was a if( xxx = yyy) instead of a if( xxx == yyy) in
class.tx_nG6_eid.php .

PS: If asked, I will deny everything.

issue #151
parent 52ac101a
......@@ -622,7 +622,53 @@ class tx_nG6_eid {
}
}
else if ($type == 'check_ssh_user'){
$user_login = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('user_login'));
$user_pwd = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('user_pwd'));
$project_id = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('project_id'));
$path_to_check = tx_nG6_utils::get_project_data_save_dir($project_id);
$res = 3;
// check login and password
if (isset($user_login) && isset($user_pwd) && $user_login != 'undefined' && $user_pwd != 'undefined') {
$ssh_command = 'touch '.$path_to_check.'/test ; rm -f '.$path_to_check.'/test' ;
$connection = ssh2_connect('127.0.0.1', 22);
if (!$connection) {
//1st test, basic SSH connection
$res = 3;
} else if( !ssh2_auth_password($connection, $user_login,$user_pwd ) ){
//2nd test, SSH connection with user + pwd
$res = 2;
}else{
//3rd test, excuting the SSH command
$stream = ssh2_exec($connection, $ssh_command );
$errorStream = ssh2_fetch_stream($stream, SSH2_STREAM_STDERR);
// Enable blocking for both streams
stream_set_blocking($errorStream, true);
stream_set_blocking($stream, true);
if(stream_get_contents($errorStream)) {
// Close the streams
fclose($errorStream);
fclose($stream);
$res = 4;
}else{
fclose($errorStream);
fclose($stream);
$res = 0;
}
}
} else {
//The user and/or password is missing
$res = 3;
}
print $res;
}
else if ( $type == 'add_to_ng6_admin'){
$userid = trim(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('userid'));
tx_nG6_db::add_to_ng6_admin($userid);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment