This commit is contained in:
commit
88059d223b
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.osc
|
3
PSLEVEL1.PPD.bz2
Normal file
3
PSLEVEL1.PPD.bz2
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6ae8b4a3676e1dba2f0e159e914b630a8b553cf89923e793e6d85029aaa628dd
|
||||
size 3050
|
3
PSLEVEL2.PPD.bz2
Normal file
3
PSLEVEL2.PPD.bz2
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:11ebbabda7bfe47b945a47430360e2e9e6a50e419e488d3c548eaed75ecded5c
|
||||
size 3055
|
499
PrintAnalyzer
Normal file
499
PrintAnalyzer
Normal file
@ -0,0 +1,499 @@
|
||||
#!/usr/bin/perl -w
|
||||
#***************************************************************************
|
||||
# PrintAnalyzer
|
||||
# Generate some stats from cups page_log file
|
||||
# copyright : (C) 1999 - 2002 by Thies Moeller
|
||||
# email : moeller@tu-harburg.de
|
||||
#***************************************************************************
|
||||
|
||||
#***************************************************************************
|
||||
#* *
|
||||
#* This program is free software; you can redistribute it and/or modify *
|
||||
#* it under the terms of the GNU General Public License as published by *
|
||||
#* the Free Software Foundation; either version 2 of the License, or *
|
||||
#* (at your option) any later version. *
|
||||
#* *
|
||||
#***************************************************************************
|
||||
use strict;
|
||||
use warnings;
|
||||
use POSIX qw(strftime);
|
||||
use Time::Local;
|
||||
|
||||
##############
|
||||
# edit place of your page_log file
|
||||
##############
|
||||
|
||||
my $PAGE_LOG_FILE = "/var/log/cups/page_log";
|
||||
|
||||
##############
|
||||
# edit start and end of normal work time
|
||||
# activity outside this interval will be marked with an "!"
|
||||
# to disable set WorkStart to 0 and WorkEnd to 23
|
||||
##############
|
||||
my $WorkStart = 8;
|
||||
my $WorkEnd = 21;
|
||||
|
||||
|
||||
############################ nothing to modify below this line ##############
|
||||
|
||||
my %userRequests = ();
|
||||
my %userPages = ();
|
||||
my %hourRequests = ();
|
||||
my %dateRequests = ();
|
||||
my %datePages = ();
|
||||
my %pageRequests = ();
|
||||
my %queueRequests = ();
|
||||
my %queuePages = ();
|
||||
my %pageHeu = ();
|
||||
my %copyRequests = ();
|
||||
my %logline = ();
|
||||
my %lastlogline = ();
|
||||
my %billingStats = ();
|
||||
my $totalReq = 0;
|
||||
my $totalPages = 0;
|
||||
|
||||
sub DateCompare
|
||||
{
|
||||
my $date1 = substr($a, 6, 2) * 1024; # Years
|
||||
my $date2 = substr($b, 6, 2) * 1024;
|
||||
|
||||
$date1 += substr($a,3,2) * 64; # Months
|
||||
$date2 += substr($b,3,2) * 64;
|
||||
|
||||
$date1 += substr($a, 0, 2); # Days
|
||||
$date2 += substr($b, 0, 2);
|
||||
return ($date1 <=> $date2);
|
||||
}
|
||||
|
||||
|
||||
sub tzdiff2sec
|
||||
{
|
||||
## this method is copied from LogReport Time.pm
|
||||
## Copyright (C) 2000-2002 Stichting LogReport Foundation LogReport@LogReport.org
|
||||
|
||||
die "tzdiff2sec needs 1 arg\n"
|
||||
unless @_ == 1;
|
||||
|
||||
# e.g. +0100 or -0900 ; +hh:mm, +hhmm, or +hh
|
||||
my ( $sign, $hour, $min ) = $_[0] =~ /^([+-])?(\d\d):?(\d\d)?$/
|
||||
or die "invalid tzdiff format: $_[0]. It must looks like +0100 or -01:00\n";
|
||||
$sign ||= "+";
|
||||
$hour ||= 0;
|
||||
$min ||= 0;
|
||||
my $sec = $hour * 60 * 60 + $min * 60;
|
||||
$sec *= -1 if $sign eq '-';
|
||||
return $sec;
|
||||
}
|
||||
|
||||
sub getMonth
|
||||
{
|
||||
my $AllMonths= 'JanFebMarAprMayJunJulAugSepOctNovDec';
|
||||
my $month = shift(@_);
|
||||
return index($AllMonths, $month)/3;
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub DateTime2Epoch
|
||||
{
|
||||
my ($day,$month,$year,$hour,$min,$sec,$tz)=
|
||||
unpack'@1 A2 @4 A3 @8 A4 @13 A2 @16 A2 @19 A2 @22 A5', shift();
|
||||
|
||||
my $epoch=timegm $sec ,
|
||||
$min ,
|
||||
$hour,
|
||||
$day,
|
||||
getMonth($month),
|
||||
$year;
|
||||
return $epoch - tzdiff2sec($tz);
|
||||
}
|
||||
|
||||
sub PrintDayLog
|
||||
{
|
||||
my $dateReq;
|
||||
|
||||
############# Output Form ################
|
||||
format DAYLOG_TOP =
|
||||
|
||||
Daily Usage
|
||||
Date %Requests Pages
|
||||
-----------------------------------------
|
||||
.
|
||||
|
||||
format DAYLOG =
|
||||
@<<<<<<<<<<<<< @>>>>>>> @>>>>>>>
|
||||
$dateReq,$dateRequests{$dateReq},$datePages{$dateReq}
|
||||
.
|
||||
############# Output Form ################
|
||||
|
||||
|
||||
$-=0;
|
||||
$~="DAYLOG";
|
||||
$^="DAYLOG_TOP";
|
||||
foreach $dateReq (sort DateCompare keys %dateRequests)
|
||||
{
|
||||
#printf("Monat %d\n",getMonth($dateReq));
|
||||
write;
|
||||
}
|
||||
}
|
||||
|
||||
sub PrintUserLog
|
||||
{
|
||||
my $userReq;
|
||||
my $pageperjob;
|
||||
|
||||
############# Output Form ################
|
||||
format USERLOG_TOP =
|
||||
PrinterAccounting
|
||||
Username Requests Pages Pages/Request
|
||||
--------------------------------------------------------
|
||||
.
|
||||
|
||||
format USERLOG =
|
||||
@<<<<<<<<<<<<<<<<<< @>>>>>>> @>>>>>>> @>>>>>>>>
|
||||
$userReq, $userRequests{$userReq}, $userPages{$userReq}, $pageperjob
|
||||
.
|
||||
############# Output Form ################
|
||||
|
||||
$-=0;
|
||||
$~="USERLOG";
|
||||
$^="USERLOG_TOP";
|
||||
foreach $userReq (sort { $userPages{$b} <=> $userPages{$a}} keys %userRequests)
|
||||
{
|
||||
$pageperjob = sprintf("%5d", POSIX::ceil($userPages{$userReq} / $userRequests{$userReq}));
|
||||
write ;
|
||||
}
|
||||
}
|
||||
|
||||
sub PrintHourLog
|
||||
{
|
||||
my $hourReq;
|
||||
my $outOfWorkingTime;
|
||||
|
||||
############# Output Form ################
|
||||
format HOURLOG_TOP =
|
||||
Hour Usage
|
||||
Hour Requests
|
||||
---------------------
|
||||
.
|
||||
|
||||
format HOURLOG =
|
||||
@<@<<<<< @>>>>>>>
|
||||
$outOfWorkingTime,$hourReq,$hourRequests{$hourReq}
|
||||
.
|
||||
############# Output Form ################
|
||||
|
||||
|
||||
$-=0;
|
||||
$~="HOURLOG";
|
||||
$^="HOURLOG_TOP";
|
||||
|
||||
foreach $hourReq (sort {$a <=> $b} keys %hourRequests)
|
||||
{
|
||||
if($hourReq <$WorkStart || $hourReq > $WorkEnd)
|
||||
{
|
||||
if($hourRequests{$hourReq} == 0)
|
||||
{
|
||||
next;
|
||||
}
|
||||
else
|
||||
{
|
||||
$outOfWorkingTime = "!";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$outOfWorkingTime = " ";
|
||||
}
|
||||
write;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sub PrintRequestSize
|
||||
{
|
||||
my $pageReq;
|
||||
my %pageHeu;
|
||||
my $pageHeuK;
|
||||
my $pageperHeu;
|
||||
############# Output Form ################
|
||||
|
||||
format REQUESTLOG_TOP =
|
||||
Heuristic
|
||||
JobSize %Requests
|
||||
---------------------------
|
||||
.
|
||||
|
||||
format REQUESTLOG =
|
||||
@||||||||||| @>>>>>>>>
|
||||
$pageHeuK,$pageperHeu
|
||||
.
|
||||
############# Output Form ################
|
||||
|
||||
# sammeln der Daten
|
||||
foreach $pageReq (sort {$a <=> $b} keys %pageRequests)
|
||||
{
|
||||
if($pageReq >0 && $pageReq <=10)
|
||||
{$pageHeu{"1. 0-10"}+=$pageRequests{$pageReq}};
|
||||
if ($pageReq >10 && $pageReq <=20)
|
||||
{$pageHeu{ "2. 20-30"}+=$pageRequests{$pageReq}};
|
||||
if ($pageReq >20 && $pageReq <=30)
|
||||
{$pageHeu{ "3. 30-40"}+=$pageRequests{$pageReq}};
|
||||
if ($pageReq >40 && $pageReq <=50)
|
||||
{$pageHeu{ "4. 40-50"}+=$pageRequests{$pageReq}};
|
||||
if ($pageReq >50 && $pageReq <=100)
|
||||
{$pageHeu{ "5. 50-100"}+=$pageRequests{$pageReq}};
|
||||
if ($pageReq >100 && $pageReq <=200)
|
||||
{$pageHeu{ "6. 100-200"}+=$pageRequests{$pageReq}};
|
||||
if ($pageReq >200 )
|
||||
{$pageHeu{ "7. 200- "}+=$pageRequests{$pageReq}};
|
||||
}
|
||||
$-=0;
|
||||
$~="REQUESTLOG";
|
||||
$^="REQUESTLOG_TOP";
|
||||
|
||||
foreach $pageHeuK (sort keys %pageHeu)
|
||||
{
|
||||
$pageperHeu = sprintf("%5.2f", 100*$pageHeu{$pageHeuK}/$totalReq);
|
||||
write;
|
||||
}
|
||||
}
|
||||
|
||||
sub PrintCopySize
|
||||
{
|
||||
my $copyReq;
|
||||
my %copyHeu;
|
||||
my $copyHeuK;
|
||||
my $copyperheu;
|
||||
############# Output Form ################
|
||||
format COPY_TOP =
|
||||
Heuristic
|
||||
Copies %Requests
|
||||
---------------------------
|
||||
.
|
||||
format COPYLOG =
|
||||
@||||||||||||| @>>>>>>>>
|
||||
$copyHeuK,$copyperheu
|
||||
.
|
||||
############# Output Form ################
|
||||
|
||||
|
||||
foreach $copyReq (sort {$a <=> $b} keys %copyRequests)
|
||||
{
|
||||
if($copyReq == 1 )
|
||||
{$copyHeu{" 1. single"}+=$copyRequests{$copyReq}};
|
||||
if($copyReq == 2)
|
||||
{$copyHeu{" 2. 2 "}+=$copyRequests{$copyReq}};
|
||||
if($copyReq == 3)
|
||||
{$copyHeu{" 3. 3 "}+=$copyRequests{$copyReq}};
|
||||
if($copyReq == 4)
|
||||
{$copyHeu{" 4. 4 "}+=$copyRequests{$copyReq}};
|
||||
if($copyReq >=5 && $copyReq <=10)
|
||||
{$copyHeu{" 5. 5-10 "}+=$copyRequests{$copyReq}};
|
||||
if ($copyReq >10 && $copyReq <=20)
|
||||
{$copyHeu{ " 6. 20-30 "}+=$copyRequests{$copyReq}};
|
||||
if ($copyReq >20 && $copyReq <=30)
|
||||
{$copyHeu{ " 7. 30-40 "}+=$copyRequests{$copyReq}};
|
||||
if ($copyReq >40 && $copyReq <=50)
|
||||
{$copyHeu{ " 8. 40-50 "}+=$copyRequests{$copyReq}};
|
||||
if ($copyReq >50 && $copyReq <=100)
|
||||
{$copyHeu{ " 9. 50-100 "}+=$copyRequests{$copyReq}};
|
||||
if ($copyReq >100 && $copyReq <=200)
|
||||
{$copyHeu{ "10. 100-200 "}+=$copyRequests{$copyReq}};
|
||||
if ($copyReq >200 )
|
||||
{$copyHeu{ "11. 200- "}+=$copyRequests{$copyReq}};
|
||||
}
|
||||
$-=0;
|
||||
$~="COPYLOG";
|
||||
$^="COPY_TOP";
|
||||
foreach $copyHeuK (sort keys %copyHeu)
|
||||
{
|
||||
$copyperheu = sprintf("%5.2f", 100*$copyHeu{$copyHeuK}/$totalReq);
|
||||
write;
|
||||
}
|
||||
}
|
||||
|
||||
sub PrintQueueLog
|
||||
{
|
||||
my $queueReq;
|
||||
my $reqperqueue;
|
||||
my $pagepermin;
|
||||
my $pageperqueue ;
|
||||
############# Output Form ################
|
||||
format QUEUELOG_TOP =
|
||||
Queue Heuristic
|
||||
Queue %Requests %Pages Pages
|
||||
--------------------------------------------------------------
|
||||
.
|
||||
|
||||
format QUEUELOG =
|
||||
@>>>>>>>>>>>>>>>>>>>>> @>>>>>>> @>>>>>>> @>>>>>>>>
|
||||
$queueReq,$reqperqueue,$pageperqueue,$queuePages{$queueReq}
|
||||
.
|
||||
############# Output Form ################
|
||||
|
||||
|
||||
$-=0;
|
||||
$~="QUEUELOG";
|
||||
$^="QUEUELOG_TOP";
|
||||
foreach $queueReq (sort { $queuePages{$b} <=> $queuePages{$a} } keys %queuePages)
|
||||
{
|
||||
$reqperqueue = sprintf("%5.2f", 100*$queueRequests{$queueReq}/$totalReq);
|
||||
$pageperqueue = sprintf("%5.2f", 100*$queuePages{$queueReq}/$totalPages);
|
||||
write;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sub PrintBillingLog
|
||||
{
|
||||
my $billing;
|
||||
my $pageperbilling ;
|
||||
my $billinguser;
|
||||
|
||||
############# Output Form ################
|
||||
format BILLINGLOG_TOP =
|
||||
Billing Heuristic
|
||||
Billing Pages
|
||||
--------------------------------------------------------------
|
||||
.
|
||||
|
||||
format BILLINGLOG =
|
||||
@<<<<<<<<<<<<<<<<<<<<<<<< @>>>>>>>>
|
||||
$billing,$pageperbilling
|
||||
.
|
||||
|
||||
format BILLINGUSERLOG =
|
||||
|- @>>>>>>>>>>>>>>>>>>>>> @>>>>>>>>
|
||||
$billinguser,$pageperbilling
|
||||
.
|
||||
############# Output Form ################
|
||||
|
||||
|
||||
$-=0;
|
||||
$~="BILLINGLOG";
|
||||
$^="BILLINGLOG_TOP";
|
||||
foreach $billing (sort keys %billingStats)
|
||||
{
|
||||
$pageperbilling = $billingStats{$billing}{"total_pages"};
|
||||
$~="BILLINGLOG";
|
||||
write;
|
||||
$~="BILLINGUSERLOG";
|
||||
foreach $billinguser ( sort {$billingStats{$billing}{"user"}{$b} <=> $billingStats{$billing}{"user"}{$a}} keys %{$billingStats{$billing}{"user"}})
|
||||
{
|
||||
$pageperbilling = $billingStats{$billing}{"user"}{$billinguser};
|
||||
write;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sub HandleNewJob
|
||||
{
|
||||
my $realpages = $lastlogline{num_pages}*$lastlogline{copies};
|
||||
my $hourstring = POSIX::strftime "%H", localtime($lastlogline{time}) ;
|
||||
my $daystring = POSIX::strftime "%d/%m/%y", localtime($lastlogline{time}) ;
|
||||
|
||||
$userRequests{$lastlogline{user}}++;
|
||||
$userPages{$lastlogline{user}}+=$realpages;
|
||||
$dateRequests{$daystring}++;
|
||||
$datePages{$daystring}+=$realpages;
|
||||
$pageRequests{$realpages}++;
|
||||
$queueRequests{$lastlogline{printer}}++;
|
||||
$queuePages{$lastlogline{printer}}+=$realpages;
|
||||
$hourRequests{$hourstring}++;
|
||||
$copyRequests{$lastlogline{copies}}++;
|
||||
$billingStats{$lastlogline{billing}}{"user"}{$lastlogline{user}} += $realpages;
|
||||
$billingStats{$lastlogline{billing}}{"printer"}{$lastlogline{printer}} += $realpages;
|
||||
$billingStats{$lastlogline{billing}}{"total_pages"} += $realpages;
|
||||
|
||||
$totalReq++;
|
||||
$totalPages+=$realpages;
|
||||
|
||||
}
|
||||
|
||||
sub InitHourHistogram
|
||||
{
|
||||
my $i;
|
||||
for ($i = 0 ; $i <=24 ; $i++)
|
||||
{
|
||||
my $hourstring = sprintf("%02d", $i);
|
||||
$hourRequests{$hourstring}=0;
|
||||
}
|
||||
}
|
||||
|
||||
# main
|
||||
open(PAGELOG,"$PAGE_LOG_FILE") || die "Can't open pagelog file $PAGE_LOG_FILE";
|
||||
|
||||
|
||||
#initialize the hourhistogram
|
||||
InitHourHistogram;
|
||||
|
||||
while(<PAGELOG>)
|
||||
{
|
||||
my $time;
|
||||
my $pagenum;
|
||||
%logline = ();
|
||||
chomp();
|
||||
($logline{printer},
|
||||
$logline{user},
|
||||
$logline{jobid},
|
||||
$time,
|
||||
$pagenum,
|
||||
$logline{copies},
|
||||
$logline{billing}) =
|
||||
($_ =~ /^(.*)\s(.*)\s(\d+)\s(\[.*\])\s(\d+)\s(\d+)\s(.*)$/)
|
||||
or do {
|
||||
print STDERR "Cannot convert $_ \n";
|
||||
next;
|
||||
};
|
||||
# downcase username because of samba
|
||||
$logline{user}=~ tr/A-Z/a-z/;
|
||||
# handle empty user
|
||||
if ($logline{user} eq "") {
|
||||
$logline{user}="TestPages";
|
||||
}
|
||||
# handle empty billing code
|
||||
if ($logline{billing} eq "") {
|
||||
$logline{billing}="-none-";
|
||||
}
|
||||
my $endtime = DateTime2Epoch( $time );
|
||||
|
||||
if ( ! defined $lastlogline{jobid} || $lastlogline{jobid} ne $logline{jobid} )
|
||||
{
|
||||
# new job;
|
||||
$logline{num_pages} = 1;
|
||||
$logline{time} = $endtime;
|
||||
if ( defined $lastlogline{jobid} ) {
|
||||
HandleNewJob;
|
||||
};
|
||||
} else {
|
||||
# same job; update info
|
||||
$logline{num_pages} = $lastlogline{num_pages} + 1;
|
||||
$logline{time} = $lastlogline{time};
|
||||
}
|
||||
%lastlogline= %logline;
|
||||
|
||||
}
|
||||
close(PAGELOG);
|
||||
|
||||
# handle last job
|
||||
if ( defined $lastlogline{jobid} ) {
|
||||
HandleNewJob;
|
||||
}
|
||||
|
||||
|
||||
|
||||
PrintQueueLog;
|
||||
PrintRequestSize;
|
||||
PrintCopySize;
|
||||
PrintBillingLog;
|
||||
PrintUserLog;
|
||||
PrintHourLog;
|
||||
PrintDayLog;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
21
cups-1.1.21-testppd_duplex.patch
Normal file
21
cups-1.1.21-testppd_duplex.patch
Normal file
@ -0,0 +1,21 @@
|
||||
--- cups-1.1.21/systemv/cupstestppd.c.orig 2004-08-23 20:36:50.000000000 +0200
|
||||
+++ cups-1.1.21/systemv/cupstestppd.c 2004-09-20 16:19:12.427769515 +0200
|
||||
@@ -854,6 +854,7 @@
|
||||
strcmp(choice->choice, "DuplexTumble") &&
|
||||
strcmp(choice->choice, "SimplexTumble"))
|
||||
{
|
||||
+#if 0
|
||||
if (verbose >= 0)
|
||||
{
|
||||
if (!errors && !verbose)
|
||||
@@ -865,6 +866,10 @@
|
||||
}
|
||||
|
||||
errors ++;
|
||||
+#else
|
||||
+ printf(" WARN Bad %s choice %s!\n",
|
||||
+ option->keyword, choice->choice);
|
||||
+#endif
|
||||
}
|
||||
}
|
||||
|
42
cups-1.1.21-umlaut_printer.patch
Normal file
42
cups-1.1.21-umlaut_printer.patch
Normal file
@ -0,0 +1,42 @@
|
||||
--- cups-1.1.21/scheduler/client.c.orig 2004-09-14 17:00:56.102330657 +0200
|
||||
+++ cups-1.1.21/scheduler/client.c 2004-09-14 18:32:04.648731933 +0200
|
||||
@@ -1262,10 +1330,36 @@
|
||||
* names are not case sensitive but filenames can be...
|
||||
*/
|
||||
|
||||
- con->uri[strlen(con->uri) - 4] = '\0'; /* Drop ".ppd" */
|
||||
+ int i;
|
||||
+ char tmp_uri[HTTP_MAX_URI];
|
||||
+ char *uri, *len;
|
||||
+
|
||||
+ memset(tmp_uri, 0, HTTP_MAX_URI);
|
||||
+ uri = con->uri;
|
||||
+ len = uri + strlen(uri) - 4;
|
||||
+ i = 0;
|
||||
|
||||
- if ((p = FindPrinter(con->uri + 10)) != NULL)
|
||||
- snprintf(con->uri, sizeof(con->uri), "/ppd/%s.ppd", p->name);
|
||||
+ while(uri < len)
|
||||
+ {
|
||||
+ if (uri[0] == '%' && isxdigit(uri[1]) && isxdigit(uri[2]))
|
||||
+ {
|
||||
+ tmp_uri[i] = (isdigit(uri[1])?uri[1]-'0':(toupper(uri[1])-'A'+10))*16
|
||||
+ + (isdigit(uri[2])?uri[2]-'0':(toupper(uri[2])-'A'+10));
|
||||
+ uri += 3;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ tmp_uri[i] = uri[0];
|
||||
+ uri++;
|
||||
+ }
|
||||
+ i++;
|
||||
+ }
|
||||
+ tmp_uri[i] = '\0';
|
||||
+
|
||||
+ // con->uri[strlen(con->uri) - 4] = '\0'; /* Drop ".ppd" */
|
||||
+
|
||||
+ if ((p = FindPrinter(tmp_uri + 10)) != NULL)
|
||||
+ snprintf(con->uri, sizeof(con->uri), "/ppd/%s.ppd", p->name);
|
||||
else
|
||||
{
|
||||
if (!SendError(con, HTTP_NOT_FOUND))
|
97
cups-1.1.21rc2-preauth_security.patch
Normal file
97
cups-1.1.21rc2-preauth_security.patch
Normal file
@ -0,0 +1,97 @@
|
||||
--- cups-1.1.21rc2/scheduler/client.c.orig 2004-08-31 15:48:47.000000000 +0200
|
||||
+++ cups-1.1.21rc2/scheduler/client.c 2004-08-31 15:52:54.755695050 +0200
|
||||
@@ -293,6 +293,74 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ /*
|
||||
+ * Do ACL stuff...
|
||||
+ */
|
||||
+
|
||||
+ if (BrowseACL && (BrowseACL->num_allow || BrowseACL->num_deny))
|
||||
+ {
|
||||
+ int hostlen = strlen(con->http.hostname);
|
||||
+ int auth = AUTH_DENY;
|
||||
+
|
||||
+ if (address == 0x7f000001)
|
||||
+ {
|
||||
+ /*
|
||||
+ * Access from localhost (127.0.0.1) is always allowed...
|
||||
+ */
|
||||
+
|
||||
+ auth = AUTH_ALLOW;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ /*
|
||||
+ * Do authorization checks on the domain/address...
|
||||
+ */
|
||||
+
|
||||
+ switch (BrowseACL->order_type)
|
||||
+ {
|
||||
+ default :
|
||||
+ auth = AUTH_DENY; /* anti-compiler-warning-code */
|
||||
+ break;
|
||||
+
|
||||
+ case AUTH_ALLOW : /* Order Deny,Allow */
|
||||
+ auth = AUTH_ALLOW;
|
||||
+
|
||||
+ if (CheckAuth(address, con->http.hostname, hostlen,
|
||||
+ BrowseACL->num_deny, BrowseACL->deny))
|
||||
+ auth = AUTH_DENY;
|
||||
+
|
||||
+ if (CheckAuth(address, con->http.hostname, hostlen,
|
||||
+ BrowseACL->num_allow, BrowseACL->allow))
|
||||
+ auth = AUTH_ALLOW;
|
||||
+ break;
|
||||
+
|
||||
+ case AUTH_DENY : /* Order Allow,Deny */
|
||||
+ auth = AUTH_DENY;
|
||||
+
|
||||
+ if (CheckAuth(address, con->http.hostname, hostlen,
|
||||
+ BrowseACL->num_allow, BrowseACL->allow))
|
||||
+ auth = AUTH_ALLOW;
|
||||
+
|
||||
+ if (CheckAuth(address, con->http.hostname, hostlen,
|
||||
+ BrowseACL->num_deny, BrowseACL->deny))
|
||||
+ auth = AUTH_DENY;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (auth == AUTH_DENY)
|
||||
+ {
|
||||
+ LogMessage(L_DEBUG, "AcceptClient(): Refused connection from from %s; please check BrowseAllow/BrowseDeny settings",
|
||||
+ con->http.hostname);
|
||||
+#ifdef WIN32
|
||||
+ closesocket(con->http.fd);
|
||||
+#else
|
||||
+ close(con->http.fd);
|
||||
+#endif /* WIN32 */
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
LogMessage(L_DEBUG, "AcceptClient: %d from %s:%d.", con->http.fd,
|
||||
con->http.hostname, ntohs(con->http.hostaddr.sin_port));
|
||||
|
||||
--- cups-1.1.21rc2/conf/cupsd.conf.in.orig 2004-08-31 15:48:47.000000000 +0200
|
||||
+++ cups-1.1.21rc2/conf/cupsd.conf.in 2004-08-31 15:55:01.452514988 +0200
|
||||
@@ -575,6 +575,9 @@
|
||||
#BrowseAllow address
|
||||
#BrowseDeny address
|
||||
|
||||
+BrowseAllow @LOCAL
|
||||
+BrowseDeny All
|
||||
+
|
||||
#
|
||||
# BrowseInterval: the time between browsing updates in seconds. Default
|
||||
# is 30 seconds.
|
||||
@@ -769,6 +772,7 @@
|
||||
Deny From All
|
||||
Allow From 127.0.0.1
|
||||
Allow From 127.0.0.2
|
||||
+Allow From @LOCAL
|
||||
</Location>
|
||||
|
||||
#<Location /classes>
|
32
cups-1.1.21rc2-usermode.patch
Normal file
32
cups-1.1.21rc2-usermode.patch
Normal file
@ -0,0 +1,32 @@
|
||||
--- cups-1.1.21rc2/conf/cupsd.conf.in.orig 2004-08-31 15:55:01.000000000 +0200
|
||||
+++ cups-1.1.21rc2/conf/cupsd.conf.in 2004-08-31 15:57:30.562005961 +0200
|
||||
@@ -246,6 +246,7 @@
|
||||
#
|
||||
|
||||
#Printcap /etc/printcap
|
||||
+Printcap /etc/printcap
|
||||
|
||||
#
|
||||
# PrintcapFormat: the format of the printcap file, currently either
|
||||
@@ -366,6 +367,9 @@
|
||||
|
||||
#User @CUPS_USER@
|
||||
#Group @CUPS_GROUP@
|
||||
+User @CUPS_USER@
|
||||
+Group @CUPS_GROUP@
|
||||
+RunAsUser Yes
|
||||
|
||||
#
|
||||
# RIPCache: the amount of memory that each RIP should use to cache
|
||||
@@ -834,8 +838,9 @@
|
||||
# the group name using the SystemGroup directive.
|
||||
#
|
||||
|
||||
-AuthType Basic
|
||||
-AuthClass System
|
||||
+AuthType BasicDigest
|
||||
+AuthClass Group
|
||||
+AuthGroupName sys
|
||||
|
||||
## Restrict access to local domain
|
||||
Order Deny,Allow
|
261
cups-1.1.23-testpage.patch
Normal file
261
cups-1.1.23-testpage.patch
Normal file
@ -0,0 +1,261 @@
|
||||
--- cups-1.1.23/data/testprint.ps.orig 2005-01-03 20:29:45.000000000 +0100
|
||||
+++ cups-1.1.23/data/testprint.ps 2005-01-21 14:27:36.019127436 +0100
|
||||
@@ -107,99 +107,99 @@
|
||||
} ifelse
|
||||
100 string cvs show % Convert to a string and show it...
|
||||
} bind def
|
||||
-/CUPSLOGO { % Draw the CUPS logo
|
||||
- % height CUPSLOGO
|
||||
- % Start with a big C...
|
||||
- /Helvetica findfont 1 index scalefont setfont
|
||||
- 0 setgray
|
||||
- 0 0 moveto
|
||||
- (C) show
|
||||
-
|
||||
- % Then "UNIX Printing System" much smaller...
|
||||
- /Helvetica-Bold findfont 1 index 9 div scalefont setfont
|
||||
- 0.25 mul
|
||||
- dup dup 2.0 mul moveto
|
||||
- (UNIX) show
|
||||
- dup dup 1.6 mul moveto
|
||||
- (Printing) show
|
||||
- dup 1.2 mul moveto
|
||||
- (System) show
|
||||
-} bind def
|
||||
-/ESPLOGO { % Draw the ESP logo
|
||||
- % height ESPLOGO
|
||||
- % Compute the size of the logo...
|
||||
- 0 0
|
||||
- 2 index 1.5 mul 3 index
|
||||
-
|
||||
- % Do the "metallic" fill from 10% black to 40% black...
|
||||
- 1 -0.001 0 {
|
||||
- dup % loopval
|
||||
- -0.15 mul % loopval * -0.15
|
||||
- 0.9 add % 0.9 - loopval * 0.15
|
||||
- setgray % set gray shade
|
||||
-
|
||||
- 0 % x
|
||||
- 1 index neg % loopval
|
||||
- 1 add % 1 - loopval
|
||||
- 3 index % height
|
||||
- mul % height * (1 - loopval)
|
||||
- moveto % starting point
|
||||
-
|
||||
- dup % loopval
|
||||
- 3 index % width
|
||||
- mul % loopval * width
|
||||
- 2 index % height
|
||||
- lineto % Next point
|
||||
-
|
||||
- 0 % x
|
||||
- 2 index % height
|
||||
- lineto % Next point
|
||||
-
|
||||
- closepath
|
||||
- fill
|
||||
-
|
||||
- dup % loopval
|
||||
- 0.15 mul % loopval * 0.15
|
||||
- 0.6 add % 0.6 + loopval * 0.15
|
||||
- setgray
|
||||
-
|
||||
- dup % loopval
|
||||
- neg 1 add % 1 - loopval
|
||||
- 3 index % width
|
||||
- mul % (1 - loopval) * width
|
||||
- 0 % y
|
||||
- moveto % Starting point
|
||||
-
|
||||
- 2 index % width
|
||||
- exch % loopval
|
||||
- 2 index % height
|
||||
- mul % loopval * height
|
||||
- lineto % Next point
|
||||
-
|
||||
- 1 index % width
|
||||
- 0 % y
|
||||
- lineto % Next point
|
||||
-
|
||||
- closepath
|
||||
- fill
|
||||
- } for
|
||||
-
|
||||
- 0 setgray rectstroke
|
||||
-
|
||||
- /Helvetica-BoldOblique findfont 1 index 3 div scalefont setfont
|
||||
- dup 40 div
|
||||
-
|
||||
- dup 4 mul 1 index 25 mul moveto (E) show
|
||||
- dup 10 mul 1 index 15 mul moveto (S) show
|
||||
- dup 16 mul 1 index 5 mul moveto (P) show
|
||||
-
|
||||
- /Helvetica-BoldOblique findfont 2 index 5 div scalefont setfont
|
||||
- dup 14 mul 1 index 29 mul moveto (asy) show
|
||||
- dup 20 mul 1 index 19 mul moveto (oftware) show
|
||||
- dup 26 mul 1 index 9 mul moveto (roducts) show
|
||||
-
|
||||
- pop
|
||||
-} bind def
|
||||
+%/CUPSLOGO { % Draw the CUPS logo
|
||||
+% % height CUPSLOGO
|
||||
+% % Start with a big C...
|
||||
+% /Helvetica findfont 1 index scalefont setfont
|
||||
+% 0 setgray
|
||||
+% 0 0 moveto
|
||||
+% (C) show
|
||||
+%
|
||||
+% % Then "UNIX Printing System" much smaller...
|
||||
+% /Helvetica-Bold findfont 1 index 9 div scalefont setfont
|
||||
+% 0.25 mul
|
||||
+% dup dup 2.0 mul moveto
|
||||
+% (UNIX) show
|
||||
+% dup dup 1.6 mul moveto
|
||||
+% (Printing) show
|
||||
+% dup 1.2 mul moveto
|
||||
+% (System) show
|
||||
+%} bind def
|
||||
+%/ESPLOGO { % Draw the ESP logo
|
||||
+% % height ESPLOGO
|
||||
+% % Compute the size of the logo...
|
||||
+% 0 0
|
||||
+% 2 index 1.5 mul 3 index
|
||||
+%
|
||||
+% % Do the "metallic" fill from 10% black to 40% black...
|
||||
+% 1 -0.001 0 {
|
||||
+% dup % loopval
|
||||
+% -0.15 mul % loopval * -0.15
|
||||
+% 0.9 add % 0.9 - loopval * 0.15
|
||||
+% setgray % set gray shade
|
||||
+%
|
||||
+% 0 % x
|
||||
+% 1 index neg % loopval
|
||||
+% 1 add % 1 - loopval
|
||||
+% 3 index % height
|
||||
+% mul % height * (1 - loopval)
|
||||
+% moveto % starting point
|
||||
+%
|
||||
+% dup % loopval
|
||||
+% 3 index % width
|
||||
+% mul % loopval * width
|
||||
+% 2 index % height
|
||||
+% lineto % Next point
|
||||
+%
|
||||
+% 0 % x
|
||||
+% 2 index % height
|
||||
+% lineto % Next point
|
||||
+%
|
||||
+% closepath
|
||||
+% fill
|
||||
+%
|
||||
+% dup % loopval
|
||||
+% 0.15 mul % loopval * 0.15
|
||||
+% 0.6 add % 0.6 + loopval * 0.15
|
||||
+% setgray
|
||||
+%
|
||||
+% dup % loopval
|
||||
+% neg 1 add % 1 - loopval
|
||||
+% 3 index % width
|
||||
+% mul % (1 - loopval) * width
|
||||
+% 0 % y
|
||||
+% moveto % Starting point
|
||||
+%
|
||||
+% 2 index % width
|
||||
+% exch % loopval
|
||||
+% 2 index % height
|
||||
+% mul % loopval * height
|
||||
+% lineto % Next point
|
||||
+%
|
||||
+% 1 index % width
|
||||
+% 0 % y
|
||||
+% lineto % Next point
|
||||
+%
|
||||
+% closepath
|
||||
+% fill
|
||||
+% } for
|
||||
+%
|
||||
+% 0 setgray rectstroke
|
||||
+%
|
||||
+% /Helvetica-BoldOblique findfont 1 index 3 div scalefont setfont
|
||||
+% dup 40 div
|
||||
+%
|
||||
+% dup 4 mul 1 index 25 mul moveto (E) show
|
||||
+% dup 10 mul 1 index 15 mul moveto (S) show
|
||||
+% dup 16 mul 1 index 5 mul moveto (P) show
|
||||
+%
|
||||
+% /Helvetica-BoldOblique findfont 2 index 5 div scalefont setfont
|
||||
+% dup 14 mul 1 index 29 mul moveto (asy) show
|
||||
+% dup 20 mul 1 index 19 mul moveto (oftware) show
|
||||
+% dup 26 mul 1 index 9 mul moveto (roducts) show
|
||||
+%
|
||||
+% pop
|
||||
+%} bind def
|
||||
%%EndResource
|
||||
%%EndProlog
|
||||
%%Page: 1 1
|
||||
@@ -480,9 +480,13 @@
|
||||
|
||||
% Draw the copyright notice at the bottom...
|
||||
pageWidth 36 mul % Center of page
|
||||
- pageHeight 10 mul % Bottom of page
|
||||
+ pageHeight 13 mul % Bottom of page
|
||||
2 copy moveto % Position text
|
||||
- (Printed Using CUPS v1.1.x) CENTER % Show text centered
|
||||
+ (Printed Using CUPS 1.1.23) CENTER % Show text centered
|
||||
+
|
||||
+ pageHeight 4 mul sub % Move down...
|
||||
+ 2 copy moveto % Position text
|
||||
+ (and personal build CUPS version) CENTER % Show text centered
|
||||
|
||||
pageHeight 2 mul sub % Move down...
|
||||
2 copy moveto % Position text
|
||||
@@ -490,30 +494,30 @@
|
||||
(Copyright 1993-2005 by Easy Software Products, All Rights Reserved.) CENTER
|
||||
pageHeight sub % Move down...
|
||||
2 copy moveto % Position text
|
||||
- (CUPS, Easy Software Products and their logos are the trademark property of) CENTER
|
||||
+ (NOVELL homepage: http://www.novell.com) CENTER
|
||||
pageHeight sub % Move down...
|
||||
2 copy moveto % Position text
|
||||
- (Easy Software Products, 44141 Airport View Drive, Suite 204,) CENTER
|
||||
+ (Test page derived from the CUPS test page.) CENTER
|
||||
pageHeight sub % Move down...
|
||||
2 copy moveto % Position text
|
||||
- (Hollywood, Maryland, 20636, USA.) CENTER
|
||||
+ (CUPS is a trademark property of Easy Software Products) CENTER
|
||||
|
||||
- % Then the CUPS logo....
|
||||
- gsave
|
||||
- pageWidth 4 mul
|
||||
- pageHeight 4 mul
|
||||
- translate
|
||||
- pageWidth 9 mul CUPSLOGO
|
||||
- grestore
|
||||
-
|
||||
- % And the ESP logo....
|
||||
- gsave
|
||||
- pageWidth 59 mul
|
||||
- pageHeight 4 mul
|
||||
- translate
|
||||
- pageWidth 6 mul ESPLOGO
|
||||
- grestore
|
||||
-% Show the page...
|
||||
+% % Then the CUPS logo....
|
||||
+% gsave
|
||||
+% pageWidth 4 mul
|
||||
+% pageHeight 4 mul
|
||||
+% translate
|
||||
+% pageWidth 9 mul CUPSLOGO
|
||||
+% grestore
|
||||
+
|
||||
+% % And the ESP logo....
|
||||
+% gsave
|
||||
+% pageWidth 59 mul
|
||||
+% pageHeight 4 mul
|
||||
+% translate
|
||||
+% pageWidth 6 mul ESPLOGO
|
||||
+% grestore
|
||||
+%% Show the page...
|
||||
grestore
|
||||
showpage
|
||||
%
|
93
cups-1.2.0-ppdsdat_generation.patch
Normal file
93
cups-1.2.0-ppdsdat_generation.patch
Normal file
@ -0,0 +1,93 @@
|
||||
--- cups-1.2.0/scheduler/main.c.orig 2006-03-18 04:05:12.000000000 +0100
|
||||
+++ cups-1.2.0/scheduler/main.c 2006-03-29 19:02:22.000000000 +0200
|
||||
@@ -148,6 +148,7 @@
|
||||
*/
|
||||
|
||||
fg = 0;
|
||||
+ ppds_generation = 0;
|
||||
|
||||
for (i = 1; i < argc; i ++)
|
||||
if (argv[i][0] == '-')
|
||||
@@ -219,6 +220,10 @@
|
||||
#endif /* HAVE_LAUNCHD */
|
||||
break;
|
||||
|
||||
+ case 'P' : /* generate ppds only */
|
||||
+ ppds_generation = 1;
|
||||
+ break;
|
||||
+
|
||||
default : /* Unknown option */
|
||||
_cupsLangPrintf(stderr, _("cupsd: Unknown option \"%c\" - "
|
||||
"aborting!\n"), *opt);
|
||||
@@ -287,17 +292,18 @@
|
||||
perror("cupsd");
|
||||
return (1);
|
||||
}
|
||||
- else if (WIFEXITED(i))
|
||||
+ else if (!ppds_generation && WIFEXITED(i))
|
||||
{
|
||||
fprintf(stderr, "cupsd: Child exited with status %d!\n",
|
||||
WEXITSTATUS(i));
|
||||
return (2);
|
||||
}
|
||||
- else
|
||||
+ else if (!ppds_generation || WTERMSIG(i)!=0)
|
||||
{
|
||||
fprintf(stderr, "cupsd: Child exited on signal %d!\n", WTERMSIG(i));
|
||||
return (3);
|
||||
- }
|
||||
+ } else
|
||||
+ return (0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -482,6 +488,9 @@
|
||||
}
|
||||
#endif /* __sgi */
|
||||
|
||||
+ if (ppds_generation > 0)
|
||||
+ return (stop_scheduler);
|
||||
+
|
||||
/*
|
||||
* Initialize authentication certificates...
|
||||
*/
|
||||
@@ -2260,13 +2269,14 @@
|
||||
usage(int status) /* O - Exit status */
|
||||
{
|
||||
_cupsLangPuts(status ? stderr : stdout,
|
||||
- _("Usage: cupsd [-c config-file] [-f] [-F] [-h] [-l]\n"
|
||||
+ _("Usage: cupsd [-c config-file] [-f] [-F] [-h] [-l] [-P]\n"
|
||||
"\n"
|
||||
"-c config-file Load alternate configuration file\n"
|
||||
"-f Run in the foreground\n"
|
||||
"-F Run in the foreground but detach\n"
|
||||
"-h Show this usage message\n"
|
||||
- "-l Run cupsd from launchd(8)\n"));
|
||||
+ "-l Run cupsd from launchd(8)\n"
|
||||
+ "-P Generate ppds.dat and exit\n"));
|
||||
exit(status);
|
||||
}
|
||||
|
||||
--- cups-1.2.0/scheduler/cupsd.h.orig 2006-03-18 04:05:12.000000000 +0100
|
||||
+++ cups-1.2.0/scheduler/cupsd.h 2006-03-29 17:30:47.000000000 +0200
|
||||
@@ -202,6 +202,8 @@
|
||||
char *envp[], int infd, int outfd,
|
||||
int errfd, int backfd, int root, int *pid);
|
||||
|
||||
+VAR int ppds_generation;/* Generate ppds.dat and exit() */
|
||||
+
|
||||
|
||||
/*
|
||||
* End of "$Id: cupsd.h 5305 2006-03-18 03:05:12Z mike $".
|
||||
--- cups-1.2.0/scheduler/conf.c.orig 2006-03-14 12:54:45.000000000 +0100
|
||||
+++ cups-1.2.0/scheduler/conf.c 2006-03-29 17:30:47.000000000 +0200
|
||||
@@ -716,6 +716,9 @@
|
||||
TempDir, strerror(errno));
|
||||
}
|
||||
|
||||
+ if (ppds_generation > 0)
|
||||
+ return(1);
|
||||
+
|
||||
/*
|
||||
* Setup environment variables...
|
||||
*/
|
27
cups-1.2.2-testppd_filename.patch
Normal file
27
cups-1.2.2-testppd_filename.patch
Normal file
@ -0,0 +1,27 @@
|
||||
--- cups-1.2.2/systemv/cupstestppd.c.orig 2006-07-25 18:43:43.000000000 +0200
|
||||
+++ cups-1.2.2/systemv/cupstestppd.c 2006-07-25 19:09:20.000000000 +0200
|
||||
@@ -90,6 +90,7 @@
|
||||
int i, j, k, m, n; /* Looping vars */
|
||||
int len; /* Length of option name */
|
||||
char *opt; /* Option character */
|
||||
+ char *ppdfilename; /* Pointer to actual PPD file */
|
||||
const char *ptr; /* Pointer into string */
|
||||
int files; /* Number of files */
|
||||
int verbose; /* Want verbose output? */
|
||||
@@ -293,6 +294,7 @@
|
||||
|
||||
errors = 0;
|
||||
ppdversion = 43;
|
||||
+ ppdfilename = argv[i];
|
||||
|
||||
if (verbose > 0)
|
||||
_cupsLangPuts(stdout,
|
||||
@@ -1204,7 +1206,7 @@
|
||||
|
||||
if (verbose >= 0)
|
||||
{
|
||||
- check_basics(argv[i]);
|
||||
+ check_basics(ppdfilename);
|
||||
|
||||
/*
|
||||
* Look for default keywords with no corresponding option...
|
11
cups-1.2.5-desktop_file.patch
Normal file
11
cups-1.2.5-desktop_file.patch
Normal file
@ -0,0 +1,11 @@
|
||||
--- cups-1.2.5/desktop/cups.desktop.orig 2006-10-02 18:26:04.000000000 +0200
|
||||
+++ cups-1.2.5/desktop/cups.desktop 2006-11-06 14:39:32.000000000 +0100
|
||||
@@ -1,7 +1,7 @@
|
||||
[Desktop Entry]
|
||||
Categories=Application;System;X-Red-Hat-Base;
|
||||
Encoding=UTF-8
|
||||
-Exec=htmlview http://localhost:631/
|
||||
+Exec=desktop-launch http://localhost:631/
|
||||
GenericName=
|
||||
Icon=cups
|
||||
MimeType=
|
12
cups-1.2.6-lppasswd_permission.patch
Normal file
12
cups-1.2.6-lppasswd_permission.patch
Normal file
@ -0,0 +1,12 @@
|
||||
--- cups-1.2.6/scheduler/conf.c.orig 2006-11-09 15:21:33.000000000 +0100
|
||||
+++ cups-1.2.6/scheduler/conf.c 2006-11-09 15:30:46.000000000 +0100
|
||||
@@ -640,7 +640,9 @@
|
||||
check_permissions(StateDir, NULL, 0755, RunUser, Group, 1, 1) < 0 ||
|
||||
check_permissions(StateDir, "certs", RunUser ? 0711 : 0511, User,
|
||||
SystemGroupIDs[0], 1, 1) < 0 ||
|
||||
+#if 0
|
||||
check_permissions(ServerRoot, NULL, 0755, RunUser, Group, 1, 0) < 0 ||
|
||||
+#endif
|
||||
check_permissions(ServerRoot, "ppd", 0755, RunUser, Group, 1, 1) < 0 ||
|
||||
check_permissions(ServerRoot, "ssl", 0700, RunUser, Group, 1, 0) < 0 ||
|
||||
check_permissions(ServerRoot, "cupsd.conf", ConfigFilePerm, RunUser,
|
3
cups-1.2.7-source.tar.bz2
Normal file
3
cups-1.2.7-source.tar.bz2
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e7485d6b3dcbd338a2361aff66c516f8dfafc1c81ea5b01396f6ee5f365c4eb3
|
||||
size 3585758
|
10
cups-1.2b2-access_conf.patch
Normal file
10
cups-1.2b2-access_conf.patch
Normal file
@ -0,0 +1,10 @@
|
||||
--- cups-1.2b2/conf/cupsd.conf.in.orig 2006-02-16 13:28:29.000000000 +0100
|
||||
+++ cups-1.2b2/conf/cupsd.conf.in 2006-03-14 21:10:37.000000000 +0100
|
||||
@@ -29,6 +29,7 @@
|
||||
<Location />
|
||||
Order allow,deny
|
||||
Allow localhost
|
||||
+ Allow 127.0.0.2
|
||||
</Location>
|
||||
|
||||
# Restrict access to the admin pages...
|
12
cups-1.2rc1-template.patch
Normal file
12
cups-1.2rc1-template.patch
Normal file
@ -0,0 +1,12 @@
|
||||
--- cups-1.2rc1/templates/choose-uri.tmpl.orig 2006-03-18 13:56:48.000000000 +0100
|
||||
+++ cups-1.2rc1/templates/choose-uri.tmpl 2006-03-29 20:03:30.000000000 +0200
|
||||
@@ -24,6 +24,9 @@
|
||||
|
||||
lpd://hostname/queue
|
||||
|
||||
+ smb://servername/printer
|
||||
+ smb://username:password@workgroup/servername/printer
|
||||
+
|
||||
socket://hostname
|
||||
socket://hostname:9100
|
||||
</PRE>
|
50
cups-1.2rc3-libwrap.patch
Normal file
50
cups-1.2rc3-libwrap.patch
Normal file
@ -0,0 +1,50 @@
|
||||
--- cups-1.2rc3/scheduler/Makefile.orig 2006-03-05 17:48:12.000000000 +0100
|
||||
+++ cups-1.2rc3/scheduler/Makefile 2006-04-26 16:52:06.000000000 +0200
|
||||
@@ -73,6 +73,7 @@
|
||||
testmime \
|
||||
testspeed
|
||||
|
||||
+CUPSDLIBS += -lwrap
|
||||
|
||||
#
|
||||
# Make everything...
|
||||
--- cups-1.2rc3/scheduler/client.c.orig 2006-04-17 23:24:17.000000000 +0200
|
||||
+++ cups-1.2rc3/scheduler/client.c 2006-04-26 16:34:40.000000000 +0200
|
||||
@@ -59,6 +59,11 @@
|
||||
# include <gnutls/x509.h>
|
||||
#endif /* HAVE_GNUTLS */
|
||||
|
||||
+#include <tcpd.h>
|
||||
+#include <syslog.h>
|
||||
+int allow_severity = LOG_INFO;
|
||||
+int deny_severity = LOG_WARNING;
|
||||
+
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
@@ -149,6 +154,25 @@
|
||||
return;
|
||||
}
|
||||
|
||||
+ /*
|
||||
+ * libwrap/tcp_wrappers:
|
||||
+ * draht@suse.de, Tue Jan 29 2002
|
||||
+ */
|
||||
+
|
||||
+ {
|
||||
+ struct request_info wrap_req;
|
||||
+
|
||||
+ request_init(&wrap_req, RQ_DAEMON, "cupsd" , RQ_FILE, con->http.fd, NULL);
|
||||
+ fromhost(&wrap_req);
|
||||
+ if (!hosts_access(&wrap_req)) { /* we do not accept the connection: */
|
||||
+ cupsdLogMessage(CUPSD_LOG_WARN,
|
||||
+ "tcp_wrappers refused connection from %s. See /etc/hosts.allow and /etc/hosts.deny.",
|
||||
+ eval_client(&wrap_req));
|
||||
+ close(con->http.fd);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
#ifdef AF_INET6
|
||||
if (lis->address.addr.sa_family == AF_INET6)
|
||||
{
|
22
cups-1.2rc3-mime.patch
Normal file
22
cups-1.2rc3-mime.patch
Normal file
@ -0,0 +1,22 @@
|
||||
--- cups-1.2rc3/conf/mime.types.orig 2006-04-14 21:21:03.000000000 +0200
|
||||
+++ cups-1.2rc3/conf/mime.types 2006-04-26 16:31:35.000000000 +0200
|
||||
@@ -80,6 +80,8 @@
|
||||
contains(0,1024,"LANGUAGE = POSTSCRIPT") \
|
||||
(contains(0,1024,<0a>%!) + \
|
||||
!contains(0,1024,"ENTER LANGUAGE")))
|
||||
+#application/x-dvi dvi string(0,<F702>)
|
||||
+application/netscape-ps ps (string(0,%!) + contains(30,200,"Mozilla"))
|
||||
application/vnd.hp-HPGL hpgl string(0,<1B>&)\
|
||||
string(0,<1B>E<1B>%0B) \
|
||||
string(0,<1B>%-1B) string(0,<201B>)\
|
||||
--- cups-1.2rc3/conf/mime.convs.orig 2006-04-14 21:21:03.000000000 +0200
|
||||
+++ cups-1.2rc3/conf/mime.convs 2006-04-26 16:31:04.000000000 +0200
|
||||
@@ -45,6 +45,8 @@
|
||||
|
||||
application/pdf application/postscript 33 pdftops
|
||||
application/postscript application/vnd.cups-postscript 66 pstops
|
||||
+#application/x-dvi application/postscript 50 dvitops
|
||||
+application/netscape-ps application/vnd.cups-postscript 33 ogonki
|
||||
application/vnd.hp-HPGL application/postscript 66 hpgltops
|
||||
application/x-cshell application/postscript 33 texttops
|
||||
application/x-csource application/postscript 33 texttops
|
27
cups-1.2rc3-pswrite.patch
Normal file
27
cups-1.2rc3-pswrite.patch
Normal file
@ -0,0 +1,27 @@
|
||||
--- cups-1.2rc3/conf/mime.convs.orig 2006-04-26 17:24:57.000000000 +0200
|
||||
+++ cups-1.2rc3/conf/mime.convs 2006-04-26 17:32:16.000000000 +0200
|
||||
@@ -46,7 +46,9 @@
|
||||
application/pdf application/postscript 33 pdftops
|
||||
application/postscript application/vnd.cups-postscript 66 pstops
|
||||
#application/x-dvi application/postscript 50 dvitops
|
||||
-application/netscape-ps application/vnd.cups-postscript 33 ogonki
|
||||
+application/netscape-ps application/postscript 33 ogonki
|
||||
+#application/mozilla-ps application/postscript 33 pswrite
|
||||
+application/mozilla-ps application/vnd.cups-postscript 66 pstops
|
||||
application/vnd.hp-HPGL application/postscript 66 hpgltops
|
||||
application/x-cshell application/postscript 33 texttops
|
||||
application/x-csource application/postscript 33 texttops
|
||||
--- cups-1.2rc3/conf/mime.types.orig 2006-04-26 17:24:57.000000000 +0200
|
||||
+++ cups-1.2rc3/conf/mime.types 2006-04-26 17:30:33.000000000 +0200
|
||||
@@ -81,7 +81,10 @@
|
||||
(contains(0,1024,<0a>%!) + \
|
||||
!contains(0,1024,"ENTER LANGUAGE")))
|
||||
#application/x-dvi dvi string(0,<F702>)
|
||||
-application/netscape-ps ps (string(0,%!) + contains(30,200,"Mozilla"))
|
||||
+application/mozilla-ps ps (string(0,%!) + \
|
||||
+ contains(30,200,"Creator: Mozilla PostScript"))
|
||||
+application/netscape-ps ps (string(0,%!) + \
|
||||
+ contains(30,200,"Creator: Mozilla (NetScape)"))
|
||||
application/vnd.hp-HPGL hpgl string(0,<1B>&)\
|
||||
string(0,<1B>E<1B>%0B) \
|
||||
string(0,<1B>%-1B) string(0,<201B>)\
|
5
cups-pam.diff
Normal file
5
cups-pam.diff
Normal file
@ -0,0 +1,5 @@
|
||||
--- conf/pam.suse 2003/02/07 11:09:32 1.1
|
||||
+++ conf/pam.suse 2003/02/07 11:10:03
|
||||
@@ -0,0 +1,2 @@
|
||||
+auth include common-auth
|
||||
+account include common-account
|
1411
cups.changes
Normal file
1411
cups.changes
Normal file
File diff suppressed because it is too large
Load Diff
17
cups.sysconfig
Normal file
17
cups.sysconfig
Normal file
@ -0,0 +1,17 @@
|
||||
## Path: System/Printing/CUPS
|
||||
## Description: Cups options
|
||||
## Type: string
|
||||
## Default: cups
|
||||
## ServiceReload: cups
|
||||
## ServiceRestart: cups
|
||||
#
|
||||
IDENT="cups"
|
||||
## Type: string
|
||||
## Default: "CUPS printer daemon"
|
||||
DESCRIPTIVE="CUPS printer daemon"
|
||||
## Type: string
|
||||
## Default: ""
|
||||
#
|
||||
# change CUPSD_OPTIONS for arguments of start of cupsd
|
||||
# e.g. CUPSD_OPTIONS="-c /etc/cups/cupsd.conf"
|
||||
CUPSD_OPTIONS=""
|
11
cups.xinetd
Normal file
11
cups.xinetd
Normal file
@ -0,0 +1,11 @@
|
||||
service printer
|
||||
{
|
||||
disable = yes
|
||||
flags = NAMEINARGS
|
||||
socket_type = stream
|
||||
protocol = tcp
|
||||
wait = no
|
||||
user = lp
|
||||
server = @LIB@/cups/daemon/cups-lpd
|
||||
server_args = cups-lpd -o document-format=application/octet-stream
|
||||
}
|
41
dvitops
Normal file
41
dvitops
Normal file
@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
|
||||
if test "$#" -lt "5"; then
|
||||
echo "ERROR: Number of arguments ($#) is wrong" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test "$#" -gt "6"; then
|
||||
echo "ERROR: Number of arguments ($#) is wrong" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Log the command line
|
||||
echo dvitops: $@ 1>&2
|
||||
|
||||
# Get the last parameter (which is the filename if present)
|
||||
eval filename="\${$#}"
|
||||
|
||||
if [ -e $filename ]; then
|
||||
FILE_TO_PRINT=$filename;
|
||||
else
|
||||
FILE_TO_PRINT="";
|
||||
fi
|
||||
|
||||
if [ -z $FILE_TO_PRINT ]; then
|
||||
FILE_TO_PRINT=`mktemp -q /tmp/dvitops.XXXXXX`
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: Can't create temp file, exiting..." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
trap "rm -f $FILE_TO_PRINT" EXIT SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
|
||||
cat >$FILE_TO_PRINT
|
||||
fi
|
||||
|
||||
if [ -z $FILE_TO_PRINT ]; then
|
||||
/usr/bin/dvips -q -f
|
||||
else
|
||||
/usr/bin/dvips -q -f <$FILE_TO_PRINT
|
||||
fi
|
||||
|
||||
|
362
lphelp.c
Normal file
362
lphelp.c
Normal file
@ -0,0 +1,362 @@
|
||||
/*
|
||||
*
|
||||
* lphelp
|
||||
* ------
|
||||
#
|
||||
# A simple tool for getting information about an installed printer or a
|
||||
# PPD file. Especially the printer-specific options defined in the PPD
|
||||
# file are listed, so that one can make use of them with the "lp", "lpr",
|
||||
# and "lpoptions" commands. The programm can also be used by installation/
|
||||
# configuration scripts to give a "preview" to a PPD file.
|
||||
#
|
||||
# ONLY WORKS WITH CUPS DAEMON RUNNING!
|
||||
# The CUPS library (libcups.so.*) must be installed!
|
||||
#
|
||||
# Compile with: gcc -olphelp -lcups lphelp.c
|
||||
#
|
||||
* Copyright 2000 by Till Kamppeter
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
* 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <cups/cups.h>
|
||||
|
||||
/*
|
||||
* 'main()' - Main entry for test program.
|
||||
*/
|
||||
|
||||
int /* O - Exit status */
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
int i, j, k, m; /* Looping vars */
|
||||
const char *filename; /* File to load */
|
||||
FILE *ppdfile;
|
||||
|
||||
// Temporary file name (for reading from stdin)
|
||||
char tmpfile[19] = "/tmp/lphelp.XXXXXX";
|
||||
const int blocksize = 1024;
|
||||
char buffer[blocksize];
|
||||
int bytesread;
|
||||
|
||||
// variables for parsing PPD file for usual options (boolean, enumerated)
|
||||
ppd_file_t *ppd; /* PPD file record */
|
||||
ppd_size_t *size; /* Size record */
|
||||
ppd_group_t *group; /* UI group */
|
||||
ppd_option_t *option; /* Standard UI option */
|
||||
ppd_choice_t *choice; /* Standard UI option choice */
|
||||
static char *uis[] = { "BOOLEAN", "PICKONE", "PICKMANY" };
|
||||
static char *sections[] = { "ANY", "DOCUMENT", "EXIT",
|
||||
"JCL", "PAGE", "PROLOG" };
|
||||
|
||||
// variables for parsing CUPS-O-MATIC info for numerical options (float, int)
|
||||
char line[1024], /* buffer for reading PPD file line by
|
||||
line to search numerical options */
|
||||
item[1024], /* item to be defined (left of "=>") */
|
||||
value[1024], /* value for item (right of "=>") */
|
||||
argname[1024], /* name of the current argument */
|
||||
comment[1024]; /* human-readable argument name */
|
||||
const char *line_contents; /* contents of line */
|
||||
const char *scan; /* pointer scanning the line */
|
||||
char *writepointer;
|
||||
double min, max, defvalue; /* Range of numerical
|
||||
CUPS-O-MATIC option */
|
||||
int opttype; /* 0 = other, 1 = int, 2 = float */
|
||||
int openbrackets; /* How many curled brackets are open? */
|
||||
int inquotes; /* are we in quotes now? */
|
||||
int inargspart; /* are we in the arguments part now? */
|
||||
|
||||
/*
|
||||
* Display PPD files for each file listed on the command-line...
|
||||
*/
|
||||
|
||||
if (argc == 1) {
|
||||
fputs("Usage: lphelp <filename1>.ppd [<filename2>.ppd ...]\n lphelp <printername1> [<printername2> ...]\n lphelp -\n", stderr);
|
||||
return (1);
|
||||
}
|
||||
|
||||
for (i = 1; i < argc; i ++) {
|
||||
if ((strstr(argv[i], ".ppd")) || (strstr(argv[i], "-")))
|
||||
filename = argv[i];
|
||||
else
|
||||
filename = cupsGetPPD(argv[i]);
|
||||
if (strcmp(filename,"-") == 0) {
|
||||
if ((ppdfile = fdopen(mkstemp(tmpfile), "w")) == NULL) {
|
||||
fprintf(stderr, "Unable to generate temporary file!\n");
|
||||
}
|
||||
while ((bytesread = fread(buffer, 1, blocksize, stdin)) > 0) {
|
||||
fwrite(buffer, 1, bytesread, ppdfile);
|
||||
}
|
||||
fclose(ppdfile);
|
||||
filename = tmpfile;
|
||||
}
|
||||
if ((ppd = ppdOpenFile(filename)) == NULL) {
|
||||
fprintf(stderr, "Unable to open \'%s\' as a PPD file!\n", filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
printf("==============================================================================\n\n");
|
||||
printf("%s\n\n", ppd->modelname);
|
||||
printf("==============================================================================\n\n");
|
||||
printf(" %s printer\n\n", ppd->color_device ? "Colour" : "Black & white");
|
||||
printf(" Printer-specific options\n");
|
||||
printf(" ------------------------\n\n");
|
||||
printf(" Besides the options described in the CUPS software users manual\n");
|
||||
printf(" (http://localhost:631/sum.html) you can use also the following options\n");
|
||||
printf(" when you print on this printer with the \"lp\" or \"lpr\" command (a choice\n");
|
||||
printf(" with the \"default\" mark represents the behaviour of the printer when the\n");
|
||||
printf(" appropriate option is not given on the command line):\n\n");
|
||||
|
||||
for (j = 0, group = ppd->groups; j < ppd->num_groups; j ++, group ++) {
|
||||
for (k = 0, option = group->options; k < group->num_options;
|
||||
k ++, option ++) {
|
||||
if (strcmp(option->keyword, "PageRegion") != 0) {
|
||||
if ((strcmp(uis[option->ui],"BOOLEAN") == 0) ||
|
||||
(strcmp(uis[option->ui],"PICKONE") == 0)) {
|
||||
printf(" %s: -o %s=<choice>\n\n",
|
||||
option->text, option->keyword);
|
||||
printf(" <choice> can be one of the following:\n\n");
|
||||
} else {
|
||||
printf(" %s: -o %s=<choice1>,<choice2>,...\n\n",
|
||||
option->text, option->keyword);
|
||||
printf(" <choice1>, <choice2>, and so on can be out of the following:\n\n");
|
||||
}
|
||||
if (strcmp(option->keyword, "PageSize") == 0) {
|
||||
for (m = option->num_choices, choice = option->choices;
|
||||
m > 0;
|
||||
m --, choice ++) {
|
||||
size = ppdPageSize(ppd, choice->choice);
|
||||
|
||||
if (size == NULL)
|
||||
printf(" %s (%s, size unknown", choice->choice, choice->text);
|
||||
else
|
||||
printf(" %s (%s, size: %.2fx%.2fin", choice->choice,
|
||||
choice->text, size->width / 72.0, size->length / 72.0);
|
||||
if (strcmp(option->defchoice, choice->choice) == 0)
|
||||
puts(", default)");
|
||||
else
|
||||
puts(")");
|
||||
}
|
||||
} else {
|
||||
for (m = option->num_choices, choice = option->choices;
|
||||
m > 0;
|
||||
m --, choice ++) {
|
||||
printf(" %s (%s", choice->choice, choice->text);
|
||||
if (strcmp(option->defchoice, choice->choice) == 0)
|
||||
puts(", default)");
|
||||
else
|
||||
puts(")");
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
ppdClose(ppd);
|
||||
|
||||
// Search for numerical options of CUPS-O-MATIC
|
||||
if ((ppdfile = fopen(filename,"r")) == NULL) {
|
||||
fprintf(stderr, "Unable to open \'%s\' as a PPD file!\n", filename);
|
||||
continue;
|
||||
}
|
||||
// Reset all variables
|
||||
opttype = 0;
|
||||
min = 0.0; max = 0.0; defvalue = 0.0;
|
||||
openbrackets = 0;
|
||||
inquotes = 0;
|
||||
writepointer = item;
|
||||
inargspart = 0;
|
||||
// Read the PPD file again, line by line.
|
||||
while (fgets(line,sizeof(line),ppdfile)) {
|
||||
// evaluate only lines with CUPS-O-MATIC info
|
||||
if (line_contents = strstr(line,"*% COMDATA #")) {
|
||||
line_contents += 12; // Go to the text after
|
||||
// "*% COMDATA #"
|
||||
for (scan = line_contents;
|
||||
(*scan != '\n') && (*scan != '\0');
|
||||
scan ++) {
|
||||
switch(*scan) {
|
||||
case '[': // open square bracket
|
||||
case '{': // open curled bracket
|
||||
if (!inquotes) {
|
||||
openbrackets ++;
|
||||
// we are on the left hand side now
|
||||
*writepointer = '\0';
|
||||
writepointer = item;
|
||||
// in which type of block are we now?
|
||||
if ((openbrackets == 2) &&
|
||||
(strncasecmp(item,"args",4) == 0)) {
|
||||
// we are entering the arguments section now
|
||||
inargspart = 1;
|
||||
}
|
||||
if ((openbrackets == 3) &&
|
||||
(inargspart == 1)) {
|
||||
// new argument, get its name
|
||||
strcpy(argname,item);
|
||||
}
|
||||
// item already evaluated now
|
||||
item[0] = '\0';
|
||||
} else {*writepointer = *scan; writepointer ++;}
|
||||
break;
|
||||
case ',': // end of logical line
|
||||
case ']': // close square bracket
|
||||
case '}': // close curled bracket
|
||||
if (!inquotes) {
|
||||
// right hand side completed, go to left hand side
|
||||
*writepointer = '\0';
|
||||
writepointer = item;
|
||||
// evaluate logical line
|
||||
if (item[0]) {
|
||||
// Machine-readable argument name
|
||||
if ((openbrackets == 3) &&
|
||||
(inargspart == 1) &&
|
||||
(strcasecmp(item,"name") == 0)) {
|
||||
strcpy(argname,value);
|
||||
}
|
||||
// Human-readable argument name
|
||||
if ((openbrackets == 3) &&
|
||||
(inargspart == 1) &&
|
||||
(strcasecmp(item,"comment") == 0)) {
|
||||
strcpy(comment,value);
|
||||
}
|
||||
// argument type
|
||||
if ((openbrackets == 3) &&
|
||||
(inargspart == 1) &&
|
||||
(strcasecmp(item,"type") == 0)) {
|
||||
if (strcasecmp(value,"int") == 0) opttype = 1;
|
||||
if (strcasecmp(value,"float") == 0) opttype = 2;
|
||||
}
|
||||
// minimum value
|
||||
if ((openbrackets == 3) &&
|
||||
(inargspart == 1) &&
|
||||
(strcasecmp(item,"min") == 0)) {
|
||||
min = atof(value);
|
||||
}
|
||||
// maximum value
|
||||
if ((openbrackets == 3) &&
|
||||
(inargspart == 1) &&
|
||||
(strcasecmp(item,"max") == 0)) {
|
||||
max = atof(value);
|
||||
}
|
||||
// default value
|
||||
if ((openbrackets == 3) &&
|
||||
(inargspart == 1) &&
|
||||
(strcasecmp(item,"default") == 0)) {
|
||||
defvalue = atof(value);
|
||||
}
|
||||
// item already evaluated now
|
||||
item[0] = '\0';
|
||||
}
|
||||
// close bracket
|
||||
if ((*scan == '}') || (*scan == ']')) {
|
||||
// which block did we complete now?
|
||||
if ((openbrackets == 2) &&
|
||||
(inargspart == 1)) {
|
||||
// We are leaving the arguments part now
|
||||
inargspart = 0;
|
||||
}
|
||||
if ((openbrackets == 3) &&
|
||||
(inargspart == 1)) {
|
||||
// The current option is completely parsed
|
||||
// Is the option a valid numerical option?
|
||||
if ((opttype > 0) &&
|
||||
(min != max) &&
|
||||
(argname[0])) {
|
||||
// Correct the default value, if necessary
|
||||
if (min < max) {
|
||||
if (defvalue < min) defvalue = min;
|
||||
if (defvalue > max) defvalue = max;
|
||||
} else {
|
||||
if (defvalue < max) defvalue = max;
|
||||
if (defvalue > min) defvalue = min;
|
||||
}
|
||||
// Show the found argument
|
||||
printf(" %s: -o %s=<value>\n\n",
|
||||
comment, argname);
|
||||
if (opttype == 1) {
|
||||
printf(
|
||||
" <value> must be an integer number in the range %d..%d\n",
|
||||
(int)(min),(int)(max));
|
||||
printf(
|
||||
" The default value is %d\n\n",
|
||||
(int)(defvalue));
|
||||
} else {
|
||||
printf(
|
||||
" <value> must be a decimal number in the range %.2f..%.2f\n",
|
||||
min,max);
|
||||
printf(
|
||||
" The default value is %.2f\n\n",
|
||||
defvalue);
|
||||
}
|
||||
}
|
||||
// reset the values
|
||||
argname[0] = '\0';
|
||||
opttype = 0;
|
||||
min = 0.0; max = 0.0; defvalue = 0.0;
|
||||
}
|
||||
openbrackets --;
|
||||
}
|
||||
} else {*writepointer = *scan; writepointer ++;}
|
||||
break;
|
||||
case '\'': // quote
|
||||
if (!inquotes) { // open quote pair
|
||||
inquotes = 1;
|
||||
} else { // close quote pair
|
||||
inquotes = 0;
|
||||
}
|
||||
break;
|
||||
case '=': // "=>"
|
||||
if ((!inquotes) && (*(scan + 1) == '>')) {
|
||||
scan ++;
|
||||
// left hand side completed, go to right hand side
|
||||
*writepointer = '\0';
|
||||
writepointer = value;
|
||||
} else {*writepointer = *scan; writepointer ++;}
|
||||
break;
|
||||
case ' ': // white space
|
||||
case '\t':
|
||||
if (!inquotes) {
|
||||
// ignore white space outside quotes
|
||||
} else {*writepointer = *scan; writepointer ++;}
|
||||
break;
|
||||
default:
|
||||
// write all other characters
|
||||
*writepointer = *scan; writepointer ++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
inquotes = 0; // quote pairs cannot enclose more
|
||||
// than one line
|
||||
}
|
||||
}
|
||||
fclose(ppdfile);
|
||||
printf("\n\n\n");
|
||||
}
|
||||
|
||||
if (!(strstr(tmpfile, "XXXXXX"))) {
|
||||
unlink(tmpfile);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
50
ogonki
Normal file
50
ogonki
Normal file
@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
|
||||
if test "$#" -lt "5"; then
|
||||
echo "ERROR: Number of arguments ($#) is wrong" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test "$#" -gt "6"; then
|
||||
echo "ERROR: Number of arguments ($#) is wrong" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Log the command line
|
||||
echo ogonkify: $@ 1>&2
|
||||
|
||||
# Get the last parameter (which is the filename if present)
|
||||
eval filename="\${$#}"
|
||||
|
||||
case "$CHARSET" in
|
||||
iso-8859-1) CMD="cat " ;;
|
||||
iso-8859-2) CMD="/usr/bin/ogonkify -AT -N " ;;
|
||||
iso-8859-3) CMD="/usr/bin/ogonkify -e L3 -AT -N " ;;
|
||||
iso-8859-4) CMD="/usr/bin/ogonkify -e L4 -AT -N " ;;
|
||||
iso-8859-9) CMD="/usr/bin/ogonkify -e L5 -AT -N " ;;
|
||||
iso-8859-10) CMD="/usr/bin/ogonkify -e L6 -AT -N " ;;
|
||||
iso-8859-15) CMD="/usr/bin/ogonkify -e L9 -AT -N " ;;
|
||||
*) CMD="cat " ;;
|
||||
esac
|
||||
|
||||
if [ -e $filename ]; then
|
||||
FILE_TO_PRINT=$filename;
|
||||
else
|
||||
FILE_TO_PRINT="";
|
||||
fi
|
||||
|
||||
if [ -z $FILE_TO_PRINT ]; then
|
||||
FILE_TO_PRINT=`mktemp -q /tmp/ogonki.XXXXXX`
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: Can't create temp file, exiting..." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
trap "rm -f $FILE_TO_PRINT" EXIT SIGHUP SIGINT SIGQUIT SIGABRT SIGTERM
|
||||
cat >$FILE_TO_PRINT
|
||||
fi
|
||||
|
||||
if [ -z $FILE_TO_PRINT ]; then
|
||||
eval $CMD
|
||||
else
|
||||
eval $CMD <$FILE_TO_PRINT
|
||||
fi
|
302
poll_ppd_base.c
Normal file
302
poll_ppd_base.c
Normal file
@ -0,0 +1,302 @@
|
||||
/*
|
||||
*
|
||||
* poll_ppd_base
|
||||
* -------------
|
||||
#
|
||||
# A simple tool for getting a list of all installed PPD files
|
||||
# with printer manufacturer and printer model, polling the database
|
||||
# of the CUPS daemon. This program is mainly intended to be called
|
||||
# from installation/configuration scripts for CUPS.
|
||||
#
|
||||
# ONLY WORKS WITH CUPS DAEMON RUNNING!
|
||||
# The CUPS library (libcups.so.*) must be installed!
|
||||
#
|
||||
# Compile with: gcc -opoll_ppd_base -lcups poll_ppd_base.c
|
||||
#
|
||||
* Copyright 2000 by Till Kamppeter
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
* 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <cups/cups.h>
|
||||
#include <cups/ipp.h>
|
||||
#include <cups/language.h>
|
||||
|
||||
// IPP Request routines for getting the printer type, stolen from QTCUPS from
|
||||
// Michael Goffioul (file qtcups/cupshelper.cpp)
|
||||
|
||||
ipp_t* newIppRequest()
|
||||
{
|
||||
ipp_t *request;
|
||||
cups_lang_t *lang;
|
||||
request = ippNew();
|
||||
request->request.op.request_id = 1;
|
||||
lang = cupsLangDefault();
|
||||
ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_CHARSET,"attributes-charset",NULL,cupsLangEncoding(lang));
|
||||
ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_LANGUAGE,"attributes-natural-language",NULL,lang->language);
|
||||
return request;
|
||||
}
|
||||
|
||||
ipp_t* processRequest(ipp_t *req, const char *res)
|
||||
{
|
||||
http_t *HTTP;
|
||||
ipp_t *answer;
|
||||
HTTP = httpConnect(cupsServer(),ippPort());
|
||||
if (!HTTP) {
|
||||
ippDelete(req);
|
||||
return 0;
|
||||
}
|
||||
answer = cupsDoRequest(HTTP,req,res);
|
||||
httpClose(HTTP);
|
||||
if (!answer) return 0;
|
||||
if (answer->state == IPP_ERROR || answer->state == IPP_IDLE) {
|
||||
ippDelete(answer);
|
||||
return 0;
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
|
||||
ipp_t *getPPDList()
|
||||
{
|
||||
ipp_t *request = newIppRequest();
|
||||
char str[1024];
|
||||
const char* server = cupsServer();
|
||||
int port = ippPort();
|
||||
|
||||
request->request.op.operation_id = CUPS_GET_PPDS;
|
||||
if ((!server) || (port < 0)) return NULL;
|
||||
sprintf(str,"ipp://%s:%d/printers/",cupsServer(),ippPort());
|
||||
ippAddString(request,IPP_TAG_OPERATION,IPP_TAG_URI,"printer-uri",NULL,str);
|
||||
//str.sprintf("/printers/%s",name);
|
||||
request = processRequest(request,"/");
|
||||
return request;
|
||||
}
|
||||
|
||||
/*
|
||||
* Main program
|
||||
*/
|
||||
|
||||
int /* O - exit state */
|
||||
main(int argc, /* I - Number of command-line arguments */
|
||||
char *argv[]) /* I - Command-line arguments */
|
||||
{
|
||||
int i,j; /* Looping vars */
|
||||
int makelen = 0; /* Length of current manufacturer name */
|
||||
int makelist = 0; /* List of manufacturers */
|
||||
int makegiven = 0; /* List of models for given manufacturer */
|
||||
int all = 0; /* LIst of all models */
|
||||
char *make; /* Chosen manufacturer */
|
||||
ipp_t *ppdlist; /* List of PPD files resulting from IPP */
|
||||
/* request */
|
||||
ipp_attribute_t *attr, /* Current attribute */
|
||||
*last; /* Last attribute */
|
||||
char *currmake, /* current data red from PPD list */
|
||||
*currmod,
|
||||
*currlang,
|
||||
*currfile,
|
||||
*c;
|
||||
char buffer[80],
|
||||
buffer2[256];
|
||||
int lineprinted = 1; /* Is the current line already printed to
|
||||
stdout */
|
||||
|
||||
// read command line arguments
|
||||
|
||||
for (i = 1; i < argc; i ++)
|
||||
if (argv[i][0] == '-') {
|
||||
switch (argv[i][1]) {
|
||||
case 'm' : /* Manufacturer options */
|
||||
if (argv[i][2] != '\0') {
|
||||
if (strcmp(argv[i],"-ml") == 0) {
|
||||
makelist = 1;
|
||||
} else {
|
||||
make = argv[i] + 2;
|
||||
makegiven = 1;
|
||||
}
|
||||
} else {
|
||||
i ++;
|
||||
if (!(make = argv[i])) return 1;
|
||||
makegiven = 1;
|
||||
}
|
||||
break;
|
||||
case 'a' : /* List all PPD files */
|
||||
all = 1;
|
||||
break;
|
||||
default :
|
||||
fprintf(stderr,"Unknown option \'%c\'!\n", argv[i][1]);
|
||||
fprintf(stderr,"Start program without options for help!\n");
|
||||
return(1);
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr,"Unknown option \'%s\'!", argv[i]);
|
||||
fprintf(stderr,"Start program without options for help!\n");
|
||||
return(1);
|
||||
}
|
||||
if ((all) || (makegiven)) { // list all PPDs or PPDs of given manufacturer
|
||||
ppdlist = getPPDList();
|
||||
if (!ppdlist) return 1;
|
||||
for (attr = ppdlist->attrs; // go through all entries
|
||||
attr != NULL;
|
||||
attr = attr->next)
|
||||
if (attr->name) {
|
||||
// read data items
|
||||
if (strcmp(attr->name, "ppd-name") == 0) {
|
||||
currfile = attr->values[0].string.text;
|
||||
lineprinted = 0;
|
||||
} else if (strcmp(attr->name, "ppd-make") == 0) {
|
||||
currmake = attr->values[0].string.text;
|
||||
} else if (strcmp(attr->name, "ppd-make-and-model") == 0) {
|
||||
currmod = attr->values[0].string.text;
|
||||
} else if (strcmp(attr->name, "ppd-natural-language") == 0) {
|
||||
currlang = attr->values[0].string.text;
|
||||
}
|
||||
} else { // attr->name = NULL ==> data set completed
|
||||
lineprinted = 1;
|
||||
// Fill empty entries with some default stuff
|
||||
if (!currmod) currmod = "UNKNOWN";
|
||||
if (!currmake) currmake = "UNKNOWN";
|
||||
if (!currlang) currlang = "en";
|
||||
// Remove the manufacturer's name from the model entries
|
||||
makelen = strlen(currmake);
|
||||
if (strcasecmp(currmake,"UNKNOWN") != 0) {
|
||||
if (strncasecmp(currmake,currmod,makelen) == 0) {
|
||||
currmod += makelen;
|
||||
while ((*currmod == ' ') ||
|
||||
(*currmod == '-') ||
|
||||
(*currmod == '\t')) currmod ++;
|
||||
}
|
||||
}
|
||||
// Make the manufacturer's name all-uppercase
|
||||
currmake = strcpy(buffer,currmake);
|
||||
for (i = 0; i < makelen; i ++) buffer[i] = toupper(buffer[i]);
|
||||
// Clean up the driver info
|
||||
currmod = strcpy(buffer2,currmod);
|
||||
if (c = strstr(currmod, "Foomatic + Postscript")) {
|
||||
memmove(c, "PostScript", 10);
|
||||
memmove(c + 10, c + 21, strlen(c) - 20);
|
||||
} else if (c = strstr(currmod, "Foomatic")) {
|
||||
memmove(c + 11, c + 8, strlen(c) - 7);
|
||||
memmove(c, "GhostScript", 11);
|
||||
} else if (c = strstr(currmod, "CUPS+GIMP-print")) {
|
||||
memmove(c + 17, c + 15, strlen(c) - 14);
|
||||
memmove(c, "CUPS + GIMP-Print", 17);
|
||||
} else if (c = strstr(currmod, "Series CUPS")) {
|
||||
memmove(c + 12, c + 11, strlen(c) - 10);
|
||||
memmove(c, "Series, CUPS", 12);
|
||||
} else if (!((strstr(currmod, "PostScript")) ||
|
||||
(strstr(currmod, "Postscript")) ||
|
||||
(strstr(currmod, "POSTSCRIPT")))) {
|
||||
memmove(currmod + strlen(currmod), ", PostScript", 13);
|
||||
}
|
||||
// Put data to stdout when "all" is chosen or when the manufacturer
|
||||
// matches the given one.
|
||||
if ((currfile) && ((all) || !strcasecmp(currmake,make)))
|
||||
printf("%s|%s|%s|%s\n",currfile,currmake,currmod,currlang);
|
||||
}
|
||||
if (!lineprinted) {
|
||||
// Fill empty entries with some default stuff
|
||||
if (!currmod) currmod = "UNKNOWN";
|
||||
if (!currmake) currmake = "UNKNOWN";
|
||||
if (!currlang) currlang = "en";
|
||||
// Remove the manufacturer's name from the model entries
|
||||
makelen = strlen(currmake);
|
||||
if (strcasecmp(currmake,"UNKNOWN") != 0) {
|
||||
if (strncasecmp(currmake,currmod,makelen) == 0) {
|
||||
currmod += makelen;
|
||||
while ((*currmod == ' ') ||
|
||||
(*currmod == '-') ||
|
||||
(*currmod == '\t')) currmod ++;
|
||||
}
|
||||
}
|
||||
// Make the manufacturer's name all-uppercase
|
||||
currmake = strcpy(buffer,currmake);
|
||||
for (i = 0; i < makelen; i ++) buffer[i] = toupper(buffer[i]);
|
||||
// Clean up the driver info
|
||||
currmod = strcpy(buffer2,currmod);
|
||||
if (c = strstr(currmod, "Foomatic + Postscript")) {
|
||||
memmove(c, "PostScript", 10);
|
||||
memmove(c + 10, c + 21, strlen(c) - 20);
|
||||
} else if (c = strstr(currmod, "Foomatic")) {
|
||||
memmove(c + 11, c + 8, strlen(c) - 7);
|
||||
memmove(c, "GhostScript", 11);
|
||||
} else if (c = strstr(currmod, "CUPS+GIMP-print")) {
|
||||
memmove(c + 17, c + 15, strlen(c) - 14);
|
||||
memmove(c, "CUPS + GIMP-Print", 17);
|
||||
} else if (c = strstr(currmod, "Series CUPS")) {
|
||||
memmove(c + 12, c + 11, strlen(c) - 10);
|
||||
memmove(c, "Series, CUPS", 12);
|
||||
} else if (!((strstr(currmod, "PostScript")) ||
|
||||
(strstr(currmod, "Postscript")) ||
|
||||
(strstr(currmod, "POSTSCRIPT")))) {
|
||||
memmove(currmod + strlen(currmod), ", PostScript", 13);
|
||||
}
|
||||
// Put data to stdout when "all" is chosen or when the manufacturer
|
||||
// matches the given one.
|
||||
if ((currfile) && ((all) || !strcasecmp(currmake,make)))
|
||||
printf("%s|%s|%s|%s\n",currfile,currmake,currmod,currlang);
|
||||
}
|
||||
} else if (makelist) { // list all manufacturers
|
||||
ppdlist = getPPDList();
|
||||
if (!ppdlist) return 1;
|
||||
for (attr = ppdlist->attrs, last = NULL; // go through all entries
|
||||
attr != NULL;
|
||||
attr = attr->next)
|
||||
if (attr->name && strcmp(attr->name, "ppd-make") == 0)
|
||||
// only search for manufacturerer entriees
|
||||
if (last == NULL ||
|
||||
strcasecmp(last->values[0].string.text,
|
||||
attr->values[0].string.text) != 0)
|
||||
// Do not take the same manufacturer twice
|
||||
{
|
||||
// Put found manufacturer to stdout
|
||||
printf("%s\n",attr->values[0].string.text);
|
||||
last = attr;
|
||||
}
|
||||
} else { // Help!
|
||||
fprintf(stderr,"Usage:\n");
|
||||
fprintf(stderr,"------\n");
|
||||
fprintf(stderr,"\n");
|
||||
fprintf(stderr," poll_ppd_base\n");
|
||||
fprintf(stderr,"\n");
|
||||
fprintf(stderr," This help page\n");
|
||||
fprintf(stderr,"\n");
|
||||
fprintf(stderr," poll_ppd_base -a\n");
|
||||
fprintf(stderr,"\n");
|
||||
fprintf(stderr," List all PPD files\n");
|
||||
fprintf(stderr,"\n");
|
||||
fprintf(stderr," poll_ppd_base -ml\n");
|
||||
fprintf(stderr,"\n");
|
||||
fprintf(stderr," List of all printer manufacturers supported by the PPD files installed\n");
|
||||
fprintf(stderr,"\n");
|
||||
fprintf(stderr," poll_ppd_base -m <manufacturers name>\n");
|
||||
fprintf(stderr,"\n");
|
||||
fprintf(stderr," List of all supported printer models of this manufacturer\n");
|
||||
fprintf(stderr,"\n");
|
||||
fprintf(stderr,"ONLY WORKS WITH CUPS DAEMON RUNNING!\n");
|
||||
fprintf(stderr,"\n");
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
}
|
3
postscript.ppd.bz2
Normal file
3
postscript.ppd.bz2
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9182f16834ccea5ae10398c0e4ad76156b1d8b82b175db4883201d912d0400a2
|
||||
size 1911
|
12
pswrite
Normal file
12
pswrite
Normal file
@ -0,0 +1,12 @@
|
||||
#! /bin/bash
|
||||
|
||||
# enable "set -x" for debug info in /var/log/cups/error_log
|
||||
#set -x
|
||||
|
||||
# set inputfile to where the input comes from
|
||||
inputfile="-"
|
||||
[ -n "$6" ] && inputfile="$6"
|
||||
|
||||
# output PostScript level 1 (for PostScript level 2 use -dLanguageLevel=2)
|
||||
gs -q -dBATCH -dPARANOIDSAFER -dNOPAUSE -sDEVICE=pswrite -dLanguageLevel=1 -sOutputFile=- $inputfile
|
||||
|
172
rccups
Normal file
172
rccups
Normal file
@ -0,0 +1,172 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Copyright (c) 1995-2001 SuSE GmbH Nuernberg, Germany.
|
||||
# Copyright (c) 2002 SuSE Linux AG, Nuernberg, Germany.
|
||||
#
|
||||
# Author: Kurt Garloff <feedback@suse.de>, 2000
|
||||
# Klaus Singvogel <feedback@suse.de>, 2002
|
||||
#
|
||||
# /etc/init.d/cupsd
|
||||
#
|
||||
# and symbolic its link
|
||||
#
|
||||
# /sbin/rccupsd
|
||||
#
|
||||
# System startup script for the CUPS printer daemon
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: cupsd
|
||||
# Required-Start: $local_fs $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Should-Start: earlykdm hotplug named portmap ptal slpd printbill hplip
|
||||
# Should-Stop: portmap
|
||||
# Default-Start: 2 3 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Description: Start CUPS printer daemon
|
||||
### END INIT INFO
|
||||
|
||||
# Source SuSE config, only if exists with size greater zero
|
||||
test -s /etc/rc.config && \
|
||||
. /etc/rc.config
|
||||
|
||||
# Shell functions sourced from /etc/rc.status:
|
||||
# rc_check check and set local and overall rc status
|
||||
# rc_status check and set local and overall rc status
|
||||
# rc_status -v ditto but be verbose in local rc status
|
||||
# rc_status -v -r ditto and clear the local rc status
|
||||
# rc_failed set local and overall rc status to failed
|
||||
# rc_failed <num> set local and overall rc status to <num><num>
|
||||
# rc_reset clear local rc status (overall remains)
|
||||
# rc_exit exit appropriate to overall rc status
|
||||
|
||||
CUPSD_BIN=/usr/sbin/cupsd
|
||||
|
||||
test -s /etc/rc.status && \
|
||||
. /etc/rc.status
|
||||
|
||||
test -s /etc/sysconfig/cups && \
|
||||
. /etc/sysconfig/cups
|
||||
|
||||
test -x $CUPSD_BIN || exit 5
|
||||
|
||||
# First reset status of this service
|
||||
rc_reset
|
||||
|
||||
# Return values acc. to LSB for all commands but status:
|
||||
# 0 - success
|
||||
# 1 - generic or unspecified error
|
||||
# 2 - invalid or excess argument(s)
|
||||
# 3 - unimplemented feature (e.g. "reload")
|
||||
# 4 - insufficient privilege
|
||||
# 5 - program is not installed
|
||||
# 6 - program is not configured
|
||||
# 7 - program is not running
|
||||
#
|
||||
# Note that starting an already running service, stopping
|
||||
# or restarting a not-running service as well as the restart
|
||||
# with force-reload (in case signalling is not supported) are
|
||||
# considered a success.
|
||||
|
||||
# change umask to avoid problems in wrong file permission of /etc/printcap
|
||||
# (SuSE buzilla #16567)
|
||||
umask 022
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n "Starting cupsd"
|
||||
## Start daemon with startproc(8). If this fails
|
||||
## the echo return value is set appropriate.
|
||||
|
||||
# NOTE: startproc return 0, even if service is
|
||||
# already running to match LSB spec.
|
||||
if [ "$PREVLEVEL" = "N" -a "$RUNLEVEL" = "5" ]; then
|
||||
/usr/bin/ionice -c 3 startproc $CUPSD_BIN $CUPSD_OPTIONS
|
||||
else
|
||||
startproc $CUPSD_BIN $CUPSD_OPTIONS
|
||||
fi
|
||||
|
||||
# Remember status and be verbose
|
||||
rc_status -v
|
||||
;;
|
||||
stop)
|
||||
echo -n "Shutting down cupsd"
|
||||
## Stop daemon with killproc(8) and if this fails
|
||||
## set echo the echo return value.
|
||||
|
||||
killproc -TERM $CUPSD_BIN
|
||||
|
||||
# Remember status and be verbose
|
||||
rc_status -v
|
||||
;;
|
||||
try-restart)
|
||||
## Stop the service and if this succeeds (i.e. the
|
||||
## service was running before), start it again.
|
||||
## Note: try-restart is not (yet) part of LSB (as of 0.7.5)
|
||||
$0 status >/dev/null && $0 restart
|
||||
|
||||
# Remember status and be quiet
|
||||
rc_status
|
||||
;;
|
||||
restart)
|
||||
## Stop the service and regardless of whether it was
|
||||
## running or not, start it again.
|
||||
$0 stop
|
||||
$0 start
|
||||
|
||||
# Remember status and be quiet
|
||||
rc_status
|
||||
;;
|
||||
force-reload)
|
||||
## Signal the daemon to reload its config. Most daemons
|
||||
## do this on signal 1 (SIGHUP).
|
||||
## If it does not support it, restart.
|
||||
|
||||
if ps -C cupsd -o user | grep -q '^root$'; then
|
||||
echo -n "Reload service cupsd"
|
||||
killproc -HUP $CUPSD_BIN
|
||||
rc_status -v
|
||||
else
|
||||
$0 restart
|
||||
fi
|
||||
;;
|
||||
reload)
|
||||
## Like force-reload, but if daemon does not support
|
||||
## signalling, do nothing (!)
|
||||
|
||||
# If it supports signalling:
|
||||
if ps -C cupsd -o user | grep -q '^root$'; then
|
||||
echo -n "Reload service cupsd"
|
||||
killproc -HUP $CUPSD_BIN
|
||||
rc_status -v
|
||||
else
|
||||
echo -n '"reload" not possible in RunAsUser mode - use "restart" instead'
|
||||
rc_status -s
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
echo -n "Checking for cupsd: "
|
||||
## Check status with checkproc(8), if process is running
|
||||
## checkproc will return with exit status 0.
|
||||
|
||||
# Status has a slightly different for the status command:
|
||||
# 0 - service running
|
||||
# 1 - service dead, but /var/run/ pid file exists
|
||||
# 2 - service dead, but /var/lock/ lock file exists
|
||||
# 3 - service not running
|
||||
|
||||
# NOTE: checkproc returns LSB compliant status values.
|
||||
checkproc $CUPSD_BIN
|
||||
rc_status -v
|
||||
;;
|
||||
probe)
|
||||
## Optional: Probe for the necessity of a reload,
|
||||
## give out the argument which is required for a reload.
|
||||
|
||||
rc_failed 3
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
rc_exit
|
116
rccupsrenice
Normal file
116
rccupsrenice
Normal file
@ -0,0 +1,116 @@
|
||||
#! /bin/sh
|
||||
# Copyright (c) 1995-2005 SUSE Linux AG, Nuernberg, Germany.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Author: Klaus Singvogel.
|
||||
# Please send feedback to http://www.suse.de/feedback/
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: cupsrenice
|
||||
# Should-Start: $ALL
|
||||
# Required-Start: $local_fs
|
||||
# Required-Stop: $local_fs
|
||||
# Default-Start: 5
|
||||
# Default-Stop: 0 1 2 3 6
|
||||
# Short-Description: renice cupsd after the kde is running
|
||||
# Description: bring cups daemon back to normal IO process level
|
||||
# after the graphical system is up and running.
|
||||
# This should result in a faster boot time
|
||||
### END INIT INFO
|
||||
#
|
||||
#FOO_BIN=/usr/sbin/FOO
|
||||
#test -x $FOO_BIN || { echo "$FOO_BIN not installed";
|
||||
# if [ "$1" = "stop" ]; then exit 0;
|
||||
# else exit 5; fi; }
|
||||
#
|
||||
## Check for existence of needed config file and read it
|
||||
#FOO_CONFIG=/etc/sysconfig/FOO
|
||||
#test -r $FOO_CONFIG || { echo "$FOO_CONFIG not existing";
|
||||
# if [ "$1" = "stop" ]; then exit 0;
|
||||
# else exit 6; fi; }
|
||||
#
|
||||
## Read config
|
||||
#. $FOO_CONFIG
|
||||
|
||||
. /etc/rc.status
|
||||
|
||||
# Reset status of this service
|
||||
rc_reset
|
||||
|
||||
find_and_renice_cups_procs()
|
||||
{
|
||||
# ...find process pid of cupsd and remember as parent pid
|
||||
ppid=`/bin/ps -A | awk '/cupsd/{print $1}'`
|
||||
# if no cupsd is running, don't do further processing
|
||||
if [ -z "$ppid" ]; then
|
||||
return
|
||||
fi
|
||||
# ...find sibling processes from daemon
|
||||
list1=`/bin/ps --ppid $ppid | /usr/bin/awk '/[0-9]/{printf "%s ", $1}'`
|
||||
# ...find processes owned by "lp"
|
||||
list2=`/bin/ps -A -fl | /usr/bin/awk '{if ($3 ~ "lp") printf "%s ",$4}'`
|
||||
# ...and renice them
|
||||
for i in `echo $list1 $list2 $ppid | awk '{for (i=1;i<=NF;i++){print $i}}'| sort -u`
|
||||
do
|
||||
/usr/bin/ionice -c 1 "$i"
|
||||
done
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
( sleep 40; find_and_renice_cups_procs ) &
|
||||
rc_status -v
|
||||
;;
|
||||
stop)
|
||||
rc_exit
|
||||
;;
|
||||
try-restart|condrestart)
|
||||
$0 status
|
||||
if test $? = 0; then
|
||||
$0 restart
|
||||
else
|
||||
rc_reset # Not running is not a failure.
|
||||
fi
|
||||
# Remember status and be quiet
|
||||
rc_status
|
||||
;;
|
||||
restart)
|
||||
## Stop the service and regardless of whether it was
|
||||
## running or not, start it again.
|
||||
$0 stop
|
||||
$0 start
|
||||
|
||||
# Remember status and be quiet
|
||||
rc_status
|
||||
;;
|
||||
force-reload)
|
||||
rc_failed 3
|
||||
rc_status -v
|
||||
;;
|
||||
reload)
|
||||
rc_failed 3
|
||||
rc_status -v
|
||||
;;
|
||||
status)
|
||||
rc_status -v
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|status|try-restart|restart|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
rc_exit
|
185
setcupsbroadcasting
Normal file
185
setcupsbroadcasting
Normal file
@ -0,0 +1,185 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
#
|
||||
# Script to automatically restrict the printer information broadcasting the
|
||||
# accepting of external broadcasts, and the access to the printers to local
|
||||
# (eth?) networks
|
||||
#
|
||||
|
||||
#
|
||||
# Till Kamppeter (till@mandrakesoft.com)
|
||||
#
|
||||
# Copyright 2000 MandrakeSoft
|
||||
#
|
||||
# This software may be freely redistributed under the terms of the GNU
|
||||
# General Public License.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
|
||||
# Do not do any changes during the installation
|
||||
|
||||
if ($ENV{'DURING_INSTALL'}) {exit 0};
|
||||
|
||||
# Read CUPS config file
|
||||
|
||||
my $cups_conf = "/etc/cups/cupsd.conf";
|
||||
if (!(-f $cups_conf)) {die "No CUPS configuration file $cups_conf!"};
|
||||
open CONF_CUPS, "$cups_conf" or die "Can't open $cups_conf!";
|
||||
my @cups_conf_content = <CONF_CUPS>;
|
||||
close CONF_CUPS;
|
||||
|
||||
# If it contains at least one "BrowseAddress" line broadcasting is already
|
||||
# configured and we are done, stop silently here.
|
||||
|
||||
grep(/^\s*BrowseAddress[^:]/, @cups_conf_content) and exit 0;
|
||||
|
||||
# Read the output of "ifconfig" to look for local networks
|
||||
|
||||
my $dev_is_localnet = 0;
|
||||
my @local_networks = ();
|
||||
my @local_bcasts = ();
|
||||
my $current_ip = "";
|
||||
my $current_mask = "";
|
||||
my $current_bcast = "";
|
||||
|
||||
if (-x "/sbin/ifconfig") {
|
||||
open IFCONFIG_OUT, "/sbin/ifconfig|" or die "Couldn't run \"ifconfig\"!";
|
||||
while (defined($readline = <IFCONFIG_OUT>)) {
|
||||
# New entry ...
|
||||
if ($readline =~ /^(\S+)\s/) {
|
||||
$dev = $1;
|
||||
# ... for a local network?
|
||||
if ($dev =~ /^eth/) {$dev_is_localnet = 1}
|
||||
else {$dev_is_localnet = 0};
|
||||
# delete previous network data
|
||||
$current_ip = "";
|
||||
$current_mask = "";
|
||||
$current_bcast = "";
|
||||
}
|
||||
# Are we in an entry for a local network?
|
||||
if ($dev_is_localnet == 1) {
|
||||
# Are we in the important line now?
|
||||
if ($readline =~ /\sinet addr:[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\s/) {
|
||||
# Rip out the network addresses
|
||||
if ($readline =~ /\sinet addr:([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\s/) {
|
||||
$current_ip = $1;
|
||||
}
|
||||
if ($readline =~ /\sBcast:([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\s/) {
|
||||
$current_bcast = $1;
|
||||
}
|
||||
if ($readline =~ /\sMask:([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)\s/) {
|
||||
$current_mask = $1;
|
||||
}
|
||||
# Is the entry valid?
|
||||
if (($current_ip ne "") and ($current_mask ne "")) {
|
||||
# Is there a broadcast address?
|
||||
if ($current_bcast eq "") {$current_bcast = $current_ip};
|
||||
# Store broadcast address (or current IP if there is none)
|
||||
push @local_bcasts, $current_bcast;
|
||||
# Calculate mask fore access restriction
|
||||
$current_ip =~ /([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/;
|
||||
($i1, $i2, $i3, $i4) = ($1, $2, $3, $4);
|
||||
$current_mask =~ /([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/;
|
||||
($m1, $m2, $m3, $m4) = ($1, $2, $3, $4);
|
||||
$current_net = "";
|
||||
if ($m1 eq "255") {$current_net = "${current_net}${i1}\."};
|
||||
if ($m2 eq "255") {$current_net = "$current_net$i2."};
|
||||
if ($m3 eq "255") {$current_net = "$current_net$i3."};
|
||||
if ($m4 eq "255") {$current_net = "$current_net$i4"}
|
||||
else {$current_net = "$current_net*"};
|
||||
# Store mask
|
||||
push @local_networks, $current_net;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
close(IFCONFIG_OUT);
|
||||
}
|
||||
|
||||
# Remove all valid "BrowseAddress" lines
|
||||
($_ =~ /^\s*BrowseAddress[^:]/ and $_="") foreach @cups_conf_content;
|
||||
|
||||
# Insert the new "BrowseAddress" lines
|
||||
(push @cups_conf_content, "BrowseAddress $_\n") foreach @local_bcasts;
|
||||
|
||||
# Delete all "BrowseOrder", "BrowseAllow" and "BrowseDeny" lines from the file
|
||||
|
||||
($_ =~ /^\s*BrowseOrder/ and $_="") foreach @cups_conf_content;
|
||||
($_ =~ /^\s*BrowseAllow/ and $_="") foreach @cups_conf_content;
|
||||
($_ =~ /^\s*BrowseDeny/ and $_="") foreach @cups_conf_content;
|
||||
|
||||
# Add the new "BrowseOrder" and "BrowseDeny" lines
|
||||
|
||||
push(@cups_conf_content,"BrowseOrder Deny,Allow\n");
|
||||
push(@cups_conf_content,"BrowseDeny All\n");
|
||||
|
||||
# Add a "BrowseAllow" line for every local network
|
||||
|
||||
(push(@cups_conf_content,"BrowseAllow $_\n")) foreach @local_networks;
|
||||
|
||||
# Cut out the root location block
|
||||
#
|
||||
# <Location />
|
||||
# ...
|
||||
# </Location>
|
||||
#
|
||||
# so that it can be treated seperately without affecting the rest of the
|
||||
# file
|
||||
|
||||
if (grep(m!^\s*<Location\s+/\s*>!, @cups_conf_content)) {
|
||||
$root_location_start = -1;
|
||||
$root_location_end = -1;
|
||||
# Go through all the lines, bail out when start and end line found
|
||||
for ($i = 0;
|
||||
($i <= $#cups_conf_content) and ($root_location_end == -1);
|
||||
$i++) {
|
||||
if ($cups_conf_content[$i] =~ m!^\s*<\s*Location\s+/\s*>!) {
|
||||
# Start line of block
|
||||
$root_location_start = $i;
|
||||
} elsif (($cups_conf_content[$i] =~ m!^\s*<\s*/Location\s*>!) and
|
||||
($root_location_start != -1)) {
|
||||
# End line of block
|
||||
$root_location_end = $i;
|
||||
}
|
||||
}
|
||||
# Rip out the block and store it seperately
|
||||
@root_location =
|
||||
splice(@cups_conf_content,$root_location_start,
|
||||
$root_location_end - $root_location_start + 1);
|
||||
} else {
|
||||
# If there is no root location block, create one
|
||||
$root_location_start = $#cups_conf_content + 1;
|
||||
@root_location = ();
|
||||
push @root_location, "<Location />\n";
|
||||
push @root_location, "</Location>\n";
|
||||
}
|
||||
|
||||
# Delete all former "Order", "Allow", and "Deny" lines from the root location
|
||||
# block
|
||||
|
||||
($_ =~ /^\s*Order/ and $_="") foreach @root_location;
|
||||
($_ =~ /^\s*Allow/ and $_="") foreach @root_location;
|
||||
($_ =~ /^\s*Deny/ and $_="") foreach @root_location;
|
||||
|
||||
# Add the new "Order" and "Deny" lines
|
||||
|
||||
splice(@root_location,-1,0,"Order Deny,Allow\n");
|
||||
splice(@root_location,-1,0,"Deny From All\n");
|
||||
splice(@root_location,-1,0,"Allow From 127.0.0.1\n");
|
||||
|
||||
# Add an "Allow" line for every local network
|
||||
|
||||
(splice(@root_location,-1,0,"Allow From $_\n")) foreach @local_networks;
|
||||
|
||||
# Put the changed root location block back into the file
|
||||
|
||||
splice(@cups_conf_content,$root_location_start,0,@root_location);
|
||||
|
||||
# Write back the modified CUPS config file
|
||||
|
||||
open CONF_CUPS, ">$cups_conf" or die "Can't open $cups_conf";
|
||||
print CONF_CUPS @cups_conf_content;
|
||||
close CONF_CUPS;
|
Loading…
x
Reference in New Issue
Block a user