;
- close (DLFILE) || Error ('close', 'file');
-
- print "Content-Type:text/plain\n";#application/x-downloadn";
- print "Content-Disposition:attachment;filename=" . basename($configreportfile) . "\n";
- print "Content-Length:" . $filesize;
- print "\n\n";
- print @fileholder ;
-
- return "";
-
+ $c->render_file(
+ 'filepath' => "$configreportfile",
+ 'format' => 'x-download',
+ 'content_disposition' => 'attachment',
+ 'cleanup' => 1,
+ );
}
diff -urN smeserver-manager-0.1.2.old/root/usr/share/smanager/lib/SrvMngr/Controller/Login.pm smeserver-manager-0.1.2/root/usr/share/smanager/lib/SrvMngr/Controller/Login.pm
--- smeserver-manager-0.1.2.old/root/usr/share/smanager/lib/SrvMngr/Controller/Login.pm 2020-11-19 11:53:26.000000000 +0400
+++ smeserver-manager-0.1.2/root/usr/share/smanager/lib/SrvMngr/Controller/Login.pm 2020-11-21 00:03:42.223000000 +0400
@@ -64,6 +64,18 @@
return $c->render('login');
}
+
+ my $alias = SrvMngr::Model::Main->check_adminalias( $c );
+ if ( $alias ) {
+ if ( $name eq $alias ) {
+ $name = 'admin';
+ } elsif ( $name eq 'admin' ) {
+ record_login_attempt($c, 'FAILED');
+ $c->stash( error => $c->l('use_SORRY'), trt => 'NORM' );
+ return $c->render('login');
+ }
+ }
+
if (SrvMngr::Model::Main->check_credentials($name, $pass)) {
$c->session(logged_in => 1); # set the logged_in flag
$c->session(username => $name); # keep a copy of the username
diff -urN smeserver-manager-0.1.2.old/root/usr/share/smanager/lib/SrvMngr/Model/Main.pm smeserver-manager-0.1.2/root/usr/share/smanager/lib/SrvMngr/Model/Main.pm
--- smeserver-manager-0.1.2.old/root/usr/share/smanager/lib/SrvMngr/Model/Main.pm 2020-11-19 11:53:26.000000000 +0400
+++ smeserver-manager-0.1.2/root/usr/share/smanager/lib/SrvMngr/Model/Main.pm 2020-11-21 00:03:22.385000000 +0400
@@ -5,6 +5,7 @@
use utf8;
use esmith::ConfigDB;
+use esmith::AccountsDB;
use esmith::util;
use Net::LDAP qw/LDAP_INVALID_CREDENTIALS/;
@@ -70,5 +71,28 @@
}
+sub check_adminalias {
+
+ # is an alias required for admin ? return it or undef
+ my $c = shift;
+
+ my $alias;
+ my $cdb = esmith::ConfigDB->open_ro() or die("can't open Configuration DB");
+ if (defined $cdb->get('AdminAlias')) {
+ $alias = $cdb->get('AdminAlias')->value;
+ }
+ return undef unless $alias;
+
+ my $adb = esmith::AccountsDB->open_ro() or die("can't open Accounts DB");
+ my $arec = $adb->get( $alias );
+ return undef unless $arec;
+
+ # $alias pseudo exists AND points to admin AND is removable (not known pseudos) => OK
+ return ( $arec && $arec->prop('type') eq 'pseudonym' && $arec->prop('Account') eq 'admin'
+ && ($arec->prop('Removable') || 'yes') ne 'no' ) ? $alias : undef;
+
+}
+
+
1;
diff -urN smeserver-manager-0.1.2.old/root/usr/share/smanager/lib/SrvMngr.pm smeserver-manager-0.1.2/root/usr/share/smanager/lib/SrvMngr.pm
--- smeserver-manager-0.1.2.old/root/usr/share/smanager/lib/SrvMngr.pm 2020-11-20 23:53:46.000000000 +0400
+++ smeserver-manager-0.1.2/root/usr/share/smanager/lib/SrvMngr.pm 2020-11-21 00:03:09.872000000 +0400
@@ -23,7 +23,7 @@
use SrvMngr::Model::Main;
-our $VERSION = '1.201';
+our $VERSION = '1.202';
$VERSION = eval $VERSION;
use Exporter 'import';
@@ -154,6 +154,8 @@
$self->plugin('TagHelpers');
+ $self->plugin('RenderFile');
+
# CSRF protec if production
# $self->plugin('Mojolicious::Plugin::CSRFDefender') if ( $self->mode eq 'production' );
@@ -294,7 +296,7 @@
$if_admin->get('/viewlogfiles')->to('viewlogfiles#main')->name('viewlogfiles');
$if_admin->post('/viewlogfiles')->to('viewlogfiles#do_action')->name('viewlogfiles2');
- $if_admin->get('/viewlogfileR')->to('viewlogfiles#do_action')->name('viewlogfileR');
+ $if_admin->get('/viewlogfilesr')->to('viewlogfiles#do_action')->name('viewlogfilesr');
$if_admin->get('/yum')->to('yum#main')->name('yum');
$if_admin->post('/yum')->to('yum#do_display')->name('yumd1');
@@ -607,7 +609,7 @@
}
my $lang = ( $c->tx->req->headers->accept_language || ['en_US'] );
- $lang = split(/,/, $lang);
+ $lang = (split(/,/, $lang))[0];
# my $lang = (split(/,/, $c->tx->req->headers->accept_language))[0];
## convert xx_XX lang format to xx-xx + delete .UTFxx + lowercase
# $lang =~ s/_(.*)\..*$/-${1}/; # just keep 'en-us'
diff -urN smeserver-manager-0.1.2.old/root/usr/share/smanager/themes/default/templates/partials/_footer.html.ep smeserver-manager-0.1.2/root/usr/share/smanager/themes/default/templates/partials/_footer.html.ep
--- smeserver-manager-0.1.2.old/root/usr/share/smanager/themes/default/templates/partials/_footer.html.ep 2020-11-19 11:53:26.000000000 +0400
+++ smeserver-manager-0.1.2/root/usr/share/smanager/themes/default/templates/partials/_footer.html.ep 2020-11-21 00:02:08.503000000 +0400
@@ -3,6 +3,6 @@
SME Server <%= session 'releaseVersion' %> - Manager <%= $c->app->VERSION %> - <%= session 'lang' %>
Copyright 1999-2006 Mitel Corporation
-<%= session 'copyRight' %>
+%= session 'copyRight'
Copyright (c) 2013-2016 Koozali Foundation Inc.
diff -urN smeserver-manager-0.1.2.old/root/usr/share/smanager/themes/default/templates/viewlogfiles2.html.ep smeserver-manager-0.1.2/root/usr/share/smanager/themes/default/templates/viewlogfiles2.html.ep
--- smeserver-manager-0.1.2.old/root/usr/share/smanager/themes/default/templates/viewlogfiles2.html.ep 2020-11-19 11:53:26.000000000 +0400
+++ smeserver-manager-0.1.2/root/usr/share/smanager/themes/default/templates/viewlogfiles2.html.ep 2020-11-21 00:02:39.558000000 +0400
@@ -18,7 +18,7 @@
<% my $btn = l('log_REFRESH'); %>
- %= form_for 'viewlogfileR' => (method => 'GET') => begin
+ %= form_for 'viewlogfilesr' => (method => 'GET') => begin
%= submit_button "$btn", class => 'action'
%= hidden_field 'trt' => $log_datas->{trt}
%= hidden_field 'Filename' => $log_datas->{filename}