X7ROOT File Manager
Current Path:
/usr/libexec/webmin/lpadmin
usr
/
libexec
/
webmin
/
lpadmin
/
📁
..
📄
CHANGELOG
(1.16 KB)
📄
acl_security.pl
(4.4 KB)
📄
aix-lib.pl
(9.45 KB)
📄
ascii.txt
(4.19 KB)
📄
base_coas_driver
(560 B)
📄
bw.fig
(2.75 KB)
📄
bw.ps
(6.46 KB)
📄
caldera-driver.pl
(12.31 KB)
📄
cancel_all.cgi
(535 B)
📄
catalog.devices
(12.34 KB)
📄
cgi_args.pl
(284 B)
📄
cluster.cgi
(2.06 KB)
📄
cluster_add.cgi
(2.13 KB)
📄
cluster_delete.cgi
(529 B)
📄
colour.fig
(2.91 KB)
📄
colour.ps
(6.63 KB)
📄
config-AlmaLinux-7.0-ALL
(323 B)
📄
config-Amazon-Linux-2-ALL
(323 B)
📄
config-CentOS-Linux-7.0-ALL
(323 B)
📄
config-CentOS-Stream-Linux-8.0-ALL
(323 B)
📄
config-Oracle-Linux-8.0-ALL
(323 B)
📄
config-Redhat-Enterprise-Linux-7.0-ALL
(323 B)
📄
config-Rocky-Linux-7.0-ALL
(323 B)
📄
config-Scientific-Linux-7.0-ALL
(323 B)
📄
config-aix
(281 B)
📄
config-coherent-linux
(323 B)
📄
config-corel-linux
(228 B)
📄
config-debian-linux
(228 B)
📄
config-debian-linux-3.1-3.9
(327 B)
📄
config-debian-linux-4.0-ALL
(333 B)
📄
config-freebsd
(230 B)
📄
config-generic-linux
(228 B)
📄
config-gentoo-linux
(248 B)
📄
config-hpux
(323 B)
📄
config-irix
(213 B)
📄
config-macos
(230 B)
📄
config-mandrake-linux
(245 B)
📄
config-mandrake-linux-8.0-ALL
(276 B)
📄
config-msc-linux
(228 B)
📄
config-netbsd
(230 B)
📄
config-open-linux
(309 B)
📄
config-open-linux-3.1e
(239 B)
📄
config-openbsd
(230 B)
📄
config-openmamba-linux
(229 B)
📄
config-pardus-linux
(228 B)
📄
config-redhat-linux
(228 B)
📄
config-redhat-linux-24.0-ALL
(339 B)
📄
config-redhat-linux-7.0
(283 B)
📄
config-redhat-linux-7.1
(286 B)
📄
config-redhat-linux-7.2-8.1
(394 B)
📄
config-redhat-linux-9.0-23.0
(337 B)
📄
config-slackware-linux
(228 B)
📄
config-slackware-linux-8.1-ALL
(246 B)
📄
config-solaris
(304 B)
📄
config-solaris-10-ALL
(330 B)
📄
config-solaris-9
(296 B)
📄
config-suse-linux
(226 B)
📄
config-suse-linux-8.2-ALL
(322 B)
📄
config-trustix-linux
(313 B)
📄
config-turbo-linux
(228 B)
📄
config-united-linux
(322 B)
📄
config-unixware
(302 B)
📄
config.info
(1.31 KB)
📄
config.info.ca
(1.53 KB)
📄
config.info.cs
(1.25 KB)
📄
config.info.de
(1.43 KB)
📄
config.info.es
(1.17 KB)
📄
config.info.fr
(1.63 KB)
📄
config.info.hu
(707 B)
📄
config.info.ja
(823 B)
📄
config.info.nl
(1.41 KB)
📄
config.info.no
(1.37 KB)
📄
config.info.pl
(1.45 KB)
📄
config.info.pt_BR
(1.58 KB)
📄
config.info.ru
(1.74 KB)
📄
config.info.sv
(651 B)
📄
config.info.tr
(1.39 KB)
📄
config.info.uk
(1.81 KB)
📄
config.info.zh
(573 B)
📄
config.info.zh_TW
(539 B)
📄
cups-driver.pl
(6.37 KB)
📄
cups-lib.pl
(8.67 KB)
📄
defaultacl
(73 B)
📄
delete_printer.cgi
(690 B)
📄
delete_printers.cgi
(839 B)
📄
drivers
(18.34 KB)
📄
edit_printer.cgi
(10.08 KB)
📄
freebsd-lib.pl
(7.26 KB)
📄
hpux-driver.pl
(3.13 KB)
📄
hpux-lib.pl
(9.83 KB)
📁
images
📄
index.cgi
(5.83 KB)
📄
irix-driver.pl
(3.13 KB)
📄
irix-lib.pl
(10.68 KB)
📁
lang
📄
linux-lib.pl
(8.97 KB)
📄
list_jobs.cgi
(2.25 KB)
📄
log_parser.pl
(1021 B)
📄
lpadmin-lib.pl
(19.89 KB)
📄
lprng-lib.pl
(10.26 KB)
📄
module.info
(494 B)
📄
module.info.af
(0 B)
📄
module.info.af.auto
(159 B)
📄
module.info.ar
(0 B)
📄
module.info.ar.auto
(223 B)
📄
module.info.be
(0 B)
📄
module.info.be.auto
(290 B)
📄
module.info.bg
(0 B)
📄
module.info.bg.auto
(306 B)
📄
module.info.ca
(167 B)
📄
module.info.ca.auto
(16 B)
📄
module.info.cs
(31 B)
📄
module.info.cs.auto
(155 B)
📄
module.info.da
(0 B)
📄
module.info.da.auto
(168 B)
📄
module.info.de
(148 B)
📄
module.info.de.auto
(16 B)
📄
module.info.el
(0 B)
📄
module.info.el.auto
(362 B)
📄
module.info.es
(38 B)
📄
module.info.es.auto
(157 B)
📄
module.info.eu
(0 B)
📄
module.info.eu.auto
(217 B)
📄
module.info.fa
(0 B)
📄
module.info.fa.auto
(246 B)
📄
module.info.fi
(0 B)
📄
module.info.fi.auto
(168 B)
📄
module.info.fr
(39 B)
📄
module.info.fr.auto
(176 B)
📄
module.info.he
(0 B)
📄
module.info.he.auto
(205 B)
📄
module.info.hr
(0 B)
📄
module.info.hr.auto
(188 B)
📄
module.info.hu
(19 B)
📄
module.info.hu.auto
(173 B)
📄
module.info.it
(0 B)
📄
module.info.it.auto
(177 B)
📄
module.info.ja
(27 B)
📄
module.info.ja.auto
(213 B)
📄
module.info.ko
(25 B)
📄
module.info.ko.auto
(176 B)
📄
module.info.lt
(0 B)
📄
module.info.lt.auto
(219 B)
📄
module.info.lv
(0 B)
📄
module.info.lv.auto
(189 B)
📄
module.info.ms
(152 B)
📄
module.info.ms.auto
(16 B)
📄
module.info.mt
(0 B)
📄
module.info.mt.auto
(196 B)
📄
module.info.nl
(33 B)
📄
module.info.nl.auto
(133 B)
📄
module.info.no
(31 B)
📄
module.info.no.auto
(137 B)
📄
module.info.pl
(160 B)
📄
module.info.pl.auto
(16 B)
📄
module.info.pt
(39 B)
📄
module.info.pt.auto
(149 B)
📄
module.info.pt_BR
(42 B)
📄
module.info.pt_BR.auto
(155 B)
📄
module.info.ro
(0 B)
📄
module.info.ro.auto
(199 B)
📄
module.info.ru
(25 B)
📄
module.info.ru.auto
(245 B)
📄
module.info.sk
(0 B)
📄
module.info.sk.auto
(184 B)
📄
module.info.sl
(0 B)
📄
module.info.sl.auto
(192 B)
📄
module.info.sv
(30 B)
📄
module.info.sv.auto
(141 B)
📄
module.info.th
(0 B)
📄
module.info.th.auto
(393 B)
📄
module.info.tr
(27 B)
📄
module.info.tr.auto
(166 B)
📄
module.info.uk
(0 B)
📄
module.info.uk.auto
(281 B)
📄
module.info.ur
(0 B)
📄
module.info.ur.auto
(304 B)
📄
module.info.vi
(0 B)
📄
module.info.vi.auto
(189 B)
📄
module.info.zh
(24 B)
📄
module.info.zh.auto
(136 B)
📄
module.info.zh_TW
(30 B)
📄
module.info.zh_TW.auto
(142 B)
📄
old-caldera-driver.pl
(9.74 KB)
📄
openbsd-lib.pl
(7.26 KB)
📄
prefs.info
(40 B)
📄
printconf-driver.pl
(9.52 KB)
📄
rbac-mapping
(248 B)
📄
redhat-driver.pl
(12.42 KB)
📄
restart.cgi
(301 B)
📄
save_printer.cgi
(5.85 KB)
📄
solaris-driver.pl
(4.03 KB)
📄
solaris-lib.pl
(12.17 KB)
📄
sortdrivers-by-drv.pl
(222 B)
📄
sortdrivers.pl
(242 B)
📄
start.cgi
(377 B)
📄
stop.cgi
(374 B)
📄
stp
(2.45 KB)
📄
suse-driver.pl
(10.62 KB)
📄
test_form.cgi
(887 B)
📄
test_print.cgi
(1.19 KB)
📄
unixware-lib.pl
(7.81 KB)
📄
view_job.cgi
(909 B)
📄
webmin-driver.pl
(1.04 KB)
Editing: aix-lib.pl
# aix-lib.pl # Functions for AIX-style printer management # get_qconfig() sub get_qconfig { local @rv; local $prn; local $lnum = 0; open(CONF, "<".$config{'printcap_file'}); while(<CONF>) { s/\r|\n//g; s/^\s*#.*$//; s/^\s*\*.*$//; if (/^(\S+):\s*$/) { # Start of a new printer $prn = { 'name' => $1, 'line' => $lnum, 'eline' => $lnum }; push(@rv, $prn); } elsif (/^\s+(\S+)\s*=\s*(.*)/ && $prn) { # Variable within a printer $prn->{'eline'} = $lnum; $prn->{'values'}->{lc($1)} = $2; } $lnum++; } close(CONF); return @rv; } # list_printers() # Returns an array of known printer names sub list_printers { local @qc = &get_qconfig(); local (@rv, $q); foreach $q (@qc) { if ($q->{'values'}->{'device'}) { # A real printer push(@rv, $q->{'name'}); } } return &unique(@rv); } # get_printer(name, [nostatus]) # Returns a reference to an associative array of printer details sub get_printer { if (!%enabled_cache) { %enabled_cache = &get_enabled(); } # Find the printer in qconfig local @qc = &get_qconfig(); local %prn; local ($real) = grep { $_->{'name'} eq $_[0] } @qc; return undef if (!$real); local ($device) = grep { $_->{'name'} eq $real->{'values'}->{'device'} && $_->{'line'} > $real->{'line'} } @qc; # Construct info object $prn{'name'} = $_[0]; $prn{'accepting'} = uc($real->{'values'}->{'up'}) ne 'FALSE'; $prn{'enabled'} = $enabled_cache{$_[0]}; $prn{'desc'} = $real->{'values'}->{'device'}; # XXX if ($real->{'values'}->{'rq'}) { # Remote printer $prn{'rhost'} = $real->{'values'}->{'host'}; $prn{'rqueue'} = $real->{'values'}->{'rq'}; if ($real->{'values'}->{'s_statfilter'} =~ /bsdshort/) { $prn{'type'} = 'bsd'; } elsif ($real->{'values'}->{'s_statfilter'} =~ /attshort/) { $prn{'type'} = 's5'; } elsif ($real->{'values'}->{'s_statfilter'} =~ /aixv2short/) { $prn{'type'} = 'aix2'; } else { # Assume AIX by default $prn{'type'} = 'aix'; } } elsif ($device->{'values'}->{'backend'} =~ /piojetd\s+(\S+)\s+(\d+)/) { # Jetdirect printer $prn{'dhost'} = $1; $prn{'dport'} = $2; } else { # Local printer $prn{'dev'} = "/dev/$_[0]"; # XXX } $prn{'banner'} = 1 if (lc($device->{'values'}->{'header'}) eq 'always'); if (!$prn{'dhost'} && $device->{'values'}->{'backend'} !~ /(rembak|piojetd|piob)/) { $prn{'iface'} = $device->{'values'}->{'backend'}; } return \%prn; # XXX user access control # XXX default printer? # XXX remote system type } # get_jobs(printer) sub get_jobs { local @jobs; local $esc = quotemeta($_[0]); local $doneheader; open(LPQ, "lpq -P$esc |"); while(<LPQ>) { s/\r|\n//g; if (/^\-\-\-/) { $doneheader++; } elsif ($doneheader && /^\s+(\S+)\s+(\d+)\s+(\S+)\s+(\S+)/) { local $job = { 'id' => $2, 'user' => $4, 'file' => $3, 'printing' => lc($1) eq "active" }; push(@jobs, $job); } } close(LPQ); return @jobs; } # printer_support(option) sub printer_support { return $_[0] !~ /^(why|allow|default|msize|ctype|alias|sysv|ipp|rnoqueue)$/; } # create_printer(&details) # Create a new printer sub create_printer { local $lref = &read_file_lines($config{'printcap_file'}); push(@$lref, &qconfig_real_lines($_[0])); push(@$lref, &qconfig_device_lines($_[0])); &flush_file_lines(); &enable_disable($_[0]); } # modify_printer(&details) # Change an existing printer sub modify_printer { # Find old entry local @qc = &get_qconfig(); local ($real) = grep { $_->{'name'} eq $_[0]->{'name'} } @qc; $real || &error("Failed to find old printer!"); local ($device) = grep { $_->{'name'} eq $real->{'values'}->{'device'} && $_->{'line'} > $real->{'line'} } @qc; # Update lines in file local $lref = &read_file_lines($config{'printcap_file'}); if ($device) { splice(@$lref, $device->{'line'}, $device->{'eline'} - $device->{'line'} + 1, &qconfig_device_lines($_[0], $device)); } else { splice(@$lref, $real->{'eline'} + 1, 0, &qconfig_device_lines($_[0])); } splice(@$lref, $real->{'line'}, $real->{'eline'} - $real->{'line'} + 1, &qconfig_real_lines($_[0], $real)); &flush_file_lines(); &enable_disable($_[0]); } # enable_disable(&printer) # Enable or disable some printer sub enable_disable { local %ena = &get_enabled(); if ($_[0]->{'enabled'} && !$ena{$_[0]->{'name'}}) { &system_logged("enable ".quotemeta($_[0]->{'name'})); } elsif (!$_[0]->{'enabled'} && $ena{$_[0]->{'name'}}) { &system_logged("disable ".quotemeta($_[0]->{'name'})); } } # get_enabled() # Returns a hash from printer names to their enabled statuses sub get_enabled { local %ena; open(ENA, "lpstat -s -W |"); while(<ENA>) { s/\r|\n//g; next if (/^Queue|\-\-\-\-/); if (/^\s*(\S+)\s+(\S+)\s+(\S+)/) { $ena{$1} = $3 eq 'READY'; } } close(ENA); return %ena; } # delete_printer(name) # Deletes some existing printer sub delete_printer { # Find old entry local @qc = &get_qconfig(); local ($real) = grep { $_->{'name'} eq $_[0] } @qc; local ($device) = grep { $_->{'name'} eq $real->{'values'}->{'device'} && $_->{'line'} > $real->{'line'} } @qc; # Take lines out of file local $lref = &read_file_lines($config{'printcap_file'}); if ($device) { splice(@$lref, $device->{'line'}, $device->{'eline'} - $device->{'line'} + 1); } splice(@$lref, $real->{'line'}, $real->{'eline'} - $real->{'line'} + 1); &flush_file_lines(); } # qconfig_real_lines(&printer, [&old-real]) sub qconfig_real_lines { local $real = $_[1] || { 'name' => $_[0]->{'name'}, 'values' => { } }; $_[0]->{'desc'} ||= "$_[0]->{'name'}_device"; $real->{'values'}->{'device'} = $_[0]->{'desc'}; if ($_[0]->{'accepting'}) { delete($real->{'values'}->{'up'}); } else { $real->{'values'}->{'up'} = 'FALSE'; } if ($_[0]->{'rhost'}) { $real->{'values'}->{'host'} = $_[0]->{'rhost'}; $real->{'values'}->{'rq'} = $_[0]->{'rqueue'}; if ($_[0]->{'type'} eq 'bsd') { $real->{'values'}->{'s_statfilter'} = "/usr/lpd/bsdshort"; $real->{'values'}->{'l_statfilter'} = "/usr/lpd/bsdlong"; } elsif ($_[0]->{'type'} eq 's5') { $real->{'values'}->{'s_statfilter'} = "/usr/lpd/attshort"; $real->{'values'}->{'l_statfilter'} = "/usr/lpd/attlong"; } elsif ($_[0]->{'type'} eq 'aix2') { $real->{'values'}->{'s_statfilter'} = "/usr/lpd/aixv2short"; $real->{'values'}->{'l_statfilter'} = "/usr/lpd/aixv2long"; } else { $real->{'values'}->{'s_statfilter'} = "/usr/lpd/aixshort"; $real->{'values'}->{'l_statfilter'} = "/usr/lpd/aixlong"; } } else { delete($real->{'values'}->{'host'}); delete($real->{'values'}->{'rq'}); delete($real->{'values'}->{'s_statfilter'}); delete($real->{'values'}->{'l_statfilter'}); } return &qconfig_lines($real); } # qconfig_device_lines(&printer, [&old-device]) sub qconfig_device_lines { local $device = $_[1] || { 'name' => $_[0]->{'desc'}, 'values' => { } }; if ($_[0]->{'rhost'}) { $device->{'values'}->{'backend'} = "/usr/lib/lpd/rembak"; } elsif ($_[0]->{'dhost'}) { $device->{'values'}->{'backend'} = "/usr/lib/lpd/pio/etc/piojetd $_[0]->{'dhost'} $_[0]->{'dport'}"; if (!$device->{'values'}->{'file'}) { local $dfile = "/var/spool/lpd/pio/\@local/dev/hp\@$_[0]->{'dhost'}#hpJetDirect#$_[0]->{'dport'}"; $device->{'values'}->{'file'} = $dfile; &open_tempfile(DFILE, ">$dfile"); &print_tempfile(DFILE, "desc\t=\thpJetDirect\n"); &close_tempfile(DFILE); } } elsif ($_[0]->{'iface'}) { $device->{'values'}->{'backend'} = $_[0]->{'iface'}; } else { $device->{'values'}->{'backend'} = "/usr/lib/lpd/piobe"; } if ($_[0]->{'banner'}) { $device->{'values'}->{'header'} = "always"; } else { $device->{'values'}->{'header'} = "never"; } return &qconfig_lines($device); } sub qconfig_lines { local @rv = ( "$_[0]->{'name'}:" ); local $k; foreach $k (keys %{$_[0]->{'values'}}) { push(@rv, "\t$k = $_[0]->{'values'}->{$k}"); } return @rv; } # cancel_job(printer, id) # Cancels some print job sub cancel_job { local $esc = quotemeta($_[0]); local $iesc = quotemeta($_[1]); local $out = &backquote_logged("lprm -P $esc $iesc 2>&1"); if ($?) { &error("cancel failed : <pre>$out</pre>"); } sleep(1); } # sched_running() # Returns the pid if lpsched is running, 0 if not, -1 if cannot be stopped sub sched_running { local @qpid = &find_byname("qdaemon"); local @lpid = &find_byname("lpd"); if (@qpid && @lpid) { return $qpid[0]; } return 0; } # start_sched() # Start lpsched sub start_sched { local $s; foreach $s ("qdaemon", "lpd") { if (!&find_byname($s)) { local $out = &backquote_logged("/usr/bin/startsrc -s$s 2>&1"); if ($?) { &error("failed to start $s : <tt>$out</tt>"); } } } } # stop_sched(pid) # Stop the running lpsched process sub stop_sched { local $s; foreach $s ("qdaemon", "lpd") { if (&find_byname($s)) { local $out = &backquote_logged("/usr/bin/stopsrc -s$s 2>&1"); if ($?) { &error("failed to start $s : <tt>$out</tt>"); } } } } # print_command(printer, file) # Returns the command to print some file on some printer sub print_command { local $esc = quotemeta($_[0]); local $fesc = quotemeta($_[1]); return "lpr -P $esc $fesc"; } # check_print_system() sub check_print_system { &has_command("qdaemon") || return &text('aix_ecmd', "<tt>qdaemon</tt>"); return undef; } # validate_printer(&printer) # Performs extra OS-specific printer validation, and returns an error message # if there is a problem sub validate_printer { return $text{'aix_edesc'} if ($_[0]->{'desc'} !~ /^[a-z0-9\-\.\_\@]*$/i); return undef; } sub remote_printer_types { return ( [ 'aix', 'AIX' ], [ 'bsd', 'BSD' ], [ 's5', 'ATT SysV' ], [ 'aix2', 'AIX v2' ] ); } @device_files = ("/dev/lp0", "/dev/lp1", "/dev/null" ); @device_names = (&text('aix_port', "0"), &text('aix_port', "1"), $text{'solaris_null'});
Upload File
Create Folder