first update

This commit is contained in:
tuend-work
2025-11-12 20:19:03 +07:00
commit ca56c8cfa5
76 changed files with 10082 additions and 0 deletions

View File

@@ -0,0 +1,89 @@
diff -rupN libraries.orig/common.inc.php libraries/common.inc.php
--- libraries.orig/common.inc.php 2016-03-22 21:46:31.452912951 -0500
+++ libraries/common.inc.php 2016-03-22 21:40:11.699913468 -0500
@@ -728,6 +728,9 @@ if (! defined('PMA_MINIMUM_COMMON')) {
$auth_plugin = new $fqnAuthClass($plugin_manager);
if (! $auth_plugin->authCheck()) {
+ //DA logging
+ log_to_file('', "not authenticated");
+
/* Force generating of new session on login */
if ($token_provided) {
PMA_secureSession();
diff -rupN libraries.orig/logging.lib.php libraries/logging.lib.php
--- libraries.orig/logging.lib.php 2016-03-22 21:46:31.455912989 -0500
+++ libraries/logging.lib.php 2016-03-22 21:39:56.640914141 -0500
@@ -8,6 +8,64 @@
* @package PhpMyAdmin
*/
+define("AUTH_LOG_DIR", "./log");
+define("AUTH_LOG_FILE", "./log/auth.log");
+
+function ensure_log_dir()
+{
+ $LOG_DIR=AUTH_LOG_DIR;
+ if (is_dir($LOG_DIR))
+ return true;
+
+ if (!mkdir($LOG_DIR, 0770))
+ return false;
+}
+
+function log_to_file($user, $status)
+{
+ if (!ensure_log_dir())
+ return false;
+
+ $LOG_FILE=AUTH_LOG_FILE;
+
+ if ($user == '')
+ {
+ $user = PMA_getenv('PHP_AUTH_USER');
+ }
+
+ if ($user == '')
+ return true;
+
+ //remove any ' characters from $user
+ $user = urlencode($user);
+
+ //check for logout
+ if ($status == 'not authenticated')
+ {
+ if (isset($_GET['old_usr']) && isset($_SERVER['PHP_AUTH_USER']))
+ {
+ if ($_GET['old_usr'] == $_SERVER['PHP_AUTH_USER'])
+ {
+ $status = 'logout';
+ }
+ }
+ }
+
+ $log_str = date('M d H:i:s').":: pma auth user='$user' status='$status' ip='".$_SERVER["REMOTE_ADDR"]."'";
+
+ $fp = fopen($LOG_FILE, 'a');
+ if ($fp === false)
+ {
+ //log to apache error log instead
+ error_log($log_str."\n");
+ return;
+ }
+
+ fwrite($fp, $log_str."\n");
+
+ fclose($fp);
+}
+
/**
* Logs user information to webserver logs.
*
@@ -22,5 +80,7 @@ function PMA_logUser($user, $status = 'o
apache_note('userID', $user);
apache_note('userStatus', $status);
}
+
+ log_to_file($user, $status);
}