smeserver-print-monitor/root/etc/e-smith/web/functions/LPRng

75 lines
1.7 KiB
Plaintext
Raw Normal View History

#!/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);
}