Obsolete Releases > SME 8.x Contribs
Samba Users simple admin panel
(1/1)
axessit:
Just thought I'd share this little gem I made a few years ago, and it works on SME8 and probably SME9 as well (haven't gone there yet).
Basically copy/paste the code below into a file called smbstatus in /etc/e-smith/web/functions
--- Code: ---#!/usr/bin/perl -U
#----------------------------------------------------------------------
# heading : Administration
# description : Samba Status
# navigation : 4000 4200
#----------------------------------------------------------------------
package esmith;
use strict;
use CGI ':all';
use CGI::Carp qw(fatalsToBrowser);
use esmith::cgi;
use esmith::config;
use esmith::util;
use esmith::db;
BEGIN
{
# Clear PATH and related environment variables so that calls to
# external programs do not cause results to be tainted. See
# "perlsec" manual page for details.
$ENV {'PATH'} = '';
$ENV {'SHELL'} = '/bin/bash';
delete $ENV {'ENV'};
}
esmith::util::setRealToEffective ();
$CGI::POST_MAX=1024 * 100; # max 100K posts
$CGI::DISABLE_UPLOADS = 1; # no uploads
my $q = new CGI;
my $q = new CGI;
$q->default_dtd('-//W3C//DTD XHTML 1.0 Transitional//EN');
print $q->header ('text/html');
print $q->start_html (
-TITLE => "smbstatus",
-CLASS => "main",
-STYLE => {
-verbatim => '@import url("/server-common/css/sme_main.css");',
src => '/server-common/css/sme_core.css'});
print $q->h1 ("Samba logged on users and file shares");
my @ss = `/usr/bin/smbstatus`;
print ("<font size=\"3\"><pre>");
foreach my $tt (@ss)
{
print ($tt);
}
print ("</pre>");
esmith::cgi::genFooter ($q);
exit (0);
--- End code ---
change the file permission
--- Code: ---chmod 4750 smbstatus
--- End code ---
then change to /etc/e-smith/web/panels/manager/cgi-bin and create a link
--- Code: ---ln -s ../../../functions/smbstatus
--- End code ---
Then log in to server manager and see the status under Administration->Samba Status.
Shows the current Samba version too which is sometimes handy.
Stefano:
thank you
please post it also as a NFR in bugzilla and attach your code, thank you again
axessit:
OKey Dokey
https://bugs.contribs.org/show_bug.cgi?id=9611
Look forward to seeing it one day.
CharlieBrady:
Running with 'perl -U' is not the preferred way to deal with taint issues. -U means "allow Perl to do unsafe operations." Better is to use pattern matching to validate the output 'smbstatus' before incorporating it in your page.
Stefano:
well, you'd post your considerations in bugzilla too ;-)
thank you in advance
Navigation
[0] Message Index
Go to full version