initial commit of file from CVS for smeserver-print-monitor on Sat Sep 7 20:55:37 AEST 2024

This commit is contained in:
Trevor Batley
2024-09-07 20:55:37 +10:00
parent 204cbf06cf
commit 66b2b136f2
35 changed files with 3779 additions and 2 deletions

View File

@@ -0,0 +1,66 @@
{
my $externalSSLAccess = '';
my $validFrom = db_get_prop($confref, "httpd-admin", "ValidFrom") || 'none';
$validFrom =~ s/,/ /g;
$validFrom =~ s:/255.255.255.255::g;
unless ($validFrom eq 'none')
{
$externalSSLAccess = $validFrom;
}
use esmith::AccountsDB;
my $adb = esmith::AccountsDB->open_ro();
my $lprusers = "";
foreach my $user ($adb->users)
{
my %properties = $user->props;
my $key = $user->key;
if ($properties{'AdminPanels'})
{
if ($properties{'AdminPanels'} =~ /LPRng/)
{
$lprusers = "$lprusers $key";
}
}
}
$OUT .= <<HERE;
#------------------------------------------------------------
# LPRng - smeserver-print-monitor contrib
#------------------------------------------------------------
Alias /LPRng /var/www/html/LPRng
<Directory /var/www/html/LPRng>
AllowOverride None
Options +Indexes
AuthName "SME Server Manager"
AuthType Basic
AuthBasicProvider external
AuthExternal pwauth
Require user admin $lprusers
</Directory>
<Directory /var/www/html/LPRng/admin>
AllowOverride None
Options +Indexes
AuthName "SME Server Manager"
AuthType Basic
AuthBasicProvider external
AuthExternal pwauth
Require user admin $lprusers
</Directory>
<Directory /var/www/html/LPRng/cgi-bin>
Options ExecCGI
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/html/LPRng/admin/cgi-bin>
Options ExecCGI FollowSymLinks
AllowOverride None
Require all granted
</Directory>
# LPRng end
HERE
}

View File

@@ -0,0 +1,2 @@
ScriptAlias /LPRng/cgi-bin /var/www/html/LPRng/cgi-bin
ScriptAlias /LPRng/admin/cgi-bin /var/www/html/LPRng/admin/cgi-bin

View File

@@ -0,0 +1,74 @@
#!/usr/bin/perl -wT
#----------------------------------------------------------------------
# heading : Administration
# description : Printerqueue Admin
# navigation : 4000 4390
#
# (c) Copyright 2002 by SACO Software and Consulting GmbH, Germany
#----------------------------------------------------------------------
package esmith;
use strict;
use CGI ':all';
use CGI::Carp qw(fatalsToBrowser);
use esmith::cgi;
use esmith::db;
use esmith::util;
sub showInitial ($);
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'} = '/bin:/usr/bin';
$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 %conf;
tie %conf, 'esmith::config';
#------------------------------------------------------------
# examine state parameter and display the appropriate form
#------------------------------------------------------------
my $q = new CGI;
if (! grep (/^state$/, $q->param))
{
showInitial ($q);
}
else
{
esmith::cgi::genStateError ($q, \%conf);
}
exit (0);
#------------------------------------------------------------
# subroutine to display initial form
#------------------------------------------------------------
sub showInitial ($)
{
my ($q) = @_;
my $url = "/LPRng";
print $q->redirect(-location => $url);
## these lines aren't that important, they just prevent a
## premature end of script headers error
esmith::cgi::genHeaderNonCacheable ($q, \%conf, 'Printerqueue Admin');
esmith::cgi::genFooter ($q);
}