diff --git a/root/usr/share/smanager/lib/SrvMngr/Controller/Userpanels-Custom.pm b/root/usr/share/smanager/lib/SrvMngr/Controller/Userpanels-Custom.pm index c44e18d..03398c0 100644 --- a/root/usr/share/smanager/lib/SrvMngr/Controller/Userpanels-Custom.pm +++ b/root/usr/share/smanager/lib/SrvMngr/Controller/Userpanels-Custom.pm @@ -7,11 +7,11 @@ # use esmith::util; use esmith::util::network; -use esmith::ConfigDB; -use esmith::HostsDB; -use esmith::AccountsDB; +use esmith::ConfigDB::UTF8; +use esmith::HostsDB::UTF8; +use esmith::AccountsDB::UTF8; use esmith::NetworksDB; -use esmith::DomainsDB; +use esmith::DomainsDB::UTF8; use constant FALSE => 0; use constant TRUE => 1; @@ -82,7 +82,7 @@ use constant users_FIELD_MAPPING => ( sub actual_users { my @ret = (); - my $adb = esmith::AccountsDB->open() or die("Couldn't open Accounts db"); + my $adb = esmith::AccountsDB::UTF8->open() or die("Couldn't open Accounts db"); # Optionally add the local admin user push @ret, { @@ -138,7 +138,7 @@ use constant panels_FIELD_MAPPING => ( sub actual_panels { my $c = shift; my %usp_data = shift; - my $adb = esmith::AccountsDB->open() or die("Couldn't open Accounts db"); + my $adb = esmith::AccountsDB::UTF8->open() or die("Couldn't open Accounts db"); my $accounts_key = $c->param('Selected'); # Pass it back to the template and then back to the perform routine via a hidden field $c->stash(accounts_key=>$accounts_key); @@ -259,7 +259,7 @@ sub get_panels { my $AdminPanels = join(',', @selected); #$c->log->info("Selected IDs: $joined"); #Write back to the property AdminPanels - my $adb = esmith::AccountsDB->open() or die("Couldn't open Accounts db"); + my $adb = esmith::AccountsDB::UTF8->open() or die("Couldn't open Accounts db"); my $accounts_key = $c->param('accounts_key'); #hidden field in form #$c->log->info("AccKey: $accounts_key"); $adb->set_prop($accounts_key,'AdminPanels',$AdminPanels); diff --git a/root/usr/share/smanager/lib/SrvMngr/Controller/Userpanels.pm b/root/usr/share/smanager/lib/SrvMngr/Controller/Userpanels.pm index b57fcc7..a703e3c 100644 --- a/root/usr/share/smanager/lib/SrvMngr/Controller/Userpanels.pm +++ b/root/usr/share/smanager/lib/SrvMngr/Controller/Userpanels.pm @@ -36,11 +36,11 @@ use Data::Dumper; use esmith::util; use esmith::util::network; -use esmith::ConfigDB; -use esmith::AccountsDB; +use esmith::ConfigDB::UTF8; +use esmith::AccountsDB::UTF8; use esmith::NetworksDB; -use esmith::HostsDB; -use esmith::DomainsDB; +use esmith::HostsDB::UTF8; +use esmith::DomainsDB::UTF8; my $cdb; my $adb; @@ -66,11 +66,11 @@ sub main { $c->app->log->info( $c->log_req ); #The most common ones - $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); - $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); + $cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db"); + $adb = esmith::AccountsDB::UTF8->open() || die("Couldn't open Accounts db"); $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); - $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); - $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); + $hdb = esmith::HostsDB::UTF8->open() || die("Couldn't open Hosts db"); + $ddb = esmith::DomainsDB::UTF8->open() || die("Couldn't open Domains db"); my %usp_data = (); my $title = $c->l('usp_User_panel_access_'); @@ -118,25 +118,26 @@ sub do_update { my $modul = ''; #The most common ones - you might want to comment out any not used. - $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); - $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); + $cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db"); + $adb = esmith::AccountsDB::UTF8->open() || die("Couldn't open Accounts db"); $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); - $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); - $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); + $hdb = esmith::HostsDB::UTF8->open() || die("Couldn't open Hosts db"); + $ddb = esmith::DomainsDB::UTF8->open() || die("Couldn't open Domains db"); my %usp_data = (); my $title = $c->l('usp_User_panel_access_'); # Accessing all POST/GET parameters - my $params = $c->req->params->to_hash; + my %params = %{ $c->req->params->to_hash }; + + # Get number of POST parameters correctly + my $num_params = keys %params; + + # Copy params safely + while (my ($key, $value) = each %params) { + $usp_data{$key} = $value; + } - # Get number of POST parameters - #my $num_params = keys scaler %$params; - - #Params are available in the hash "params" - copy to the prefix_data hash - #while (my ($key, $value) = each %{$c->req->params->to_hash}) { - # $usp_data{$key} = $value; - #} # the value of trt will tell you which panel has returned my $trt = $c->param('trt') || 'USERTABLE'; #hidden control on every form. @@ -225,18 +226,19 @@ sub do_display { $c->app->log->info($c->log_req); #The most common ones - you might want to comment out any not used. - $cdb = esmith::ConfigDB->open() || die("Couldn't open config db"); - $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db"); + $cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db"); + $adb = esmith::AccountsDB::UTF8->open() || die("Couldn't open Accounts db"); $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db"); - $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db"); - $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); + $hdb = esmith::HostsDB::UTF8->open() || die("Couldn't open Hosts db"); + $ddb = esmith::DomainsDB::UTF8->open() || die("Couldn't open Domains db"); my %usp_data = (); my $title = $c->l('usp_User_panel_access_'); my $modul = ""; # Accessing all parameters - my %params = $c->req->params->to_hash; + + my %params = %{$c->req->params->to_hash}; # Get number of parameters my $num_params = keys %params; @@ -245,9 +247,9 @@ sub do_display { my $is_new_record = ($c->req->method() eq 'POST'); #Params are available in the hash "params" - copy to the prefix_data hash - #while (my ($key, $value) = each %{$c->req->params->to_hash}) { - # $usp_data{$key} = $value; - #} + while (my ($key, $value) = each %{$c->req->params->to_hash}) { + $usp_data{$key} = $value; + } # the value of trt will tell you which panel has returned if (! $trt){ @@ -314,4 +316,4 @@ sub do_display { ); $c->render(template => "userpanels"); } -1; +1; \ No newline at end of file diff --git a/smeserver-userpanels.spec b/smeserver-userpanels.spec index 9e7877d..0df5ce1 100644 --- a/smeserver-userpanels.spec +++ b/smeserver-userpanels.spec @@ -6,7 +6,7 @@ Summary: Panels to let users to change server settings. %define name smeserver-userpanels Name: %{name} %define version 11.0.0 -%define release 4 +%define release 5 Version: %{version} Release: %{release}%{?dist} License: GNU GPL version 2 @@ -26,6 +26,9 @@ Change password,Forward mail, Backup users home directory, Delegate creation of users with restrictions. %changelog +* Mon Oct 06 2025 Brian Read 11.0.0-5.sme +- Add UTF8 and avoid potential DB caching problems [SME: 13209] + * Sat Oct 04 2025 Brian Read 11.0.0-4.sme - Delete en.pm and create .lex file if needed [SME: 13214]