m3 Security Fixes
This commit is contained in:
@@ -11,6 +11,12 @@ use Modules\M3\Services\PostgresProgramBridge;
|
||||
|
||||
class userControlController extends Controller
|
||||
{
|
||||
private const AUTH_FAILURE_MESSAGE = 'Could not connect due to wrong user or password.';
|
||||
private const DATABASE_NOT_FOUND_MESSAGE = 'Database not found. Try WRKRDBDIRE to check.';
|
||||
private const CONNECTION_ERROR_PREFIX = 'Could not connect. Error: ';
|
||||
private const PROGRAM_ERROR_PREFIX = 'Error calling program. Code: ';
|
||||
private const MESSAGE_SEPARATOR = ' Msg: ';
|
||||
|
||||
public static function index(Request $request)
|
||||
{
|
||||
$connection = config('m3.connection', 'pgsql');
|
||||
@@ -85,17 +91,17 @@ class userControlController extends Controller
|
||||
case 8001:
|
||||
// "Authorization failure on distributed database connection attempt"
|
||||
// Usually means a wrong DB2 user or password
|
||||
$PGMERRORS = 'Could not connect due to wrong user or password.';
|
||||
$PGMERRORS = self::AUTH_FAILURE_MESSAGE;
|
||||
|
||||
return 'error profile3';
|
||||
break;
|
||||
case 42705:
|
||||
$PGMERRORS = 'Database not found. Try WRKRDBDIRE to check.';
|
||||
$PGMERRORS = self::DATABASE_NOT_FOUND_MESSAGE;
|
||||
|
||||
return 'error profile4';
|
||||
break;
|
||||
default:
|
||||
$PGMERRORS = 'Could not connect. Error: ' . $code . ' ' . $msg;
|
||||
$PGMERRORS = self::CONNECTION_ERROR_PREFIX . $code . ' ' . $msg;
|
||||
|
||||
return 'error profile5';
|
||||
break;
|
||||
@@ -112,7 +118,7 @@ class userControlController extends Controller
|
||||
// # $result = $conn->PgmCall(Config::get('eproconf.misc.PGM1'), Config::get('eproconf.misc.libname4'), $params, array(), array());
|
||||
$result = $conn->PgmCall('ICMUSRPRF', 'EWOBJ', $params, [], []);
|
||||
if (! $result) {
|
||||
$PGMERRORS = 'Error calling program. Code: ' . $conn->getErrorCode() . ' Msg: ' . $conn->getErrorMsg();
|
||||
$PGMERRORS = self::PROGRAM_ERROR_PREFIX . $conn->getErrorCode() . self::MESSAGE_SEPARATOR . $conn->getErrorMsg();
|
||||
|
||||
// echo "<script>alert($PGMERRORS);</script>";
|
||||
return 'error profile2';
|
||||
@@ -200,13 +206,13 @@ class userControlController extends Controller
|
||||
case 8001:
|
||||
// "Authorization failure on distributed database connection attempt"
|
||||
// Usually means a wrong DB2 user or password
|
||||
$PGMERRORS = 'Could not connect due to wrong user or password.';
|
||||
$PGMERRORS = self::AUTH_FAILURE_MESSAGE;
|
||||
break;
|
||||
case 42705:
|
||||
$PGMERRORS = 'Database not found. Try WRKRDBDIRE to check.';
|
||||
$PGMERRORS = self::DATABASE_NOT_FOUND_MESSAGE;
|
||||
break;
|
||||
default:
|
||||
$PGMERRORS = 'Could not connect. Error: ' . $code . ' ' . $msg;
|
||||
$PGMERRORS = self::CONNECTION_ERROR_PREFIX . $code . ' ' . $msg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -240,7 +246,7 @@ class userControlController extends Controller
|
||||
$result = $conn->PgmCall('ICMCHGPRF', 'EWOBJ', $params, [], []);
|
||||
|
||||
if (! $result) {
|
||||
$PGMERRORS = 'Error calling program. Code: ' . $conn->getErrorCode() . ' Msg: ' . $conn->getErrorMsg();
|
||||
$PGMERRORS = self::PROGRAM_ERROR_PREFIX . $conn->getErrorCode() . self::MESSAGE_SEPARATOR . $conn->getErrorMsg();
|
||||
// dump($PGMERRORS);
|
||||
echo "<script>alert($PGMERRORS);</script>";
|
||||
|
||||
@@ -302,13 +308,13 @@ class userControlController extends Controller
|
||||
case 8001:
|
||||
// "Authorization failure on distributed database connection attempt"
|
||||
// Usually means a wrong DB2 user or password
|
||||
$PGMERRORS = 'Could not connect due to wrong user or password.';
|
||||
$PGMERRORS = self::AUTH_FAILURE_MESSAGE;
|
||||
break;
|
||||
case 42705:
|
||||
$PGMERRORS = 'Database not found. Try WRKRDBDIRE to check.';
|
||||
$PGMERRORS = self::DATABASE_NOT_FOUND_MESSAGE;
|
||||
break;
|
||||
default:
|
||||
$PGMERRORS = 'Could not connect. Error: ' . $code . ' ' . $msg;
|
||||
$PGMERRORS = self::CONNECTION_ERROR_PREFIX . $code . ' ' . $msg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -325,7 +331,7 @@ class userControlController extends Controller
|
||||
// echo "<script>alert('After CHGUSRPRF');</script>";
|
||||
|
||||
if (! $result) {
|
||||
$PGMERRORS = 'Error calling program. Code: ' . $conn->getErrorCode() . ' Msg: ' . $conn->getErrorMsg();
|
||||
$PGMERRORS = self::PROGRAM_ERROR_PREFIX . $conn->getErrorCode() . self::MESSAGE_SEPARATOR . $conn->getErrorMsg();
|
||||
dump($PGMERRORS);
|
||||
echo "<script>alert($PGMERRORS);</script>";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user