From da926e0d14d6ca6fa065ad8088868d0103383e10 Mon Sep 17 00:00:00 2001 From: dancapper Date: Tue, 27 Sep 2016 17:26:58 +1300 Subject: [PATCH 1/5] Allow use of sockets - homer_mysql_rotate.pl Allow use of mysql socket to connect to database --- scripts/homer_mysql_rotate.pl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/homer_mysql_rotate.pl b/scripts/homer_mysql_rotate.pl index c64f11c..cf1aa7d 100755 --- a/scripts/homer_mysql_rotate.pl +++ b/scripts/homer_mysql_rotate.pl @@ -207,10 +207,14 @@ END sub db_connect { my $CONFIG = shift; my $db_name = shift; - - my $db = DBI->connect("DBI:mysql:".$CONFIG->{"MYSQL"}{$db_name}.":".$CONFIG->{"MYSQL"}{"host"}.":".$CONFIG->{"MYSQL"}{"port"}, $CONFIG->{"MYSQL"}{"user"}, $CONFIG->{"MYSQL"}{"password"}); + my $dbi = "" + if($CONFIG->{"MYSQL"}{$usesocket}) { + $dbi = "DBI:mysql:database=".$CONFIG->{"MYSQL"}{$db_name}.";mysql_socket=".$CONFIG->{"MYSQL"}{$socket) + } else { + $dbi = "DBI:mysql:".$CONFIG->{"MYSQL"}{$db_name}.":".$CONFIG->{"MYSQL"}{"host"}.":".$CONFIG->{"MYSQL"}{"port"} + } + my $db = DBI->connect($dbi, $CONFIG->{"MYSQL"}{"user"}, $CONFIG->{"MYSQL"}{"password"}); return $db; - } sub calculate_gmt_offset { From 2933b39c0d80291370703deec6c2c39bce633d95 Mon Sep 17 00:00:00 2001 From: dancapper Date: Tue, 27 Sep 2016 17:28:14 +1300 Subject: [PATCH 2/5] Allow use of sockets - homer_mysql_remove_partitions.pl --- scripts/homer_mysql_remove_partitions.pl | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/scripts/homer_mysql_remove_partitions.pl b/scripts/homer_mysql_remove_partitions.pl index fa48973..8dbaf40 100755 --- a/scripts/homer_mysql_remove_partitions.pl +++ b/scripts/homer_mysql_remove_partitions.pl @@ -158,10 +158,15 @@ sub read_config { } sub db_connect { - my $CONFIG = shift; - my $db_name = shift; - - my $db = DBI->connect("DBI:mysql:".$CONFIG->{"MYSQL"}{$db_name}.":".$CONFIG->{"MYSQL"}{"host"}.":".$CONFIG->{"MYSQL"}{"port"}, $CONFIG->{"MYSQL"}{"user"}, $CONFIG->{"MYSQL"}{"password"}); - return $db; + my $CONFIG = shift; + my $db_name = shift; + my $dbi = "" + if($CONFIG->{"MYSQL"}{$usesocket}) { + $dbi = "DBI:mysql:database=".$CONFIG->{"MYSQL"}{$db_name}.";mysql_socket=".$CONFIG->{"MYSQL"}{$socket) + } else { + $dbi = "DBI:mysql:".$CONFIG->{"MYSQL"}{$db_name}.":".$CONFIG->{"MYSQL"}{"host"}.":".$CONFIG->{"MYSQL"}{"port"} + } + my $db = DBI->connect($dbi, $CONFIG->{"MYSQL"}{"user"}, $CONFIG->{"MYSQL"}{"password"}); + return $db; } From 41c1875297ab9ac45e3c3a185d9f580c2701b315 Mon Sep 17 00:00:00 2001 From: dancapper Date: Tue, 27 Sep 2016 17:31:16 +1300 Subject: [PATCH 3/5] Allow use of sockets - rotation.ini --- scripts/rotation.ini | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/rotation.ini b/scripts/rotation.ini index c6e3ff6..2236dc3 100644 --- a/scripts/rotation.ini +++ b/scripts/rotation.ini @@ -1,10 +1,12 @@ #Rotation parameters [MYSQL] - user=homer_user - password=homer_password - host=localhost - port=3306 + user = homer_user + password = homer_password + host = localhost + port = 3306 + usesocket = 1 + socket = /var/run/mysqld/mysqld.sock db_data = homer_data db_stats = homer_statistic # Extra param From ce3afb24e05b12d26e6f6b6bec5efc4a2a07c687 Mon Sep 17 00:00:00 2001 From: dancapper Date: Tue, 27 Sep 2016 17:31:16 +1300 Subject: [PATCH 4/5] Fixed some syntax errors --- scripts/homer_mysql_remove_partitions.pl | 8 ++++---- scripts/homer_mysql_rotate.pl | 8 ++++---- scripts/rotation.ini | 10 ++++++---- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/scripts/homer_mysql_remove_partitions.pl b/scripts/homer_mysql_remove_partitions.pl index 8dbaf40..4e88ec9 100755 --- a/scripts/homer_mysql_remove_partitions.pl +++ b/scripts/homer_mysql_remove_partitions.pl @@ -160,13 +160,13 @@ sub read_config { sub db_connect { my $CONFIG = shift; my $db_name = shift; - my $dbi = "" - if($CONFIG->{"MYSQL"}{$usesocket}) { - $dbi = "DBI:mysql:database=".$CONFIG->{"MYSQL"}{$db_name}.";mysql_socket=".$CONFIG->{"MYSQL"}{$socket) + my $dbistring = "" + if($CONFIG->{"MYSQL"}{"usesocket"}) { + $dbi = "DBI:mysql:database=".$CONFIG->{"MYSQL"}{$db_name}.";mysql_socket=".$CONFIG->{"MYSQL"}{"socket"} } else { $dbi = "DBI:mysql:".$CONFIG->{"MYSQL"}{$db_name}.":".$CONFIG->{"MYSQL"}{"host"}.":".$CONFIG->{"MYSQL"}{"port"} } - my $db = DBI->connect($dbi, $CONFIG->{"MYSQL"}{"user"}, $CONFIG->{"MYSQL"}{"password"}); + my $db = DBI->connect($dbistring, $CONFIG->{"MYSQL"}{"user"}, $CONFIG->{"MYSQL"}{"password"}); return $db; } diff --git a/scripts/homer_mysql_rotate.pl b/scripts/homer_mysql_rotate.pl index cf1aa7d..49f52f4 100755 --- a/scripts/homer_mysql_rotate.pl +++ b/scripts/homer_mysql_rotate.pl @@ -207,13 +207,13 @@ END sub db_connect { my $CONFIG = shift; my $db_name = shift; - my $dbi = "" - if($CONFIG->{"MYSQL"}{$usesocket}) { - $dbi = "DBI:mysql:database=".$CONFIG->{"MYSQL"}{$db_name}.";mysql_socket=".$CONFIG->{"MYSQL"}{$socket) + my $dbistring = "" + if($CONFIG->{"MYSQL"}{"usesocket"}) { + $dbi = "DBI:mysql:database=".$CONFIG->{"MYSQL"}{$db_name}.";mysql_socket=".$CONFIG->{"MYSQL"}{"socket"} } else { $dbi = "DBI:mysql:".$CONFIG->{"MYSQL"}{$db_name}.":".$CONFIG->{"MYSQL"}{"host"}.":".$CONFIG->{"MYSQL"}{"port"} } - my $db = DBI->connect($dbi, $CONFIG->{"MYSQL"}{"user"}, $CONFIG->{"MYSQL"}{"password"}); + my $db = DBI->connect($dbistring, $CONFIG->{"MYSQL"}{"user"}, $CONFIG->{"MYSQL"}{"password"}); return $db; } diff --git a/scripts/rotation.ini b/scripts/rotation.ini index c6e3ff6..2236dc3 100644 --- a/scripts/rotation.ini +++ b/scripts/rotation.ini @@ -1,10 +1,12 @@ #Rotation parameters [MYSQL] - user=homer_user - password=homer_password - host=localhost - port=3306 + user = homer_user + password = homer_password + host = localhost + port = 3306 + usesocket = 1 + socket = /var/run/mysqld/mysqld.sock db_data = homer_data db_stats = homer_statistic # Extra param From ab3916e4bad3e0799a04c797cb8df3227f99e7a7 Mon Sep 17 00:00:00 2001 From: dcapper Date: Wed, 19 Oct 2016 16:52:32 +1300 Subject: [PATCH 5/5] Change one instance of split() to explode() for PHP 7.0 Compatibility as split() was deprecated in 5.3.0 and removed in 7.0.0 http://php.net/manual/en/function.split.php --- api/Authentication/LDAP.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/api/Authentication/LDAP.php b/api/Authentication/LDAP.php index cb2a9d3..653af2e 100644 --- a/api/Authentication/LDAP.php +++ b/api/Authentication/LDAP.php @@ -112,13 +112,10 @@ function logIn($param) { $_SESSION['username'] = $user['username']; $_SESSION['gid'] = $user['gid']; $_SESSION['grp'] = "users"; - $_SESSION['data'] = $user; - - - // Assigne Admin Privs, should be read from the LDAP Directory in the future - $ADMIN_USER = split(",", LDAP_ADMIN_USER); + // Assign Admin Privs, should be read from the LDAP Directory in the future + $ADMIN_USER = explode(",", LDAP_ADMIN_USER); foreach($ADMIN_USER as &$value) { if ($value == $param['username']) { @@ -132,7 +129,6 @@ function logIn($param) { } } } - return array(); } @@ -176,7 +172,6 @@ function getUser() { return $_SESSION['data']; } - //create random password with 8 alphanumerical characters function createPassword() {