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() { diff --git a/scripts/homer_mysql_remove_partitions.pl b/scripts/homer_mysql_remove_partitions.pl index fa48973..5163537 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 $dbistring = ""; + if($CONFIG->{"MYSQL"}{"usesocket"}) { + $dbistring = "DBI:mysql:database=".$CONFIG->{"MYSQL"}{$db_name}.";mysql_socket=".$CONFIG->{"MYSQL"}{"socket"} + } else { + $dbistring = "DBI:mysql:".$CONFIG->{"MYSQL"}{$db_name}.":".$CONFIG->{"MYSQL"}{"host"}.":".$CONFIG->{"MYSQL"}{"port"} + } + 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 c64f11c..f16c006 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 $dbistring = ""; + if($CONFIG->{"MYSQL"}{"usesocket"}) { + $dbistring = "DBI:mysql:database=".$CONFIG->{"MYSQL"}{$db_name}.";mysql_socket=".$CONFIG->{"MYSQL"}{"socket"} + } else { + $dbistring = "DBI:mysql:".$CONFIG->{"MYSQL"}{$db_name}.":".$CONFIG->{"MYSQL"}{"host"}.":".$CONFIG->{"MYSQL"}{"port"} + } + my $db = DBI->connect($dbistring, $CONFIG->{"MYSQL"}{"user"}, $CONFIG->{"MYSQL"}{"password"}); return $db; - } sub calculate_gmt_offset { 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