2007-07-18 11:55:01 +00:00
|
|
|
--- /dev/null 2007-07-18 08:25:43.728072803 +0100
|
|
|
|
+++ cups-1.3b1/config-scripts/cups-lspp.m4 2007-07-18 11:40:59.000000000 +0100
|
2006-08-21 16:26:28 +00:00
|
|
|
@@ -0,0 +1,36 @@
|
|
|
|
+dnl
|
|
|
|
+dnl LSPP code for the Common UNIX Printing System (CUPS).
|
|
|
|
+dnl
|
|
|
|
+dnl Copyright 2005-2006 by Hewlett-Packard Development Company, L.P.
|
|
|
|
+dnl
|
|
|
|
+dnl This program is free software; you can redistribute it and/or modify
|
|
|
|
+dnl it under the terms of the GNU General Public License as published by
|
|
|
|
+dnl the Free Software Foundation; version 2.
|
|
|
|
+dnl
|
|
|
|
+dnl This program is distributed in the hope that it will be useful, but
|
|
|
|
+dnl WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
+dnl General Public License for more details.
|
|
|
|
+dnl
|
|
|
|
+dnl You should have received a copy of the GNU General Public License
|
|
|
|
+dnl along with this program; if not, write to the Free Software Foundation,
|
|
|
|
+dnl Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301 USA
|
|
|
|
+dnl
|
|
|
|
+
|
|
|
|
+dnl Are we trying to meet LSPP requirements
|
|
|
|
+AC_ARG_ENABLE(lspp, [ --enable-lspp turn on auditing and label support, default=no])
|
|
|
|
+
|
|
|
|
+if test x"$enable_lspp" != xno; then
|
|
|
|
+ case "$uname" in
|
|
|
|
+ Linux)
|
|
|
|
+ AC_CHECK_LIB(audit,audit_log_user_message, [LIBAUDIT="-laudit" AC_SUBST(LIBAUDIT)])
|
|
|
|
+ AC_CHECK_HEADER(libaudit.h)
|
|
|
|
+ AC_CHECK_LIB(selinux,getpeercon, [LIBSELINUX="-lselinux" AC_SUBST(LIBSELINUX)])
|
|
|
|
+ AC_CHECK_HEADER(selinux/selinux.h)
|
|
|
|
+ AC_DEFINE(WITH_LSPP)
|
|
|
|
+ ;;
|
|
|
|
+ *)
|
|
|
|
+ # All others
|
|
|
|
+ ;;
|
|
|
|
+ esac
|
|
|
|
+fi
|
2007-07-18 11:55:01 +00:00
|
|
|
--- cups-1.3b1/cups/cups.h.lspp 2007-07-13 02:13:26.000000000 +0100
|
|
|
|
+++ cups-1.3b1/cups/cups.h 2007-07-18 11:40:59.000000000 +0100
|
|
|
|
@@ -15,6 +15,9 @@
|
|
|
|
* This file is subject to the Apple OS-Developed Software exception.
|
|
|
|
*/
|
|
|
|
|
|
|
|
+/* Copyright (C) 2005 Trusted Computer Solutions, Inc. */
|
|
|
|
+/* (c) Copyright 2005-2006 Hewlett-Packard Development Company, L.P. */
|
|
|
|
+
|
|
|
|
#ifndef _CUPS_CUPS_H_
|
|
|
|
# define _CUPS_CUPS_H_
|
|
|
|
|
|
|
|
@@ -66,6 +69,12 @@
|
|
|
|
# define CUPS_DATE_ANY -1
|
|
|
|
|
|
|
|
|
|
|
|
+# ifdef WITH_LSPP
|
|
|
|
+# define MLS_CONFIG "mls"
|
|
|
|
+# define TE_CONFIG "te"
|
|
|
|
+# define SELINUX_CONFIG "SELinux"
|
|
|
|
+# define UNKNOWN_SL "UNKNOWN SL"
|
|
|
|
+# endif /* WITH_LSPP */
|
|
|
|
/*
|
|
|
|
* Types and structures...
|
|
|
|
*/
|
|
|
|
--- /dev/null 2007-07-18 08:25:43.728072803 +0100
|
|
|
|
+++ cups-1.3b1/data/mls 2007-07-18 11:40:59.000000000 +0100
|
2007-03-29 10:30:29 +00:00
|
|
|
@@ -0,0 +1,261 @@
|
2006-07-21 12:00:05 +00:00
|
|
|
+%!PS-Adobe-3.0
|
|
|
|
+%%BoundingBox: 0 0 612 792
|
|
|
|
+%%Pages: 1
|
|
|
|
+%%LanguageLevel: 1
|
|
|
|
+%%DocumentData: Clean7Bit
|
|
|
|
+%%DocumentSuppliedResources: procset bannerprint/1.0
|
|
|
|
+%%DocumentNeededResources: font Helvetica Helvetica-Bold Times-Roman
|
|
|
|
+%%Creator: Michael Sweet, Easy Software Products
|
|
|
|
+%%CreationDate: May 10, 2000
|
|
|
|
+%%Title: Test Page
|
|
|
|
+%%EndComments
|
|
|
|
+%%BeginProlog
|
|
|
|
+%%BeginResource procset bannerprint 1.1 0
|
|
|
|
+%
|
|
|
|
+% PostScript banner page for the Common UNIX Printing System ("CUPS").
|
|
|
|
+%
|
|
|
|
+% Copyright 1993-2005 by Easy Software Products
|
|
|
|
+%
|
|
|
|
+% These coded instructions, statements, and computer programs are the
|
|
|
|
+% property of Easy Software Products and are protected by Federal
|
|
|
|
+% copyright law. Distribution and use rights are outlined in the file
|
|
|
|
+% "LICENSE.txt" which should have been included with this file. If this
|
|
|
|
+% file is missing or damaged please contact Easy Software Products
|
|
|
|
+% at:
|
|
|
|
+%
|
|
|
|
+% Attn: CUPS Licensing Information
|
|
|
|
+% Easy Software Products
|
|
|
|
+% 44141 Airport View Drive, Suite 204
|
|
|
|
+% Hollywood, Maryland 20636 USA
|
|
|
|
+%
|
|
|
|
+% Voice: (301) 373-9600
|
|
|
|
+% EMail: cups-info@cups.org
|
|
|
|
+% WWW: http://www.cups.org
|
|
|
|
+%
|
|
|
|
+/CENTER { % Draw centered text
|
|
|
|
+ % (name) CENTER -
|
|
|
|
+ dup stringwidth pop % Get the width of the string
|
|
|
|
+ 0.5 mul neg 0 rmoveto % Shift left 1/2 of the distance
|
|
|
|
+ show % Show the string
|
|
|
|
+} bind def
|
|
|
|
+/RIGHT { % Draw right-justified text
|
|
|
|
+ % (name) RIGHT -
|
|
|
|
+ dup stringwidth pop % Get the width of the string
|
|
|
|
+ neg 0 rmoveto % Shift left the entire distance
|
|
|
|
+ show % Show the string
|
|
|
|
+} bind def
|
|
|
|
+/NUMBER { % Draw a number
|
|
|
|
+ % power n NUMBER -
|
|
|
|
+ 1 index 1 eq { % power == 1?
|
|
|
|
+ round cvi exch pop % Convert "n" to integer
|
|
|
|
+ } {
|
|
|
|
+ 1 index mul round exch div % Truncate extra decimal places
|
|
|
|
+ } 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
|
|
|
|
+%%EndResource
|
|
|
|
+%%EndProlog
|
|
|
|
+%%Page: 1 1
|
|
|
|
+gsave
|
|
|
|
+
|
|
|
|
+ % Determine the imageable area and device resolution...
|
|
|
|
+ initclip newpath clippath pathbbox % Get bounding rectangle
|
|
|
|
+ 72 div /pageTop exch def % Get top margin in inches
|
|
|
|
+ 72 div /pageRight exch def % Get right margin in inches
|
|
|
|
+ 72 div /pageBottom exch def % Get bottom margin in inches
|
|
|
|
+ 72 div /pageLeft exch def % Get left margin in inches
|
|
|
|
+
|
|
|
|
+ /pageWidth pageRight pageLeft sub def % pageWidth = pageRight - pageLeft
|
|
|
|
+ /pageHeight pageTop pageBottom sub def% pageHeight = pageTop - pageBottom
|
|
|
|
+
|
|
|
|
+ /boxWidth % width of text box
|
|
|
|
+ pageWidth pageHeight lt
|
|
|
|
+ { pageWidth 54 mul }
|
|
|
|
+ { pageHeight 42 mul }
|
|
|
|
+ ifelse def
|
|
|
|
+
|
|
|
|
+ newpath % Clear bounding path
|
|
|
|
+
|
|
|
|
+ % Create fonts...
|
|
|
|
+ /bigFont /Helvetica-Bold findfont % bigFont = Helvetica-Bold
|
|
|
|
+ pageHeight 3 mul scalefont def % size = pageHeight * 3 (nominally 33)
|
|
|
|
+
|
|
|
|
+ /mediumFont /Helvetica findfont % mediumFont = Helvetica
|
|
|
|
+ pageHeight 1.5 mul scalefont def % size = pageHeight * 1.5 (nominally 16.5)
|
|
|
|
+
|
|
|
|
+ % Offset page to account for lower-left margin...
|
|
|
|
+ pageLeft 72 mul
|
|
|
|
+ pageBottom 72 mul
|
|
|
|
+ translate
|
|
|
|
+
|
|
|
|
+ % Job information box...
|
|
|
|
+ pageWidth 36 mul 9 add % x = pageWidth * 1/2 * 72 + 9
|
|
|
|
+ boxWidth 0.5 mul sub % x-= 1/2 box width
|
|
|
|
+ pageHeight 30 mul 9 sub % y = pageHeight * 1/2 * 72 - 9
|
|
|
|
+ boxWidth % w = box width
|
|
|
|
+ pageHeight 14 mul % h = pageHeight * 1/2 * 72
|
|
|
|
+ 0.5 setgray rectfill % Draw a shadow
|
|
|
|
+
|
|
|
|
+ pageWidth 36 mul % x = pageWidth * 1/2 * 72
|
|
|
|
+ boxWidth 0.5 mul sub % x-= 1/2 box width
|
|
|
|
+ pageHeight 30 mul % y = pageHeight * 1/4 * 72
|
|
|
|
+ boxWidth % w = box width
|
|
|
|
+ pageHeight 14 mul % h = pageHeight * 1/2 * 72
|
|
|
|
+
|
|
|
|
+ 4 copy 1 setgray rectfill % Clear the box to white
|
|
|
|
+ 0 setgray rectstroke % Draw a black box around it...
|
|
|
|
+
|
|
|
|
+ % Job information text...
|
|
|
|
+ mediumFont setfont % Medium sized font
|
|
|
|
+
|
|
|
|
+ pageWidth 36 mul % x = pageWidth * 1/2 * 72
|
|
|
|
+ pageHeight 36 mul % y = pageHeight * 1/2 * 72
|
|
|
|
+ pageHeight 5 mul add % y += 2 lines
|
|
|
|
+ 2 copy % Copy X & Y
|
|
|
|
+ moveto
|
|
|
|
+ (Job ID: ) RIGHT
|
|
|
|
+ moveto
|
|
|
|
+ ({printer-name}-{job-id}) show
|
|
|
|
+
|
|
|
|
+ pageWidth 36 mul % x = pageWidth * 1/2 * 72
|
|
|
|
+ pageHeight 36 mul % y = pageHeight * 1/2 * 72
|
|
|
|
+ pageHeight 2 mul add % y += 1 line
|
|
|
|
+ 2 copy % Copy X & Y
|
|
|
|
+ moveto
|
|
|
|
+ (Title: ) RIGHT
|
|
|
|
+ moveto
|
|
|
|
+ ({job-name}) show
|
|
|
|
+
|
|
|
|
+ pageWidth 36 mul % x = pageWidth * 1/2 * 72
|
|
|
|
+ pageHeight 36 mul % y = pageHeight * 1/2 * 72
|
|
|
|
+ pageHeight -1 mul add % y -= 1 line
|
|
|
|
+ 2 copy % Copy X & Y
|
|
|
|
+ moveto
|
|
|
|
+ (Requesting User: ) RIGHT
|
|
|
|
+ moveto
|
|
|
|
+ ({job-originating-user-name}) show
|
|
|
|
+
|
|
|
|
+ pageWidth 36 mul % x = pageWidth * 1/2 * 72
|
|
|
|
+ pageHeight 36 mul % y = pageHeight * 1/2 * 72
|
|
|
|
+ pageHeight -4 mul add % y -= 2 lines
|
|
|
|
+ 2 copy % Copy X & Y
|
|
|
|
+ moveto
|
|
|
|
+ (Billing Info: ) RIGHT
|
|
|
|
+ moveto
|
|
|
|
+ ({?job-billing}) show
|
|
|
|
+
|
|
|
|
+ % Then the CUPS logo....
|
|
|
|
+ gsave
|
|
|
|
+ pageWidth 4 mul
|
|
|
|
+ pageWidth 6 mul
|
|
|
|
+ translate
|
|
|
|
+ pageWidth 9 mul CUPSLOGO
|
|
|
|
+ grestore
|
|
|
|
+
|
|
|
|
+ % And the ESP logo....
|
|
|
|
+ gsave
|
|
|
|
+ pageWidth 59 mul
|
|
|
|
+ pageWidth 6 mul
|
|
|
|
+ translate
|
|
|
|
+ pageWidth 6 mul ESPLOGO
|
|
|
|
+ grestore
|
|
|
|
+% Show the page...
|
|
|
|
+grestore
|
|
|
|
+showpage
|
|
|
|
+%
|
|
|
|
+% End of "$Id: mls_template,v 1.1 2005/06/27 18:44:46 colmo Exp $".
|
|
|
|
+%
|
|
|
|
+%%EOF
|
2007-07-18 11:55:01 +00:00
|
|
|
--- /dev/null 2007-07-18 08:25:43.728072803 +0100
|
|
|
|
+++ cups-1.3b1/data/selinux 2007-07-18 11:40:59.000000000 +0100
|
2007-03-29 10:30:29 +00:00
|
|
|
@@ -0,0 +1,261 @@
|
2006-07-21 12:00:05 +00:00
|
|
|
+%!PS-Adobe-3.0
|
|
|
|
+%%BoundingBox: 0 0 612 792
|
|
|
|
+%%Pages: 1
|
|
|
|
+%%LanguageLevel: 1
|
|
|
|
+%%DocumentData: Clean7Bit
|
|
|
|
+%%DocumentSuppliedResources: procset bannerprint/1.0
|
|
|
|
+%%DocumentNeededResources: font Helvetica Helvetica-Bold Times-Roman
|
|
|
|
+%%Creator: Michael Sweet, Easy Software Products
|
|
|
|
+%%CreationDate: May 10, 2000
|
|
|
|
+%%Title: Test Page
|
|
|
|
+%%EndComments
|
|
|
|
+%%BeginProlog
|
|
|
|
+%%BeginResource procset bannerprint 1.1 0
|
|
|
|
+%
|
|
|
|
+% PostScript banner page for the Common UNIX Printing System ("CUPS").
|
|
|
|
+%
|
|
|
|
+% Copyright 1993-2005 by Easy Software Products
|
|
|
|
+%
|
|
|
|
+% These coded instructions, statements, and computer programs are the
|
|
|
|
+% property of Easy Software Products and are protected by Federal
|
|
|
|
+% copyright law. Distribution and use rights are outlined in the file
|
|
|
|
+% "LICENSE.txt" which should have been included with this file. If this
|
|
|
|
+% file is missing or damaged please contact Easy Software Products
|
|
|
|
+% at:
|
|
|
|
+%
|
|
|
|
+% Attn: CUPS Licensing Information
|
|
|
|
+% Easy Software Products
|
|
|
|
+% 44141 Airport View Drive, Suite 204
|
|
|
|
+% Hollywood, Maryland 20636 USA
|
|
|
|
+%
|
|
|
|
+% Voice: (301) 373-9600
|
|
|
|
+% EMail: cups-info@cups.org
|
|
|
|
+% WWW: http://www.cups.org
|
|
|
|
+%
|
|
|
|
+/CENTER { % Draw centered text
|
|
|
|
+ % (name) CENTER -
|
|
|
|
+ dup stringwidth pop % Get the width of the string
|
|
|
|
+ 0.5 mul neg 0 rmoveto % Shift left 1/2 of the distance
|
|
|
|
+ show % Show the string
|
|
|
|
+} bind def
|
|
|
|
+/RIGHT { % Draw right-justified text
|
|
|
|
+ % (name) RIGHT -
|
|
|
|
+ dup stringwidth pop % Get the width of the string
|
|
|
|
+ neg 0 rmoveto % Shift left the entire distance
|
|
|
|
+ show % Show the string
|
|
|
|
+} bind def
|
|
|
|
+/NUMBER { % Draw a number
|
|
|
|
+ % power n NUMBER -
|
|
|
|
+ 1 index 1 eq { % power == 1?
|
|
|
|
+ round cvi exch pop % Convert "n" to integer
|
|
|
|
+ } {
|
|
|
|
+ 1 index mul round exch div % Truncate extra decimal places
|
|
|
|
+ } 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
|
|
|
|
+%%EndResource
|
|
|
|
+%%EndProlog
|
|
|
|
+%%Page: 1 1
|
|
|
|
+gsave
|
|
|
|
+
|
|
|
|
+ % Determine the imageable area and device resolution...
|
|
|
|
+ initclip newpath clippath pathbbox % Get bounding rectangle
|
|
|
|
+ 72 div /pageTop exch def % Get top margin in inches
|
|
|
|
+ 72 div /pageRight exch def % Get right margin in inches
|
|
|
|
+ 72 div /pageBottom exch def % Get bottom margin in inches
|
|
|
|
+ 72 div /pageLeft exch def % Get left margin in inches
|
|
|
|
+
|
|
|
|
+ /pageWidth pageRight pageLeft sub def % pageWidth = pageRight - pageLeft
|
|
|
|
+ /pageHeight pageTop pageBottom sub def% pageHeight = pageTop - pageBottom
|
|
|
|
+
|
|
|
|
+ /boxWidth % width of text box
|
|
|
|
+ pageWidth pageHeight lt
|
|
|
|
+ { pageWidth 54 mul }
|
|
|
|
+ { pageHeight 42 mul }
|
|
|
|
+ ifelse def
|
|
|
|
+
|
|
|
|
+ newpath % Clear bounding path
|
|
|
|
+
|
|
|
|
+ % Create fonts...
|
|
|
|
+ /bigFont /Helvetica-Bold findfont % bigFont = Helvetica-Bold
|
|
|
|
+ pageHeight 3 mul scalefont def % size = pageHeight * 3 (nominally 33)
|
|
|
|
+
|
|
|
|
+ /mediumFont /Helvetica findfont % mediumFont = Helvetica
|
|
|
|
+ pageHeight 1.5 mul scalefont def % size = pageHeight * 1.5 (nominally 16.5)
|
|
|
|
+
|
|
|
|
+ % Offset page to account for lower-left margin...
|
|
|
|
+ pageLeft 72 mul
|
|
|
|
+ pageBottom 72 mul
|
|
|
|
+ translate
|
|
|
|
+
|
|
|
|
+ % Job information box...
|
|
|
|
+ pageWidth 36 mul 9 add % x = pageWidth * 1/2 * 72 + 9
|
|
|
|
+ boxWidth 0.5 mul sub % x-= 1/2 box width
|
|
|
|
+ pageHeight 30 mul 9 sub % y = pageHeight * 1/2 * 72 - 9
|
|
|
|
+ boxWidth % w = box width
|
|
|
|
+ pageHeight 14 mul % h = pageHeight * 1/2 * 72
|
|
|
|
+ 0.5 setgray rectfill % Draw a shadow
|
|
|
|
+
|
|
|
|
+ pageWidth 36 mul % x = pageWidth * 1/2 * 72
|
|
|
|
+ boxWidth 0.5 mul sub % x-= 1/2 box width
|
|
|
|
+ pageHeight 30 mul % y = pageHeight * 1/4 * 72
|
|
|
|
+ boxWidth % w = box width
|
|
|
|
+ pageHeight 14 mul % h = pageHeight * 1/2 * 72
|
|
|
|
+
|
|
|
|
+ 4 copy 1 setgray rectfill % Clear the box to white
|
|
|
|
+ 0 setgray rectstroke % Draw a black box around it...
|
|
|
|
+
|
|
|
|
+ % Job information text...
|
|
|
|
+ mediumFont setfont % Medium sized font
|
|
|
|
+
|
|
|
|
+ pageWidth 36 mul % x = pageWidth * 1/2 * 72
|
|
|
|
+ pageHeight 36 mul % y = pageHeight * 1/2 * 72
|
|
|
|
+ pageHeight 5 mul add % y += 2 lines
|
|
|
|
+ 2 copy % Copy X & Y
|
|
|
|
+ moveto
|
|
|
|
+ (Job ID: ) RIGHT
|
|
|
|
+ moveto
|
|
|
|
+ ({printer-name}-{job-id}) show
|
|
|
|
+
|
|
|
|
+ pageWidth 36 mul % x = pageWidth * 1/2 * 72
|
|
|
|
+ pageHeight 36 mul % y = pageHeight * 1/2 * 72
|
|
|
|
+ pageHeight 2 mul add % y += 1 line
|
|
|
|
+ 2 copy % Copy X & Y
|
|
|
|
+ moveto
|
|
|
|
+ (Title: ) RIGHT
|
|
|
|
+ moveto
|
|
|
|
+ ({job-name}) show
|
|
|
|
+
|
|
|
|
+ pageWidth 36 mul % x = pageWidth * 1/2 * 72
|
|
|
|
+ pageHeight 36 mul % y = pageHeight * 1/2 * 72
|
|
|
|
+ pageHeight -1 mul add % y -= 1 line
|
|
|
|
+ 2 copy % Copy X & Y
|
|
|
|
+ moveto
|
|
|
|
+ (Requesting User: ) RIGHT
|
|
|
|
+ moveto
|
|
|
|
+ ({job-originating-user-name}) show
|
|
|
|
+
|
|
|
|
+ pageWidth 36 mul % x = pageWidth * 1/2 * 72
|
|
|
|
+ pageHeight 36 mul % y = pageHeight * 1/2 * 72
|
|
|
|
+ pageHeight -4 mul add % y -= 2 lines
|
|
|
|
+ 2 copy % Copy X & Y
|
|
|
|
+ moveto
|
|
|
|
+ (Billing Info: ) RIGHT
|
|
|
|
+ moveto
|
|
|
|
+ ({?job-billing}) show
|
|
|
|
+
|
|
|
|
+ % Then the CUPS logo....
|
|
|
|
+ gsave
|
|
|
|
+ pageWidth 4 mul
|
|
|
|
+ pageWidth 6 mul
|
|
|
|
+ translate
|
|
|
|
+ pageWidth 9 mul CUPSLOGO
|
|
|
|
+ grestore
|
|
|
|
+
|
|
|
|
+ % And the ESP logo....
|
|
|
|
+ gsave
|
|
|
|
+ pageWidth 59 mul
|
|
|
|
+ pageWidth 6 mul
|
|
|
|
+ translate
|
|
|
|
+ pageWidth 6 mul ESPLOGO
|
|
|
|
+ grestore
|
|
|
|
+% Show the page...
|
|
|
|
+grestore
|
|
|
|
+showpage
|
|
|
|
+%
|
|
|
|
+% End of "$Id: mls_template,v 1.1 2005/06/27 18:44:46 colmo Exp $".
|
|
|
|
+%
|
|
|
|
+%%EOF
|
2007-07-18 11:55:01 +00:00
|
|
|
--- cups-1.3b1/data/Makefile.lspp 2007-07-11 22:46:42.000000000 +0100
|
|
|
|
+++ cups-1.3b1/data/Makefile 2007-07-18 11:40:59.000000000 +0100
|
|
|
|
@@ -25,7 +25,10 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
secret \
|
|
|
|
standard \
|
|
|
|
topsecret \
|
|
|
|
- unclassified
|
|
|
|
+ unclassified \
|
|
|
|
+ selinux \
|
|
|
|
+ mls \
|
|
|
|
+ te
|
|
|
|
|
|
|
|
CHARMAPS = \
|
|
|
|
euc-cn.txt \
|
2007-07-18 11:55:01 +00:00
|
|
|
--- /dev/null 2007-07-18 08:25:43.728072803 +0100
|
|
|
|
+++ cups-1.3b1/data/te 2007-07-18 11:40:59.000000000 +0100
|
2007-03-29 10:30:29 +00:00
|
|
|
@@ -0,0 +1,261 @@
|
2006-07-21 12:00:05 +00:00
|
|
|
+%!PS-Adobe-3.0
|
|
|
|
+%%BoundingBox: 0 0 612 792
|
|
|
|
+%%Pages: 1
|
|
|
|
+%%LanguageLevel: 1
|
|
|
|
+%%DocumentData: Clean7Bit
|
|
|
|
+%%DocumentSuppliedResources: procset bannerprint/1.0
|
|
|
|
+%%DocumentNeededResources: font Helvetica Helvetica-Bold Times-Roman
|
|
|
|
+%%Creator: Michael Sweet, Easy Software Products
|
|
|
|
+%%CreationDate: May 10, 2000
|
|
|
|
+%%Title: Test Page
|
|
|
|
+%%EndComments
|
|
|
|
+%%BeginProlog
|
|
|
|
+%%BeginResource procset bannerprint 1.1 0
|
|
|
|
+%
|
|
|
|
+% PostScript banner page for the Common UNIX Printing System ("CUPS").
|
|
|
|
+%
|
|
|
|
+% Copyright 1993-2005 by Easy Software Products
|
|
|
|
+%
|
|
|
|
+% These coded instructions, statements, and computer programs are the
|
|
|
|
+% property of Easy Software Products and are protected by Federal
|
|
|
|
+% copyright law. Distribution and use rights are outlined in the file
|
|
|
|
+% "LICENSE.txt" which should have been included with this file. If this
|
|
|
|
+% file is missing or damaged please contact Easy Software Products
|
|
|
|
+% at:
|
|
|
|
+%
|
|
|
|
+% Attn: CUPS Licensing Information
|
|
|
|
+% Easy Software Products
|
|
|
|
+% 44141 Airport View Drive, Suite 204
|
|
|
|
+% Hollywood, Maryland 20636 USA
|
|
|
|
+%
|
|
|
|
+% Voice: (301) 373-9600
|
|
|
|
+% EMail: cups-info@cups.org
|
|
|
|
+% WWW: http://www.cups.org
|
|
|
|
+%
|
|
|
|
+/CENTER { % Draw centered text
|
|
|
|
+ % (name) CENTER -
|
|
|
|
+ dup stringwidth pop % Get the width of the string
|
|
|
|
+ 0.5 mul neg 0 rmoveto % Shift left 1/2 of the distance
|
|
|
|
+ show % Show the string
|
|
|
|
+} bind def
|
|
|
|
+/RIGHT { % Draw right-justified text
|
|
|
|
+ % (name) RIGHT -
|
|
|
|
+ dup stringwidth pop % Get the width of the string
|
|
|
|
+ neg 0 rmoveto % Shift left the entire distance
|
|
|
|
+ show % Show the string
|
|
|
|
+} bind def
|
|
|
|
+/NUMBER { % Draw a number
|
|
|
|
+ % power n NUMBER -
|
|
|
|
+ 1 index 1 eq { % power == 1?
|
|
|
|
+ round cvi exch pop % Convert "n" to integer
|
|
|
|
+ } {
|
|
|
|
+ 1 index mul round exch div % Truncate extra decimal places
|
|
|
|
+ } 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
|
|
|
|
+%%EndResource
|
|
|
|
+%%EndProlog
|
|
|
|
+%%Page: 1 1
|
|
|
|
+gsave
|
|
|
|
+
|
|
|
|
+ % Determine the imageable area and device resolution...
|
|
|
|
+ initclip newpath clippath pathbbox % Get bounding rectangle
|
|
|
|
+ 72 div /pageTop exch def % Get top margin in inches
|
|
|
|
+ 72 div /pageRight exch def % Get right margin in inches
|
|
|
|
+ 72 div /pageBottom exch def % Get bottom margin in inches
|
|
|
|
+ 72 div /pageLeft exch def % Get left margin in inches
|
|
|
|
+
|
|
|
|
+ /pageWidth pageRight pageLeft sub def % pageWidth = pageRight - pageLeft
|
|
|
|
+ /pageHeight pageTop pageBottom sub def% pageHeight = pageTop - pageBottom
|
|
|
|
+
|
|
|
|
+ /boxWidth % width of text box
|
|
|
|
+ pageWidth pageHeight lt
|
|
|
|
+ { pageWidth 54 mul }
|
|
|
|
+ { pageHeight 42 mul }
|
|
|
|
+ ifelse def
|
|
|
|
+
|
|
|
|
+ newpath % Clear bounding path
|
|
|
|
+
|
|
|
|
+ % Create fonts...
|
|
|
|
+ /bigFont /Helvetica-Bold findfont % bigFont = Helvetica-Bold
|
|
|
|
+ pageHeight 3 mul scalefont def % size = pageHeight * 3 (nominally 33)
|
|
|
|
+
|
|
|
|
+ /mediumFont /Helvetica findfont % mediumFont = Helvetica
|
|
|
|
+ pageHeight 1.5 mul scalefont def % size = pageHeight * 1.5 (nominally 16.5)
|
|
|
|
+
|
|
|
|
+ % Offset page to account for lower-left margin...
|
|
|
|
+ pageLeft 72 mul
|
|
|
|
+ pageBottom 72 mul
|
|
|
|
+ translate
|
|
|
|
+
|
|
|
|
+ % Job information box...
|
|
|
|
+ pageWidth 36 mul 9 add % x = pageWidth * 1/2 * 72 + 9
|
|
|
|
+ boxWidth 0.5 mul sub % x-= 1/2 box width
|
|
|
|
+ pageHeight 30 mul 9 sub % y = pageHeight * 1/2 * 72 - 9
|
|
|
|
+ boxWidth % w = box width
|
|
|
|
+ pageHeight 14 mul % h = pageHeight * 1/2 * 72
|
|
|
|
+ 0.5 setgray rectfill % Draw a shadow
|
|
|
|
+
|
|
|
|
+ pageWidth 36 mul % x = pageWidth * 1/2 * 72
|
|
|
|
+ boxWidth 0.5 mul sub % x-= 1/2 box width
|
|
|
|
+ pageHeight 30 mul % y = pageHeight * 1/4 * 72
|
|
|
|
+ boxWidth % w = box width
|
|
|
|
+ pageHeight 14 mul % h = pageHeight * 1/2 * 72
|
|
|
|
+
|
|
|
|
+ 4 copy 1 setgray rectfill % Clear the box to white
|
|
|
|
+ 0 setgray rectstroke % Draw a black box around it...
|
|
|
|
+
|
|
|
|
+ % Job information text...
|
|
|
|
+ mediumFont setfont % Medium sized font
|
|
|
|
+
|
|
|
|
+ pageWidth 36 mul % x = pageWidth * 1/2 * 72
|
|
|
|
+ pageHeight 36 mul % y = pageHeight * 1/2 * 72
|
|
|
|
+ pageHeight 5 mul add % y += 2 lines
|
|
|
|
+ 2 copy % Copy X & Y
|
|
|
|
+ moveto
|
|
|
|
+ (Job ID: ) RIGHT
|
|
|
|
+ moveto
|
|
|
|
+ ({printer-name}-{job-id}) show
|
|
|
|
+
|
|
|
|
+ pageWidth 36 mul % x = pageWidth * 1/2 * 72
|
|
|
|
+ pageHeight 36 mul % y = pageHeight * 1/2 * 72
|
|
|
|
+ pageHeight 2 mul add % y += 1 line
|
|
|
|
+ 2 copy % Copy X & Y
|
|
|
|
+ moveto
|
|
|
|
+ (Title: ) RIGHT
|
|
|
|
+ moveto
|
|
|
|
+ ({job-name}) show
|
|
|
|
+
|
|
|
|
+ pageWidth 36 mul % x = pageWidth * 1/2 * 72
|
|
|
|
+ pageHeight 36 mul % y = pageHeight * 1/2 * 72
|
|
|
|
+ pageHeight -1 mul add % y -= 1 line
|
|
|
|
+ 2 copy % Copy X & Y
|
|
|
|
+ moveto
|
|
|
|
+ (Requesting User: ) RIGHT
|
|
|
|
+ moveto
|
|
|
|
+ ({job-originating-user-name}) show
|
|
|
|
+
|
|
|
|
+ pageWidth 36 mul % x = pageWidth * 1/2 * 72
|
|
|
|
+ pageHeight 36 mul % y = pageHeight * 1/2 * 72
|
|
|
|
+ pageHeight -4 mul add % y -= 2 lines
|
|
|
|
+ 2 copy % Copy X & Y
|
|
|
|
+ moveto
|
|
|
|
+ (Billing Info: ) RIGHT
|
|
|
|
+ moveto
|
|
|
|
+ ({?job-billing}) show
|
|
|
|
+
|
|
|
|
+ % Then the CUPS logo....
|
|
|
|
+ gsave
|
|
|
|
+ pageWidth 4 mul
|
|
|
|
+ pageWidth 6 mul
|
|
|
|
+ translate
|
|
|
|
+ pageWidth 9 mul CUPSLOGO
|
|
|
|
+ grestore
|
|
|
|
+
|
|
|
|
+ % And the ESP logo....
|
|
|
|
+ gsave
|
|
|
|
+ pageWidth 59 mul
|
|
|
|
+ pageWidth 6 mul
|
|
|
|
+ translate
|
|
|
|
+ pageWidth 6 mul ESPLOGO
|
|
|
|
+ grestore
|
|
|
|
+% Show the page...
|
|
|
|
+grestore
|
|
|
|
+showpage
|
|
|
|
+%
|
|
|
|
+% End of "$Id: mls_template,v 1.1 2005/06/27 18:44:46 colmo Exp $".
|
|
|
|
+%
|
|
|
|
+%%EOF
|
2007-07-18 11:55:01 +00:00
|
|
|
--- cups-1.3b1/filter/common.c.lspp 2007-07-11 22:46:42.000000000 +0100
|
|
|
|
+++ cups-1.3b1/filter/common.c 2007-07-18 11:40:59.000000000 +0100
|
|
|
|
@@ -30,6 +30,12 @@
|
|
|
|
* Include necessary headers...
|
|
|
|
*/
|
2006-11-22 11:59:57 +00:00
|
|
|
|
2007-07-18 11:55:01 +00:00
|
|
|
+#include "config.h"
|
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+#define _GNU_SOURCE
|
|
|
|
+#include <string.h>
|
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
+
|
|
|
|
#include "common.h"
|
|
|
|
#include <locale.h>
|
2006-11-22 11:59:57 +00:00
|
|
|
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -312,6 +318,18 @@
|
|
|
|
{
|
|
|
|
const char *classification; /* CLASSIFICATION environment variable */
|
|
|
|
const char *ptr; /* Temporary string pointer */
|
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+ int i, /* counter */
|
|
|
|
+ n, /* counter */
|
|
|
|
+ lines, /* number of lines needed */
|
|
|
|
+ line_len, /* index into tmp_label */
|
|
|
|
+ label_len, /* length of the label in characters */
|
|
|
|
+ label_index, /* index into the label */
|
|
|
|
+ longest, /* length of the longest line */
|
|
|
|
+ longest_line, /* index to the longest line */
|
|
|
|
+ max_width; /* maximum width in characters */
|
|
|
|
+ char **wrapped_label; /* label with line breaks */
|
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@@ -334,6 +352,124 @@
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+ if (strncmp(classification, "LSPP:", 5) == 0 && label == NULL)
|
|
|
|
+ {
|
|
|
|
+ /*
|
|
|
|
+ * Based on the 12pt fixed width font below determine the max_width
|
|
|
|
+ */
|
|
|
|
+ max_width = width / 8;
|
|
|
|
+ longest_line = 0;
|
|
|
|
+ longest = 0;
|
|
|
|
+ classification += 5; // Skip the "LSPP:"
|
|
|
|
+ label_len = strlen(classification);
|
2006-11-22 11:59:57 +00:00
|
|
|
+
|
2007-07-18 11:55:01 +00:00
|
|
|
+ if (label_len > max_width)
|
|
|
|
+ {
|
|
|
|
+ lines = 1 + (int)(label_len / max_width);
|
|
|
|
+ line_len = (int)(label_len / lines);
|
|
|
|
+ wrapped_label = malloc(sizeof(wrapped_label) * lines);
|
|
|
|
+ label_index = i = n = 0;
|
|
|
|
+ while (classification[label_index])
|
|
|
|
+ {
|
|
|
|
+ if ((label_index + line_len) > label_len)
|
|
|
|
+ break;
|
|
|
|
+ switch (classification[label_index + line_len + i])
|
|
|
|
+ {
|
|
|
|
+ case ':':
|
|
|
|
+ case ',':
|
|
|
|
+ case '-':
|
|
|
|
+ i++;
|
|
|
|
+ wrapped_label[n++] = strndup(&classification[label_index], (line_len + i));
|
|
|
|
+ label_index += line_len + i;
|
|
|
|
+ i = 0;
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ i++;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ if ((i + line_len) == max_width)
|
|
|
|
+ {
|
|
|
|
+ wrapped_label[n++] = strndup(&(classification[label_index]), (line_len + i));
|
|
|
|
+ label_index = label_index + line_len + i;
|
|
|
|
+ i = 0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ wrapped_label[n] = strndup(&classification[label_index], label_len - label_index);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ lines = 1;
|
|
|
|
+ wrapped_label = malloc(sizeof(wrapped_label));
|
|
|
|
+ wrapped_label[0] = (char*)classification;
|
|
|
|
+ }
|
2006-11-22 11:59:57 +00:00
|
|
|
+
|
2007-07-18 11:55:01 +00:00
|
|
|
+ for (n = 0; n < lines; n++ )
|
|
|
|
+ {
|
|
|
|
+ printf("userdict/ESPp%c(", ('a' + n));
|
|
|
|
+ for (ptr = wrapped_label[n], i = 0; *ptr; ptr ++, i++)
|
|
|
|
+ if (*ptr < 32 || *ptr > 126)
|
|
|
|
+ printf("\\%03o", *ptr);
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (*ptr == '(' || *ptr == ')' || *ptr == '\\')
|
|
|
|
+ putchar('\\');
|
2006-11-22 11:59:57 +00:00
|
|
|
+
|
2007-07-18 11:55:01 +00:00
|
|
|
+ printf("%c", *ptr);
|
|
|
|
+ }
|
|
|
|
+ if (i > longest)
|
|
|
|
+ {
|
|
|
|
+ longest = i;
|
|
|
|
+ longest_line = n;
|
|
|
|
+ }
|
|
|
|
+ printf(")put\n");
|
|
|
|
+ }
|
2007-03-02 14:13:58 +00:00
|
|
|
+
|
2007-07-18 11:55:01 +00:00
|
|
|
+ /*
|
|
|
|
+ * For LSPP use a fixed width font so that line wrapping can be calculated
|
|
|
|
+ */
|
2006-07-21 12:00:05 +00:00
|
|
|
+
|
2007-07-18 11:55:01 +00:00
|
|
|
+ puts("userdict/ESPlf /Nimbus-Mono findfont 12 scalefont put");
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * Finally, the procedure to write the labels on the page...
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ printf("userdict/ESPwl{\n"
|
|
|
|
+ " ESPlf setfont\n");
|
|
|
|
+ printf(" ESPp%c stringwidth pop dup 12 add exch -0.5 mul %.0f add\n ",
|
|
|
|
+ 'a' + longest_line, width * 0.5f);
|
|
|
|
+ for (n = 1; n < lines; n++)
|
|
|
|
+ printf(" dup");
|
|
|
|
+ printf("\n 1 setgray\n");
|
|
|
|
+ printf(" dup 6 sub %.0f %d index %.0f ESPrf\n",
|
|
|
|
+ (bottom - 2.0), (2 + lines), 6.0 + (16.0 * lines));
|
|
|
|
+ printf(" dup 6 sub %.0f %d index %.0f ESPrf\n",
|
|
|
|
+ (top - 6.0 - (16.0 * lines)), (2 + lines), 4.0 + (16.0 * lines));
|
|
|
|
+ printf(" 0 setgray\n");
|
|
|
|
+ printf(" dup 6 sub %.0f %d index %.0f ESPrs\n",
|
|
|
|
+ (bottom - 2.0), (2 + lines), 6.0 + (16.0 * lines));
|
|
|
|
+ printf(" dup 6 sub %.0f %d index %.0f ESPrs\n",
|
|
|
|
+ (top - 6.0 - (16.0 * lines)), (2 + lines), 4.0 + (16.0 * lines));
|
|
|
|
+ for (n = 0; n < lines; n ++)
|
|
|
|
+ {
|
|
|
|
+ printf(" dup %.0f moveto ESPp%c show\n",
|
|
|
|
+ bottom + 6.0 + ((lines - (n+1)) * 16.0), 'a' + n);
|
|
|
|
+ printf(" %.0f moveto ESPp%c show\n", top + 2.0 - ((n + 1) * 16.0), 'a' + n);
|
|
|
|
+ }
|
|
|
|
+ printf(" pop\n"
|
|
|
|
+ "}bind put\n");
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * Do some clean up at the end of the LSPP special case
|
|
|
|
+ */
|
|
|
|
+ free(wrapped_label);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+#endif /* !WITH_LSPP */
|
|
|
|
+
|
|
|
|
/*
|
|
|
|
* Set the classification + page label string...
|
|
|
|
*/
|
|
|
|
@@ -414,7 +550,10 @@
|
|
|
|
printf(" %.0f moveto ESPpl show\n", top - 14.0);
|
|
|
|
puts("pop");
|
|
|
|
puts("}bind put");
|
|
|
|
+ }
|
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
}
|
|
|
|
+#endif /* WITH_LSPP */
|
2007-03-02 14:13:58 +00:00
|
|
|
|
|
|
|
|
2006-07-21 12:00:05 +00:00
|
|
|
/*
|
2007-07-18 11:55:01 +00:00
|
|
|
--- cups-1.3b1/scheduler/client.h.lspp 2007-07-11 22:46:42.000000000 +0100
|
|
|
|
+++ cups-1.3b1/scheduler/client.h 2007-07-18 12:11:40.000000000 +0100
|
|
|
|
@@ -17,6 +17,13 @@
|
|
|
|
# include <Security/Authorization.h>
|
|
|
|
#endif /* HAVE_AUTHORIZATION_H */
|
2006-07-21 12:00:05 +00:00
|
|
|
|
2007-03-02 14:13:58 +00:00
|
|
|
+/* Copyright (C) 2005 Trusted Computer Solutions, Inc. */
|
|
|
|
+/* (c) Copyright 2005-2006 Hewlett-Packard Development Company, L.P. */
|
|
|
|
+
|
2006-07-21 12:00:05 +00:00
|
|
|
+#ifdef WITH_LSPP
|
2007-03-02 14:13:58 +00:00
|
|
|
+#include <selinux/selinux.h>
|
2006-07-21 12:00:05 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
2007-03-02 14:13:58 +00:00
|
|
|
+
|
2006-07-21 12:00:05 +00:00
|
|
|
/*
|
2007-03-02 14:13:58 +00:00
|
|
|
* HTTP client structure...
|
|
|
|
*/
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -62,6 +69,10 @@
|
|
|
|
#ifdef HAVE_AUTHORIZATION_H
|
|
|
|
AuthorizationRef authref; /* Authorization ref */
|
|
|
|
#endif /* HAVE_AUTHORIZATION_H */
|
2006-11-22 11:59:57 +00:00
|
|
|
+#ifdef WITH_LSPP
|
2007-03-02 14:13:58 +00:00
|
|
|
+ security_context_t scon; /* Security context of connection */
|
|
|
|
+ uid_t auid; /* Audit loginuid of the client */
|
2006-11-22 11:59:57 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
2007-03-02 14:13:58 +00:00
|
|
|
};
|
2006-11-22 11:59:57 +00:00
|
|
|
|
2007-03-02 14:13:58 +00:00
|
|
|
#define HTTP(con) &((con)->http)
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -127,6 +138,9 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
extern void cupsdStopListening(void);
|
|
|
|
extern void cupsdUpdateCGI(void);
|
2007-07-18 11:55:01 +00:00
|
|
|
extern void cupsdWriteClient(cupsd_client_t *con);
|
2006-07-21 12:00:05 +00:00
|
|
|
+#ifdef WITH_LSPP
|
2007-03-02 14:13:58 +00:00
|
|
|
+extern uid_t client_pid_to_auid(pid_t clipid);
|
2006-07-21 12:00:05 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
2006-11-22 11:59:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
2007-07-18 11:55:01 +00:00
|
|
|
--- cups-1.3b1/scheduler/conf.c.lspp 2007-07-18 11:40:59.000000000 +0100
|
|
|
|
+++ cups-1.3b1/scheduler/conf.c 2007-07-18 12:13:21.000000000 +0100
|
|
|
|
@@ -26,6 +26,7 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
* read_configuration() - Read a configuration file.
|
|
|
|
* read_location() - Read a <Location path> definition.
|
|
|
|
* read_policy() - Read a <Policy name> definition.
|
|
|
|
+ * is_lspp_config() - Is the system configured for LSPP
|
2006-11-22 11:59:57 +00:00
|
|
|
*/
|
2007-03-02 14:13:58 +00:00
|
|
|
|
|
|
|
/*
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -48,6 +49,9 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
# define INADDR_NONE 0xffffffff
|
|
|
|
#endif /* !INADDR_NONE */
|
2006-11-22 11:59:57 +00:00
|
|
|
|
2006-10-03 10:57:31 +00:00
|
|
|
+#ifdef WITH_LSPP
|
2007-03-02 14:13:58 +00:00
|
|
|
+# include <libaudit.h>
|
2006-10-03 10:57:31 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
2006-07-21 12:00:05 +00:00
|
|
|
|
2006-11-22 11:59:57 +00:00
|
|
|
/*
|
2007-03-02 14:13:58 +00:00
|
|
|
* Configuration variable structure...
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -159,6 +163,10 @@
|
|
|
|
# if defined(HAVE_LIBSSL) || defined(HAVE_GNUTLS)
|
2007-03-02 14:13:58 +00:00
|
|
|
{ "ServerKey", &ServerKey, CUPSD_VARTYPE_STRING },
|
|
|
|
# endif /* HAVE_LIBSSL || HAVE_GNUTLS */
|
2006-10-03 10:57:31 +00:00
|
|
|
+#ifdef WITH_LSPP
|
2007-03-02 14:13:58 +00:00
|
|
|
+ { "AuditLog", &AuditLog, CUPSD_VARTYPE_INTEGER },
|
2007-03-29 10:30:29 +00:00
|
|
|
+ { "PerPageLabels", &PerPageLabels, CUPSD_VARTYPE_BOOLEAN },
|
2006-11-22 11:59:57 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
2007-07-18 11:55:01 +00:00
|
|
|
#endif /* HAVE_SSL */
|
|
|
|
{ "ServerName", &ServerName, CUPSD_VARTYPE_STRING },
|
|
|
|
{ "ServerRoot", &ServerRoot, CUPSD_VARTYPE_STRING },
|
|
|
|
@@ -349,6 +357,9 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
*old_requestroot; /* Old RequestRoot */
|
|
|
|
const char *tmpdir; /* TMPDIR environment variable */
|
|
|
|
struct stat tmpinfo; /* Temporary directory info */
|
2006-11-22 11:59:57 +00:00
|
|
|
+#ifdef WITH_LSPP
|
2007-03-02 14:13:58 +00:00
|
|
|
+ char *audit_message; /* Audit message string */
|
2006-10-03 10:57:31 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
|
2006-07-21 12:00:05 +00:00
|
|
|
|
2007-03-02 14:13:58 +00:00
|
|
|
/*
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -610,6 +621,25 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
|
|
|
|
RunUser = getuid();
|
2006-07-21 12:00:05 +00:00
|
|
|
|
|
|
|
+#ifdef WITH_LSPP
|
2007-03-29 10:30:29 +00:00
|
|
|
+ if (AuditLog != -1)
|
|
|
|
+ {
|
|
|
|
+ /*
|
|
|
|
+ * ClassifyOverride is set during read_configuration, if its ON, report it now
|
|
|
|
+ */
|
|
|
|
+ if (ClassifyOverride)
|
|
|
|
+ audit_log_user_message(AuditLog, AUDIT_USYS_CONFIG,
|
|
|
|
+ "[Config] ClassifyOverride=enabled Users can override print banners",
|
|
|
|
+ ServerName, NULL, NULL, 1);
|
|
|
|
+ /*
|
|
|
|
+ * PerPageLabel is set during read_configuration, if its OFF, report it now
|
|
|
|
+ */
|
|
|
|
+ if (!PerPageLabels)
|
|
|
|
+ audit_log_user_message(AuditLog, AUDIT_USYS_CONFIG,
|
|
|
|
+ "[Config] PerPageLabels=disabled", ServerName, NULL, NULL, 1);
|
|
|
|
+ }
|
2007-03-02 14:13:58 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
+
|
|
|
|
/*
|
|
|
|
* See if the ServerName is an IP address...
|
|
|
|
*/
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -921,11 +951,23 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
if (MaxActiveJobs > (MaxFDs / 3))
|
|
|
|
MaxActiveJobs = MaxFDs / 3;
|
|
|
|
|
|
|
|
- if (Classification && !strcasecmp(Classification, "none"))
|
|
|
|
+ if (Classification && strcasecmp(Classification, "none") == 0)
|
|
|
|
cupsdClearString(&Classification);
|
|
|
|
|
|
|
|
if (Classification)
|
|
|
|
+ {
|
|
|
|
cupsdLogMessage(CUPSD_LOG_INFO, "Security set to \"%s\"", Classification);
|
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+ if (AuditLog != -1)
|
2006-11-22 11:59:57 +00:00
|
|
|
+ {
|
2007-03-02 14:13:58 +00:00
|
|
|
+ audit_message = NULL;
|
|
|
|
+ cupsdSetStringf(&audit_message, "[Config] Classification=%s", Classification);
|
|
|
|
+ audit_log_user_message(AuditLog, AUDIT_LABEL_LEVEL_CHANGE, audit_message,
|
|
|
|
+ ServerName, NULL, NULL, 1);
|
|
|
|
+ free(audit_message);
|
2006-11-22 11:59:57 +00:00
|
|
|
+ }
|
2007-03-02 14:13:58 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Update the MaxClientsPerHost value, as needed...
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -3379,6 +3421,18 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+int is_lspp_config()
|
|
|
|
+{
|
|
|
|
+ if (Classification != NULL)
|
|
|
|
+ return ((strcasecmp(Classification, MLS_CONFIG) == 0)
|
|
|
|
+ || (strcasecmp(Classification, TE_CONFIG) == 0)
|
|
|
|
+ || (strcasecmp(Classification, SELINUX_CONFIG) == 0));
|
|
|
|
+ else
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
+
|
|
|
|
|
|
|
|
/*
|
2007-07-18 11:55:01 +00:00
|
|
|
* End of "$Id: conf.c 6649 2007-07-11 21:46:42Z mike $".
|
|
|
|
--- cups-1.3b1/scheduler/client.c.lspp 2007-07-14 01:16:39.000000000 +0100
|
|
|
|
+++ cups-1.3b1/scheduler/client.c 2007-07-18 12:15:06.000000000 +0100
|
|
|
|
@@ -39,12 +39,14 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
* pipe_command() - Pipe the output of a command to the remote client.
|
|
|
|
* write_file() - Send a file via HTTP.
|
2007-07-18 11:55:01 +00:00
|
|
|
* write_pipe() - Flag that data is available on the CGI pipe.
|
2007-03-02 14:13:58 +00:00
|
|
|
+ * client_pid_to_auid() - Get the audit login uid of the client.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Include necessary headers...
|
|
|
|
*/
|
|
|
|
|
|
|
|
+#define _GNU_SOURCE
|
|
|
|
#include <cups/http-private.h>
|
|
|
|
#include "cupsd.h"
|
|
|
|
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -76,6 +78,12 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
# include <gnutls/x509.h>
|
|
|
|
#endif /* HAVE_GNUTLS */
|
|
|
|
|
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+#include <selinux/selinux.h>
|
|
|
|
+#include <selinux/context.h>
|
|
|
|
+#include <fcntl.h>
|
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
+
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local functions...
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -335,6 +343,57 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+ if (is_lspp_config())
|
|
|
|
+ {
|
|
|
|
+ struct ucred cr;
|
|
|
|
+ unsigned int cl=sizeof(cr);
|
|
|
|
+
|
|
|
|
+ if (getsockopt(con->http.fd, SOL_SOCKET, SO_PEERCRED, &cr, &cl) == 0)
|
2006-11-22 11:59:57 +00:00
|
|
|
+ {
|
2007-03-02 14:13:58 +00:00
|
|
|
+ /*
|
|
|
|
+ * client_pid_to_auid() can be racey
|
|
|
|
+ * In this case the pid is based on a socket connected to the client
|
|
|
|
+ */
|
|
|
|
+ if ((con->auid = client_pid_to_auid(cr.pid)) == -1)
|
2006-11-22 11:59:57 +00:00
|
|
|
+ {
|
2007-03-02 14:13:58 +00:00
|
|
|
+ close(con->http.fd);
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR, "cupsdAcceptClient: "
|
|
|
|
+ "unable to determine client auid for client pid=%d", cr.pid);
|
|
|
|
+ free(con);
|
2006-11-22 11:59:57 +00:00
|
|
|
+ return;
|
|
|
|
+ }
|
2007-03-02 14:13:58 +00:00
|
|
|
+ cupsdLogMessage(CUPSD_LOG_INFO, "cupsdAcceptClient: peer's pid=%d, uid=%d, gid=%d, auid=%d",
|
|
|
|
+ cr.pid, cr.uid, cr.gid, con->auid);
|
2006-11-22 11:59:57 +00:00
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
2007-03-02 14:13:58 +00:00
|
|
|
+ close(con->http.fd);
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR, "cupsdAcceptClient: getsockopt() failed");
|
|
|
|
+ free(con);
|
|
|
|
+ return;
|
2006-11-22 11:59:57 +00:00
|
|
|
+ }
|
2007-03-02 14:13:58 +00:00
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * get the context of the peer connection
|
|
|
|
+ */
|
|
|
|
+ if (getpeercon(con->http.fd, &con->scon))
|
2006-11-22 11:59:57 +00:00
|
|
|
+ {
|
2007-03-02 14:13:58 +00:00
|
|
|
+ close(con->http.fd);
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR, "cupsdAcceptClient: getpeercon() failed");
|
|
|
|
+ free(con);
|
|
|
|
+ return;
|
2006-11-22 11:59:57 +00:00
|
|
|
+ }
|
2007-03-02 14:13:58 +00:00
|
|
|
+
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_INFO, "cupsdAcceptClient: client context=%s", con->scon);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdAcceptClient: skipping getpeercon()");
|
|
|
|
+ cupsdSetString(&con->scon, UNKNOWN_SL);
|
2006-11-22 11:59:57 +00:00
|
|
|
+ }
|
|
|
|
+#endif /* WITH_LSPP */
|
2006-07-21 12:00:05 +00:00
|
|
|
+
|
2007-03-02 14:13:58 +00:00
|
|
|
#ifdef AF_INET6
|
|
|
|
if (con->http.hostaddr->addr.sa_family == AF_INET6)
|
|
|
|
cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdAcceptClient: %d from %s:%d (IPv6)",
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -717,6 +776,13 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
mime_type_t *type; /* MIME type of file */
|
|
|
|
cupsd_printer_t *p; /* Printer */
|
|
|
|
static unsigned request_id = 0; /* Request ID for temp files */
|
2006-11-22 11:59:57 +00:00
|
|
|
+#ifdef WITH_LSPP
|
2007-03-02 14:13:58 +00:00
|
|
|
+ security_context_t spoolcon; /* context of the job file */
|
|
|
|
+ context_t clicon; /* contex_t container for con->scon */
|
|
|
|
+ context_t tmpcon; /* temp context to swap the level */
|
|
|
|
+ char *clirange; /* SELinux sensitivity range */
|
|
|
|
+ char *cliclearance; /* SELinux low end clearance */
|
2006-11-22 11:59:57 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
|
|
|
|
|
2007-03-02 14:13:58 +00:00
|
|
|
status = HTTP_CONTINUE;
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -1989,6 +2055,63 @@
|
|
|
|
fchmod(con->file, 0640);
|
|
|
|
fchown(con->file, RunUser, Group);
|
|
|
|
fcntl(con->file, F_SETFD, fcntl(con->file, F_GETFD) | FD_CLOEXEC);
|
2006-11-22 11:59:57 +00:00
|
|
|
+#ifdef WITH_LSPP
|
2007-07-18 11:55:01 +00:00
|
|
|
+ if (strncmp(con->scon, UNKNOWN_SL, strlen(UNKNOWN_SL)) != 0)
|
|
|
|
+ {
|
|
|
|
+ if (getfilecon(con->filename, &spoolcon) == -1)
|
|
|
|
+ {
|
|
|
|
+ cupsdSendError(con, HTTP_SERVER_ERROR, AUTH_NONE);
|
|
|
|
+ return (cupsdCloseClient(con));
|
|
|
|
+ }
|
|
|
|
+ clicon = context_new(con->scon);
|
|
|
|
+ tmpcon = context_new(spoolcon);
|
|
|
|
+ freecon(spoolcon);
|
|
|
|
+ if (!clicon || !tmpcon)
|
|
|
|
+ {
|
|
|
|
+ cupsdSendError(con, HTTP_SERVER_ERROR, AUTH_NONE);
|
|
|
|
+ if (clicon)
|
|
|
|
+ context_free(clicon);
|
|
|
|
+ if (tmpcon)
|
|
|
|
+ context_free(tmpcon);
|
|
|
|
+ return (cupsdCloseClient(con));
|
|
|
|
+ }
|
|
|
|
+ clirange = strdup(context_range_get(clicon));
|
|
|
|
+ if ((cliclearance = strtok(clirange, "-")) != NULL)
|
|
|
|
+ {
|
|
|
|
+ if (context_range_set(tmpcon, cliclearance) == -1)
|
|
|
|
+ {
|
|
|
|
+ cupsdSendError(con, HTTP_SERVER_ERROR, AUTH_NONE);
|
|
|
|
+ free(clirange);
|
|
|
|
+ context_free(tmpcon);
|
|
|
|
+ context_free(clicon);
|
|
|
|
+ return (cupsdCloseClient(con));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (context_range_set(tmpcon, (context_range_get(clicon))) == -1)
|
|
|
|
+ {
|
|
|
|
+ cupsdSendError(con, HTTP_SERVER_ERROR, AUTH_NONE);
|
|
|
|
+ free(clirange);
|
|
|
|
+ context_free(tmpcon);
|
|
|
|
+ context_free(clicon);
|
|
|
|
+ return (cupsdCloseClient(con));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ free(clirange);
|
|
|
|
+ if (setfilecon(con->filename, context_str(tmpcon)) == -1)
|
|
|
|
+ {
|
|
|
|
+ cupsdSendError(con, HTTP_SERVER_ERROR, AUTH_NONE);
|
|
|
|
+ context_free(tmpcon);
|
|
|
|
+ context_free(clicon);
|
|
|
|
+ return (cupsdCloseClient(con));
|
|
|
|
+ }
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdReadClient: %s set to %s",
|
|
|
|
+ con->filename, context_str(tmpcon));
|
|
|
|
+ context_free(tmpcon);
|
|
|
|
+ context_free(clicon);
|
|
|
|
+ }
|
2007-03-02 14:13:58 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
2007-07-18 11:55:01 +00:00
|
|
|
}
|
2007-03-02 14:13:58 +00:00
|
|
|
|
2007-07-18 11:55:01 +00:00
|
|
|
if (con->http.state != HTTP_POST_SEND)
|
|
|
|
@@ -4144,6 +4267,50 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
#endif /* HAVE_SSL */
|
|
|
|
|
|
|
|
|
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+/*
|
|
|
|
+ * 'client_pid_to_auid()' - Using the client's pid, read /proc and determine the loginuid.
|
|
|
|
+ */
|
2006-07-21 12:00:05 +00:00
|
|
|
+
|
2007-03-02 14:13:58 +00:00
|
|
|
+uid_t client_pid_to_auid(pid_t clipid)
|
|
|
|
+{
|
|
|
|
+ uid_t uid;
|
|
|
|
+ int len, in;
|
|
|
|
+ char buf[16] = {0};
|
|
|
|
+ char fname[32] = {0};
|
2006-07-21 12:00:05 +00:00
|
|
|
+
|
|
|
|
+
|
2007-03-02 14:13:58 +00:00
|
|
|
+ /*
|
|
|
|
+ * Hopefully this pid is still the one we are interested in.
|
|
|
|
+ */
|
|
|
|
+ snprintf(fname, 32, "/proc/%d/loginuid", clipid);
|
|
|
|
+ in = open(fname, O_NOFOLLOW|O_RDONLY);
|
2006-07-21 12:00:05 +00:00
|
|
|
+
|
2007-03-02 14:13:58 +00:00
|
|
|
+ if (in < 0)
|
|
|
|
+ return -1;
|
2006-08-02 09:37:31 +00:00
|
|
|
+
|
2007-03-02 14:13:58 +00:00
|
|
|
+ errno = 0;
|
2006-08-02 09:37:31 +00:00
|
|
|
+
|
2007-03-02 14:13:58 +00:00
|
|
|
+ do {
|
|
|
|
+ len = read(in, buf, sizeof(buf));
|
|
|
|
+ } while (len < 0 && errno == EINTR);
|
2006-07-21 12:00:05 +00:00
|
|
|
+
|
2007-03-02 14:13:58 +00:00
|
|
|
+ close(in);
|
|
|
|
+
|
|
|
|
+ if (len < 0 || len >= sizeof(buf))
|
|
|
|
+ return -1;
|
|
|
|
+
|
|
|
|
+ errno = 0;
|
|
|
|
+ buf[len] = 0;
|
|
|
|
+ uid = strtol(buf, 0, 10);
|
|
|
|
+
|
|
|
|
+ if (errno != 0)
|
|
|
|
+ return -1;
|
|
|
|
+ else
|
|
|
|
+ return uid;
|
|
|
|
+}
|
2006-07-21 12:00:05 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
+
|
|
|
|
/*
|
2007-03-02 14:13:58 +00:00
|
|
|
* 'pipe_command()' - Pipe the output of a command to the remote client.
|
2006-07-21 12:00:05 +00:00
|
|
|
*/
|
2007-07-18 11:55:01 +00:00
|
|
|
--- cups-1.3b1/scheduler/main.c.lspp 2007-07-18 11:40:59.000000000 +0100
|
|
|
|
+++ cups-1.3b1/scheduler/main.c 2007-07-18 11:40:59.000000000 +0100
|
|
|
|
@@ -35,6 +35,8 @@
|
2006-11-22 11:59:57 +00:00
|
|
|
* usage() - Show scheduler usage.
|
2006-07-21 12:00:05 +00:00
|
|
|
*/
|
|
|
|
|
2006-11-22 11:59:57 +00:00
|
|
|
+/* (c) Copyright 2005-2006 Hewlett-Packard Development Company, L.P. */
|
|
|
|
+
|
2006-07-21 12:00:05 +00:00
|
|
|
/*
|
2006-11-22 11:59:57 +00:00
|
|
|
* Include necessary headers...
|
|
|
|
*/
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -72,6 +74,9 @@
|
|
|
|
# include <dlfcn.h>
|
|
|
|
#endif /* __APPLE__ && HAVE_DLFCN_H */
|
2006-07-21 12:00:05 +00:00
|
|
|
|
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+# include <libaudit.h>
|
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
|
|
|
|
/*
|
2006-11-22 11:59:57 +00:00
|
|
|
* Local functions...
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -149,6 +154,9 @@
|
2006-11-22 11:59:57 +00:00
|
|
|
int launchd_idle_exit;
|
|
|
|
/* Idle exit on select timeout? */
|
|
|
|
#endif /* HAVE_LAUNCHD */
|
|
|
|
+#if WITH_LSPP
|
|
|
|
+ auditfail_t failmode; /* Action for audit_open failure */
|
2006-08-02 09:37:31 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -367,6 +375,25 @@
|
2006-11-22 11:59:57 +00:00
|
|
|
#endif /* DEBUG */
|
|
|
|
}
|
2006-08-21 16:26:28 +00:00
|
|
|
|
2006-07-21 12:00:05 +00:00
|
|
|
+#ifdef WITH_LSPP
|
2006-11-22 11:59:57 +00:00
|
|
|
+ if ((AuditLog = audit_open()) < 0 )
|
2006-08-02 09:37:31 +00:00
|
|
|
+ {
|
2006-11-22 11:59:57 +00:00
|
|
|
+ if (get_auditfail_action(&failmode) == 0)
|
2006-08-21 16:26:28 +00:00
|
|
|
+ {
|
2006-11-22 11:59:57 +00:00
|
|
|
+ if (failmode == FAIL_LOG)
|
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to connect to audit subsystem.");
|
|
|
|
+ AuditLog = -1;
|
|
|
|
+ }
|
|
|
|
+ else if (failmode == FAIL_TERMINATE)
|
|
|
|
+ {
|
|
|
|
+ fprintf(stderr, "cupsd: unable to start auditing, terminating");
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
2006-08-21 16:26:28 +00:00
|
|
|
+ }
|
2006-08-02 09:37:31 +00:00
|
|
|
+ }
|
2006-11-22 11:59:57 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
+
|
2006-08-02 09:37:31 +00:00
|
|
|
/*
|
2006-11-22 11:59:57 +00:00
|
|
|
* Set the timezone info...
|
|
|
|
*/
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -981,6 +1008,11 @@
|
|
|
|
|
|
|
|
cupsdStopSelect();
|
2006-07-21 12:00:05 +00:00
|
|
|
|
|
|
|
+#ifdef WITH_LSPP
|
2006-11-22 11:59:57 +00:00
|
|
|
+ if (AuditLog != -1)
|
|
|
|
+ audit_close(AuditLog);
|
2006-07-21 12:00:05 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
2006-08-02 09:37:31 +00:00
|
|
|
+
|
2006-11-22 11:59:57 +00:00
|
|
|
return (!stop_scheduler);
|
|
|
|
}
|
2006-08-02 09:37:31 +00:00
|
|
|
|
2007-07-18 11:55:01 +00:00
|
|
|
--- cups-1.3b1/scheduler/conf.h.lspp 2007-07-18 11:40:59.000000000 +0100
|
|
|
|
+++ cups-1.3b1/scheduler/conf.h 2007-07-18 11:40:59.000000000 +0100
|
|
|
|
@@ -190,6 +190,12 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
/* Server key file */
|
|
|
|
# endif /* HAVE_LIBSSL || HAVE_GNUTLS */
|
|
|
|
#endif /* HAVE_SSL */
|
2006-08-02 09:37:31 +00:00
|
|
|
+#ifdef WITH_LSPP
|
2007-03-29 10:30:29 +00:00
|
|
|
+VAR int AuditLog VALUE(-1),
|
2007-03-02 14:13:58 +00:00
|
|
|
+ /* File descriptor for audit */
|
2007-03-29 10:30:29 +00:00
|
|
|
+ PerPageLabels VALUE(TRUE);
|
|
|
|
+ /* Put the label on each page */
|
2006-08-02 09:37:31 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
2006-07-21 12:00:05 +00:00
|
|
|
|
2007-03-02 14:13:58 +00:00
|
|
|
#ifdef HAVE_LAUNCHD
|
|
|
|
VAR int LaunchdTimeout VALUE(DEFAULT_TIMEOUT);
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -208,6 +214,9 @@
|
|
|
|
/* System group auth key */
|
|
|
|
#endif /* HAVE_AUTHORIZATION_H */
|
2007-03-02 14:13:58 +00:00
|
|
|
|
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+extern int is_lspp_config(void);
|
|
|
|
+#endif /* WITH_LSPP */
|
2006-11-22 11:59:57 +00:00
|
|
|
|
2007-03-02 14:13:58 +00:00
|
|
|
/*
|
2007-07-18 11:55:01 +00:00
|
|
|
* Prototypes...
|
|
|
|
--- cups-1.3b1/scheduler/ipp.c.lspp 2007-07-18 11:40:59.000000000 +0100
|
|
|
|
+++ cups-1.3b1/scheduler/ipp.c 2007-07-18 12:16:58.000000000 +0100
|
|
|
|
@@ -36,6 +36,7 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
* cancel_all_jobs() - Cancel all print jobs.
|
|
|
|
* cancel_job() - Cancel a print job.
|
|
|
|
* cancel_subscription() - Cancel a subscription.
|
|
|
|
+ * check_context() - Check the SELinux context for a user and job
|
|
|
|
* check_quotas() - Check quotas for a printer and user.
|
|
|
|
* copy_attribute() - Copy a single attribute.
|
|
|
|
* copy_attrs() - Copy attributes from one request to another.
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -93,6 +94,9 @@
|
2006-07-21 12:00:05 +00:00
|
|
|
* validate_user() - Validate the user for the request.
|
|
|
|
*/
|
|
|
|
|
|
|
|
+/* Copyright (C) 2005 Trusted Computer Solutions, Inc. */
|
|
|
|
+/* (c) Copyright 2005-2006 Hewlett-Packard Development Company, L.P. */
|
|
|
|
+
|
|
|
|
/*
|
|
|
|
* Include necessary headers...
|
|
|
|
*/
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -120,6 +124,14 @@
|
|
|
|
# endif /* HAVE_MEMBERSHIPPRIV_H */
|
|
|
|
#endif /* __APPLE__ */
|
2006-07-21 12:00:05 +00:00
|
|
|
|
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+#include <libaudit.h>
|
|
|
|
+#include <selinux/selinux.h>
|
|
|
|
+#include <selinux/context.h>
|
|
|
|
+#include <selinux/avc.h>
|
|
|
|
+#include <selinux/flask.h>
|
|
|
|
+#include <selinux/av_permissions.h>
|
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
|
|
|
|
/*
|
2006-11-22 11:59:57 +00:00
|
|
|
* Local functions...
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -144,6 +156,9 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
static void cancel_all_jobs(cupsd_client_t *con, ipp_attribute_t *uri);
|
|
|
|
static void cancel_job(cupsd_client_t *con, ipp_attribute_t *uri);
|
|
|
|
static void cancel_subscription(cupsd_client_t *con, int id);
|
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+static int check_context(cupsd_client_t *con, cupsd_job_t *job);
|
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
static int check_quotas(cupsd_client_t *con, cupsd_printer_t *p);
|
|
|
|
static ipp_attribute_t *copy_attribute(ipp_t *to, ipp_attribute_t *attr,
|
|
|
|
int quickcopy);
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -1228,6 +1243,21 @@
|
2006-07-21 12:00:05 +00:00
|
|
|
int kbytes; /* Size of print file */
|
|
|
|
int i; /* Looping var */
|
|
|
|
int lowerpagerange; /* Page range bound */
|
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+ char *audit_message; /* Audit message string */
|
|
|
|
+ char *printerfile; /* device file pointed to by the printer */
|
2006-08-21 16:26:28 +00:00
|
|
|
+ char *userheader = NULL; /* User supplied job-sheets[0] */
|
|
|
|
+ char *userfooter = NULL; /* User supplied job-sheets[1] */
|
|
|
|
+ int override = 0; /* Was a banner overrode on a job */
|
2006-10-03 10:57:31 +00:00
|
|
|
+ security_id_t clisid; /* SELinux SID for the client */
|
|
|
|
+ security_id_t psid; /* SELinux SID for the printer */
|
|
|
|
+ context_t printercon; /* Printer's context string */
|
2006-11-22 11:59:57 +00:00
|
|
|
+ struct stat printerstat; /* Printer's stat buffer */
|
2006-10-03 10:57:31 +00:00
|
|
|
+ security_context_t devcon; /* Printer's SELinux context */
|
|
|
|
+ struct avc_entry_ref avcref; /* Pointer to the access vector cache */
|
|
|
|
+ security_class_t tclass; /* Object class for the SELinux check */
|
2006-11-27 15:03:26 +00:00
|
|
|
+ access_vector_t avr; /* Access method being requested */
|
2006-07-21 12:00:05 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
|
|
|
|
|
2007-07-18 11:55:01 +00:00
|
|
|
cupsdLogMessage(CUPSD_LOG_DEBUG2, "add_job(%p[%d], %p(%s), %p(%s/%s))",
|
|
|
|
@@ -1422,6 +1452,127 @@
|
2006-07-21 12:00:05 +00:00
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+ if (is_lspp_config())
|
|
|
|
+ {
|
2006-10-04 16:04:19 +00:00
|
|
|
+ if (!con->scon || strncmp(con->scon, UNKNOWN_SL, strlen(UNKNOWN_SL)) == 0)
|
2006-07-21 12:00:05 +00:00
|
|
|
+ {
|
2007-07-18 11:55:01 +00:00
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR, "add_job: missing classification for connection \'%s\'!", printer->name);
|
2006-07-21 12:00:05 +00:00
|
|
|
+ send_ipp_status(con, IPP_INTERNAL_ERROR, _("Missing required secuirty attributes."));
|
|
|
|
+ return (NULL);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ /*
|
|
|
|
+ * duplicate the security context and auid of the connection into the job structure
|
|
|
|
+ */
|
2006-10-04 16:04:19 +00:00
|
|
|
+ job->scon = strdup(con->scon);
|
|
|
|
+ job->auid = con->auid;
|
2006-07-21 12:00:05 +00:00
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * add the security context to the request so that on a restart the security
|
|
|
|
+ * attributes will be able to be restored
|
|
|
|
+ */
|
|
|
|
+ ippAddString(con->request, IPP_TAG_JOB, IPP_TAG_NAME, "security-context",
|
|
|
|
+ NULL, job->scon);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * Perform an access check so that if the user gets feedback at enqueue time
|
|
|
|
+ */
|
|
|
|
+
|
2006-08-21 16:26:28 +00:00
|
|
|
+ printerfile = strstr(printer->device_uri, "/dev/");
|
2006-10-03 10:57:31 +00:00
|
|
|
+ if (printerfile == NULL && (strncmp(printer->device_uri, "file:/", 6) == 0))
|
|
|
|
+ printerfile = strdup(printer->device_uri + strlen("file:/"));
|
|
|
|
+
|
2006-08-21 16:26:28 +00:00
|
|
|
+ if (printerfile != NULL)
|
2006-07-21 12:00:05 +00:00
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_DEBUG, "add_job: Attempting an access check on printer device %s",
|
|
|
|
+ printerfile);
|
|
|
|
+
|
2006-11-22 11:59:57 +00:00
|
|
|
+ if (lstat(printerfile, &printerstat) < 0)
|
|
|
|
+ {
|
|
|
|
+ if (errno != ENOENT)
|
|
|
|
+ {
|
|
|
|
+ send_ipp_status(con, IPP_NOT_AUTHORIZED, _("Unable to stat the printer"));
|
|
|
|
+ return (NULL);
|
|
|
|
+ }
|
|
|
|
+ /*
|
|
|
|
+ * The printer does not exist, so for now assume it's a FileDevice
|
|
|
|
+ */
|
|
|
|
+ tclass = SECCLASS_FILE;
|
|
|
|
+ avr = FILE__WRITE;
|
|
|
|
+ }
|
|
|
|
+ else if (S_ISCHR(printerstat.st_mode))
|
|
|
|
+ {
|
|
|
|
+ tclass = SECCLASS_CHR_FILE;
|
|
|
|
+ avr = CHR_FILE__WRITE;
|
|
|
|
+ }
|
|
|
|
+ else if (S_ISREG(printerstat.st_mode))
|
|
|
|
+ {
|
|
|
|
+ tclass = SECCLASS_FILE;
|
|
|
|
+ avr = FILE__WRITE;
|
|
|
|
+ }
|
2006-11-27 15:03:26 +00:00
|
|
|
+ else
|
2006-11-22 11:59:57 +00:00
|
|
|
+ {
|
|
|
|
+ send_ipp_status(con, IPP_NOT_AUTHORIZED, _("Printer is not a character device or regular file"));
|
|
|
|
+ return (NULL);
|
|
|
|
+ }
|
2006-10-03 10:57:31 +00:00
|
|
|
+ avc_init("cupsd_enqueue_", NULL, NULL, NULL, NULL);
|
|
|
|
+ avc_entry_ref_init(&avcref);
|
|
|
|
+ if (avc_context_to_sid(con->scon, &clisid) != 0)
|
2006-07-21 12:00:05 +00:00
|
|
|
+ {
|
2006-10-03 10:57:31 +00:00
|
|
|
+ send_ipp_status(con, IPP_NOT_AUTHORIZED, _("Unable to get the SELinux sid of the client"));
|
2006-07-21 12:00:05 +00:00
|
|
|
+ return (NULL);
|
|
|
|
+ }
|
2006-10-03 10:57:31 +00:00
|
|
|
+ if (getfilecon(printerfile, &devcon) == -1)
|
|
|
|
+ {
|
|
|
|
+ send_ipp_status(con, IPP_NOT_AUTHORIZED, _("Unable to get the SELinux context of the printer"));
|
|
|
|
+ return (NULL);
|
|
|
|
+ }
|
|
|
|
+ printercon = context_new(devcon);
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_DEBUG, "add_job: printer context %s client context %s",
|
|
|
|
+ context_str(printercon), con->scon);
|
|
|
|
+ context_free(printercon);
|
2006-07-21 12:00:05 +00:00
|
|
|
+
|
2006-10-03 10:57:31 +00:00
|
|
|
+ if (avc_context_to_sid(devcon, &psid) != 0)
|
2006-07-21 12:00:05 +00:00
|
|
|
+ {
|
2006-10-03 10:57:31 +00:00
|
|
|
+ send_ipp_status(con, IPP_NOT_AUTHORIZED, _("Unable to get the SELinux sid of the printer"));
|
|
|
|
+ freecon(devcon);
|
|
|
|
+ return (NULL);
|
|
|
|
+ }
|
|
|
|
+ freecon(devcon);
|
2006-10-13 15:12:02 +00:00
|
|
|
+ if (avc_has_perm(clisid, psid, tclass, avr, &avcref, NULL) != 0)
|
2006-10-03 10:57:31 +00:00
|
|
|
+ {
|
|
|
|
+ /*
|
|
|
|
+ * The access check failed, so cancel the job and send an audit message
|
|
|
|
+ */
|
|
|
|
+ if (AuditLog != -1)
|
2006-07-21 12:00:05 +00:00
|
|
|
+ {
|
2006-10-03 10:57:31 +00:00
|
|
|
+ audit_message = NULL;
|
|
|
|
+ cupsdSetStringf(&audit_message, "job=%d auid=%u acct=%s obj=%s refused"
|
|
|
|
+ " unable to access printer=%s", job->id, con->auid,
|
|
|
|
+ con->username, con->scon, printer->name);
|
|
|
|
+ audit_log_user_message(AuditLog, AUDIT_USER_LABELED_EXPORT, audit_message,
|
|
|
|
+ ServerName, NULL, NULL, 0);
|
|
|
|
+ free(audit_message);
|
2006-07-21 12:00:05 +00:00
|
|
|
+ }
|
2006-10-03 10:57:31 +00:00
|
|
|
+
|
|
|
|
+ send_ipp_status(con, IPP_NOT_AUTHORIZED, _("SELinux prohibits access to the printer"));
|
|
|
|
+ return (NULL);
|
2006-07-21 12:00:05 +00:00
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
2006-10-04 16:04:19 +00:00
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ /*
|
|
|
|
+ * Fill in the security context of the job as unlabeled
|
|
|
|
+ */
|
2006-10-17 10:41:11 +00:00
|
|
|
+ cupsdLogMessage(CUPSD_LOG_DEBUG, "add_job: setting context of job to %s", UNKNOWN_SL);
|
2006-10-04 16:04:19 +00:00
|
|
|
+ cupsdSetString(&job->scon, UNKNOWN_SL);
|
|
|
|
+ }
|
2006-07-21 12:00:05 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
+
|
2007-07-18 11:55:01 +00:00
|
|
|
job->dtype = printer->type & (CUPS_PRINTER_CLASS | CUPS_PRINTER_IMPLICIT |
|
|
|
|
CUPS_PRINTER_REMOTE);
|
2006-07-21 12:00:05 +00:00
|
|
|
job->attrs = con->request;
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -1638,6 +1789,29 @@
|
2006-08-21 16:26:28 +00:00
|
|
|
attr->values[0].string.text = _cupsStrAlloc(printer->job_sheets[0]);
|
|
|
|
attr->values[1].string.text = _cupsStrAlloc(printer->job_sheets[1]);
|
|
|
|
}
|
2006-07-21 12:00:05 +00:00
|
|
|
+#ifdef WITH_LSPP
|
2006-08-21 16:26:28 +00:00
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ /*
|
|
|
|
+ * The option was present, so capture the user supplied strings
|
|
|
|
+ */
|
|
|
|
+ userheader = strdup(attr->values[0].string.text);
|
|
|
|
+
|
|
|
|
+ if (attr->num_values > 1)
|
|
|
|
+ userfooter = strdup(attr->values[1].string.text);
|
|
|
|
+
|
2006-08-24 15:50:51 +00:00
|
|
|
+ if (Classification != NULL && (strcmp(userheader, Classification) == 0)
|
2006-08-24 09:50:28 +00:00
|
|
|
+ && userfooter &&(strcmp(userfooter, Classification) == 0))
|
2006-08-21 16:26:28 +00:00
|
|
|
+ {
|
2006-07-21 12:00:05 +00:00
|
|
|
+ /*
|
2006-08-21 16:26:28 +00:00
|
|
|
+ * Since both values are Classification, the user is not trying to Override
|
2006-07-21 12:00:05 +00:00
|
|
|
+ */
|
2006-08-21 16:26:28 +00:00
|
|
|
+ free(userheader);
|
2006-08-24 09:50:28 +00:00
|
|
|
+ if (userfooter) free(userfooter);
|
2006-08-21 16:26:28 +00:00
|
|
|
+ userheader = userfooter = NULL;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
|
|
|
|
job->job_sheets = attr;
|
|
|
|
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -1668,6 +1842,9 @@
|
2006-08-21 16:26:28 +00:00
|
|
|
"job-sheets=\"%s,none\", "
|
|
|
|
"job-originating-user-name=\"%s\"",
|
|
|
|
job->id, Classification, job->username);
|
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+ override = 1;
|
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
}
|
|
|
|
else if (attr->num_values == 2 &&
|
|
|
|
strcmp(attr->values[0].string.text,
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -1686,6 +1863,9 @@
|
2006-08-21 16:26:28 +00:00
|
|
|
"job-originating-user-name=\"%s\"",
|
|
|
|
job->id, attr->values[0].string.text,
|
|
|
|
attr->values[1].string.text, job->username);
|
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+ override = 1;
|
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
}
|
|
|
|
else if (strcmp(attr->values[0].string.text, Classification) &&
|
|
|
|
strcmp(attr->values[0].string.text, "none") &&
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -1706,6 +1886,9 @@
|
2006-08-21 16:26:28 +00:00
|
|
|
"job-originating-user-name=\"%s\"",
|
|
|
|
job->id, attr->values[0].string.text,
|
|
|
|
attr->values[1].string.text, job->username);
|
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+ override = 1;
|
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (strcmp(attr->values[0].string.text, Classification) &&
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -1746,9 +1929,52 @@
|
2006-08-21 16:26:28 +00:00
|
|
|
"job-sheets=\"%s\", "
|
|
|
|
"job-originating-user-name=\"%s\"",
|
|
|
|
job->id, Classification, job->username);
|
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+ override = 1;
|
|
|
|
+#endif /* WITH_LSPP */
|
2006-10-13 15:12:02 +00:00
|
|
|
+ }
|
2006-08-21 16:26:28 +00:00
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+ if (is_lspp_config() && AuditLog != -1)
|
|
|
|
+ {
|
2006-07-21 12:00:05 +00:00
|
|
|
+ audit_message = NULL;
|
2006-08-21 16:26:28 +00:00
|
|
|
+
|
|
|
|
+ if (userheader || userfooter)
|
|
|
|
+ {
|
|
|
|
+ if (!override)
|
|
|
|
+ {
|
|
|
|
+ /*
|
|
|
|
+ * The user overrode the banner, so audit it
|
|
|
|
+ */
|
2006-10-03 10:57:31 +00:00
|
|
|
+ cupsdSetStringf(&audit_message, "job=%d user supplied job-sheets=%s,%s"
|
|
|
|
+ " using banners=%s,%s", job->id, userheader,
|
2006-08-21 16:26:28 +00:00
|
|
|
+ userfooter, attr->values[0].string.text,
|
|
|
|
+ (attr->num_values > 1) ? attr->values[1].string.text : "(null)");
|
|
|
|
+ audit_log_user_message(AuditLog, AUDIT_LABEL_OVERRIDE, audit_message,
|
|
|
|
+ ServerName, NULL, NULL, 1);
|
2007-03-02 14:13:58 +00:00
|
|
|
+ }
|
2006-08-21 16:26:28 +00:00
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ /*
|
|
|
|
+ * The user tried to override the banner, audit the failure
|
|
|
|
+ */
|
2006-10-03 10:57:31 +00:00
|
|
|
+ cupsdSetStringf(&audit_message, "job=%d user supplied job-sheets=%s,%s"
|
|
|
|
+ " ignored banners=%s,%s", job->id, userheader,
|
2006-08-21 16:26:28 +00:00
|
|
|
+ userfooter, attr->values[0].string.text,
|
|
|
|
+ (attr->num_values > 1) ? attr->values[1].string.text : "(null)");
|
|
|
|
+ audit_log_user_message(AuditLog, AUDIT_LABEL_OVERRIDE, audit_message,
|
|
|
|
+ ServerName, NULL, NULL, 0);
|
2006-10-04 16:27:23 +00:00
|
|
|
+ }
|
2006-11-22 11:59:57 +00:00
|
|
|
+ free(audit_message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-08-21 16:26:28 +00:00
|
|
|
+ if (userheader)
|
|
|
|
+ free(userheader);
|
|
|
|
+ if (userfooter)
|
|
|
|
+ free(userfooter);
|
2006-07-21 12:00:05 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
2006-11-22 11:59:57 +00:00
|
|
|
+ }
|
|
|
|
+
|
2006-08-21 16:26:28 +00:00
|
|
|
/*
|
2006-11-22 11:59:57 +00:00
|
|
|
* See if we need to add the starting sheet...
|
|
|
|
*/
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -3297,6 +3523,103 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+/*
|
|
|
|
+ * 'check_context()' - Check SELinux security context of a user and job
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+static int /* O - 1 if OK, 0 if not, -1 on error */
|
|
|
|
+check_context(cupsd_client_t *con, /* I - Client connection */
|
|
|
|
+ cupsd_job_t *job) /* I - Job */
|
|
|
|
+{
|
|
|
|
+ int enforcing; /* is SELinux in enforcing mode */
|
|
|
|
+ char filename[1024]; /* Filename of the spool file */
|
|
|
|
+ security_id_t clisid; /* SELinux SID of the client */
|
|
|
|
+ security_id_t jobsid; /* SELinux SID of the job */
|
|
|
|
+ security_id_t filesid; /* SELinux SID of the spool file */
|
|
|
|
+ struct avc_entry_ref avcref; /* AVC entry cache pointer */
|
|
|
|
+ security_class_t tclass; /* SELinux security class */
|
|
|
|
+ access_vector_t avr; /* SELinux access being queried */
|
|
|
|
+ security_context_t spoolfilecon; /* SELinux context of the spool file */
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * Validate the input to be sure there are contexts to work with...
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ if (con->scon == NULL || job->scon == NULL
|
|
|
|
+ || strncmp(con->scon, UNKNOWN_SL, strlen(UNKNOWN_SL)) == 0
|
|
|
|
+ || strncmp(job->scon, UNKNOWN_SL, strlen(UNKNOWN_SL)) == 0)
|
|
|
|
+ return -1;
|
|
|
|
+
|
|
|
|
+ if ((enforcing = security_getenforce()) == -1)
|
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR, "Error while determining SELinux enforcement");
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_DEBUG, "check_context: client context %s job context %s", con->scon, job->scon);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * Initialize the avc engine...
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ if (avc_init("cupsd", NULL, NULL, NULL, NULL) < 0)
|
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR, "check_context: unable avc_init");
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+ if (avc_context_to_sid(con->scon, &clisid) != 0)
|
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR, "check_context: unable to convert %s to SELinux sid", con->scon);
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+ avc_context_to_sid(job->scon, &jobsid);
|
|
|
|
+ avc_entry_ref_init(&avcref);
|
|
|
|
+ tclass = SECCLASS_FILE;
|
|
|
|
+ avr = FILE__READ;
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * Perform the check with the client as the subject, first with the job as the object
|
|
|
|
+ * if that fails then with the spool file as the object...
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ if (avc_has_perm_noaudit(clisid, jobsid, tclass, avr, &avcref, NULL) != 0)
|
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_INFO, "check_context: SELinux denied access based on the client context");
|
|
|
|
+
|
|
|
|
+ snprintf(filename, sizeof(filename), "%s/c%05d", RequestRoot, job->id);
|
|
|
|
+ if (getfilecon(filename, &spoolfilecon) == -1)
|
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR, "check_context: Unable to get spoolfile context");
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+ if (avc_context_to_sid(spoolfilecon, &filesid) != 0)
|
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR, "check_context: Unable to determine the SELinux sid for the spool file");
|
|
|
|
+ freecon(spoolfilecon);
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+ freecon(spoolfilecon);
|
|
|
|
+ if (avc_has_perm_noaudit(clisid, filesid, tclass, avr, &avcref, NULL) != 0)
|
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_INFO, "check_context: SELinux denied access to the spool file");
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_INFO, "check_context: SELinux allowed access to the spool file");
|
|
|
|
+ return 1;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ if (enforcing == 0)
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_INFO, "check_context: allowing operation due to permissive mode");
|
|
|
|
+ else
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_INFO, "check_context: SELinux allowed access based on the client context");
|
|
|
|
+
|
|
|
|
+ return 1;
|
|
|
|
+}
|
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
+
|
|
|
|
+
|
|
|
|
/*
|
|
|
|
* 'check_quotas()' - Check quotas for a printer and user.
|
|
|
|
*/
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -3823,6 +4146,15 @@
|
2006-07-21 12:00:05 +00:00
|
|
|
char attrname[255], /* Name of attribute */
|
|
|
|
*s; /* Pointer into name */
|
|
|
|
ipp_attribute_t *attr; /* Attribute */
|
|
|
|
+#ifdef WITH_LSPP
|
2006-10-13 15:12:02 +00:00
|
|
|
+ const char *mls_label; /* SL of print job */
|
|
|
|
+ char *jobrange; /* SELinux sensitivity range */
|
|
|
|
+ char *jobclearance; /* SELinux low end clearance */
|
2006-10-03 10:57:31 +00:00
|
|
|
+ context_t jobcon; /* SELinux context of the job */
|
|
|
|
+ context_t tmpcon; /* Temp context to set the level */
|
|
|
|
+ security_context_t spoolcon; /* Context of the file in the spool */
|
2006-07-21 12:00:05 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
cupsdLogMessage(CUPSD_LOG_DEBUG2, "copy_banner(%p[%d], %p[%d], %s)",
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -3857,6 +4189,77 @@
|
2006-10-03 10:57:31 +00:00
|
|
|
|
|
|
|
fchmod(cupsFileNumber(out), 0640);
|
|
|
|
fchown(cupsFileNumber(out), RunUser, Group);
|
|
|
|
+#ifdef WITH_LSPP
|
2006-10-04 16:04:19 +00:00
|
|
|
+ if (strncmp(con->scon, UNKNOWN_SL, strlen(UNKNOWN_SL)) != 0)
|
2006-10-03 10:57:31 +00:00
|
|
|
+ {
|
2006-10-04 16:04:19 +00:00
|
|
|
+ if (getfilecon(filename, &spoolcon) == -1)
|
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR,
|
|
|
|
+ "copy_banner: Unable to get the context of the banner file %s - %s",
|
|
|
|
+ filename, strerror(errno));
|
|
|
|
+ job->num_files --;
|
|
|
|
+ return (0);
|
|
|
|
+ }
|
|
|
|
+ tmpcon = context_new(spoolcon);
|
|
|
|
+ jobcon = context_new(con->scon);
|
|
|
|
+ freecon(spoolcon);
|
2006-10-04 16:27:23 +00:00
|
|
|
+ if (!tmpcon || !jobcon)
|
|
|
|
+ {
|
|
|
|
+ if (tmpcon)
|
|
|
|
+ context_free(tmpcon);
|
|
|
|
+ if (jobcon)
|
|
|
|
+ context_free(jobcon);
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR,
|
|
|
|
+ "copy_banner: Unable to get the SELinux contexts");
|
|
|
|
+ job->num_files --;
|
|
|
|
+ return (0);
|
|
|
|
+ }
|
2006-10-13 15:12:02 +00:00
|
|
|
+ jobrange = strdup(context_range_get(jobcon));
|
|
|
|
+ if ((jobclearance = strtok(jobrange, "-")) != NULL)
|
2006-10-04 16:04:19 +00:00
|
|
|
+ {
|
2006-10-13 15:12:02 +00:00
|
|
|
+ if (context_range_set(tmpcon, jobclearance) == -1)
|
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR,
|
|
|
|
+ "copy_banner: Unable to set the level of the context for file %s - %s",
|
|
|
|
+ filename, strerror(errno));
|
|
|
|
+ free(jobrange);
|
|
|
|
+ context_free(jobcon);
|
|
|
|
+ context_free(tmpcon);
|
|
|
|
+ job->num_files --;
|
|
|
|
+ return (0);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (context_range_set(tmpcon, (context_range_get(jobcon))) == -1)
|
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR,
|
|
|
|
+ "copy_banner: Unable to set the level of the context for file %s - %s",
|
|
|
|
+ filename, strerror(errno));
|
|
|
|
+ free(jobrange);
|
|
|
|
+ context_free(jobcon);
|
|
|
|
+ context_free(tmpcon);
|
|
|
|
+ job->num_files --;
|
|
|
|
+ return (0);
|
|
|
|
+ }
|
2006-10-04 16:04:19 +00:00
|
|
|
+ }
|
2006-10-13 15:12:02 +00:00
|
|
|
+ free(jobrange);
|
2006-10-04 16:04:19 +00:00
|
|
|
+ if (setfilecon(filename, context_str(tmpcon)) == -1)
|
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR,
|
|
|
|
+ "copy_banner: Unable to set the context of the banner file %s - %s",
|
|
|
|
+ filename, strerror(errno));
|
|
|
|
+ context_free(jobcon);
|
|
|
|
+ context_free(tmpcon);
|
|
|
|
+ job->num_files --;
|
|
|
|
+ return (0);
|
|
|
|
+ }
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_DEBUG2, "copy_banner: %s set to %s",
|
|
|
|
+ filename, context_str(tmpcon));
|
2006-10-03 10:57:31 +00:00
|
|
|
+ context_free(jobcon);
|
|
|
|
+ context_free(tmpcon);
|
|
|
|
+ }
|
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Try the localized banner file under the subdirectory...
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -3951,6 +4354,24 @@
|
2006-07-21 12:00:05 +00:00
|
|
|
else
|
|
|
|
s = attrname;
|
|
|
|
|
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+ if (strcmp(s, "mls-label") == 0)
|
|
|
|
+ {
|
2006-10-04 16:04:19 +00:00
|
|
|
+ if (con->scon != NULL && strncmp(con->scon, UNKNOWN_SL, strlen(UNKNOWN_SL)) != 0)
|
2006-07-21 12:00:05 +00:00
|
|
|
+ {
|
2006-10-03 10:57:31 +00:00
|
|
|
+ jobcon = context_new(con->scon);
|
2006-07-21 12:00:05 +00:00
|
|
|
+ if (strcasecmp(name, MLS_CONFIG) == 0)
|
2006-10-03 10:57:31 +00:00
|
|
|
+ mls_label = context_range_get(jobcon);
|
2006-07-21 12:00:05 +00:00
|
|
|
+ else if (strcasecmp(name, TE_CONFIG) == 0)
|
2006-10-03 10:57:31 +00:00
|
|
|
+ mls_label = context_type_get(jobcon);
|
2006-07-21 12:00:05 +00:00
|
|
|
+ else // default to using the whole context string
|
2006-10-03 10:57:31 +00:00
|
|
|
+ mls_label = context_str(jobcon);
|
2006-07-21 12:00:05 +00:00
|
|
|
+ cupsFilePuts(out, mls_label);
|
2006-10-03 10:57:31 +00:00
|
|
|
+ context_free(jobcon);
|
2006-07-21 12:00:05 +00:00
|
|
|
+ }
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
if (!strcmp(s, "printer-name"))
|
|
|
|
{
|
|
|
|
cupsFilePuts(out, job->dest);
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -5671,6 +6092,22 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
return;
|
|
|
|
}
|
2006-07-21 12:00:05 +00:00
|
|
|
|
2007-03-02 14:13:58 +00:00
|
|
|
+
|
2006-07-21 12:00:05 +00:00
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+ /*
|
2007-03-02 14:13:58 +00:00
|
|
|
+ * Check SELinux...
|
2006-07-21 12:00:05 +00:00
|
|
|
+ */
|
2007-03-02 14:13:58 +00:00
|
|
|
+ if (is_lspp_config() && check_context(con, job) != 1)
|
2006-07-21 12:00:05 +00:00
|
|
|
+ {
|
2007-03-02 14:13:58 +00:00
|
|
|
+ /*
|
|
|
|
+ * Unfortunately we have to lie to the user...
|
|
|
|
+ */
|
|
|
|
+ send_ipp_status(con, IPP_NOT_FOUND, _("Job #%d does not exist!"), jobid);
|
|
|
|
+ return;
|
2006-07-21 12:00:05 +00:00
|
|
|
+ }
|
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
+
|
|
|
|
+
|
|
|
|
/*
|
2007-03-02 14:13:58 +00:00
|
|
|
* Copy attributes...
|
2006-07-21 12:00:05 +00:00
|
|
|
*/
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -5870,6 +6307,11 @@
|
2006-07-21 12:00:05 +00:00
|
|
|
if (count > 0)
|
|
|
|
ippAddSeparator(con->response);
|
|
|
|
|
|
|
|
+#ifdef WITH_LSPP
|
2007-03-02 14:13:58 +00:00
|
|
|
+ if (is_lspp_config() && check_context(con, job) != 1)
|
|
|
|
+ continue;
|
2006-07-21 12:00:05 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
+
|
|
|
|
count ++;
|
|
|
|
|
|
|
|
cupsdLogMessage(CUPSD_LOG_DEBUG2, "get_jobs: count = %d", count);
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -9848,6 +10290,11 @@
|
2006-10-03 10:57:31 +00:00
|
|
|
|
|
|
|
strlcpy(username, get_username(con), userlen);
|
|
|
|
|
|
|
|
+#ifdef WITH_LSPP
|
2007-03-02 14:13:58 +00:00
|
|
|
+ if (is_lspp_config() && check_context(con, job) != 1)
|
|
|
|
+ return 0;
|
2006-10-03 10:57:31 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
+
|
|
|
|
/*
|
|
|
|
* Check the username against the owner...
|
|
|
|
*/
|
2007-07-18 11:55:01 +00:00
|
|
|
--- cups-1.3b1/scheduler/job.c.lspp 2007-07-18 11:40:59.000000000 +0100
|
|
|
|
+++ cups-1.3b1/scheduler/job.c 2007-07-18 11:40:59.000000000 +0100
|
|
|
|
@@ -60,6 +60,9 @@
|
|
|
|
* update_job_attrs() - Update the job-printer-* attributes.
|
2006-07-21 12:00:05 +00:00
|
|
|
*/
|
|
|
|
|
2007-03-02 14:13:58 +00:00
|
|
|
+/* Copyright (C) 2005 Trusted Computer Solutions, Inc. */
|
|
|
|
+/* (c) Copyright 2005-2006 Hewlett-Packard Development Company, L.P. */
|
|
|
|
+
|
2006-07-21 12:00:05 +00:00
|
|
|
/*
|
2007-03-02 14:13:58 +00:00
|
|
|
* Include necessary headers...
|
|
|
|
*/
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -69,6 +72,14 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
#include <cups/backend.h>
|
|
|
|
#include <cups/dir.h>
|
2006-07-21 12:00:05 +00:00
|
|
|
|
|
|
|
+#ifdef WITH_LSPP
|
2007-03-02 14:13:58 +00:00
|
|
|
+#include <libaudit.h>
|
|
|
|
+#include <selinux/selinux.h>
|
|
|
|
+#include <selinux/context.h>
|
|
|
|
+#include <selinux/avc.h>
|
|
|
|
+#include <selinux/flask.h>
|
|
|
|
+#include <selinux/av_permissions.h>
|
2006-07-21 12:00:05 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
|
|
|
|
/*
|
2007-03-02 14:13:58 +00:00
|
|
|
* Local globals...
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -1056,6 +1067,23 @@
|
|
|
|
return;
|
2007-03-02 14:13:58 +00:00
|
|
|
}
|
|
|
|
|
2006-10-03 10:57:31 +00:00
|
|
|
+#ifdef WITH_LSPP
|
2007-03-02 14:13:58 +00:00
|
|
|
+ if ((attr = ippFindAttribute(job->attrs, "security-context", IPP_TAG_NAME)) != NULL)
|
|
|
|
+ cupsdSetString(&job->scon, attr->values[0].string.text);
|
|
|
|
+ else if (is_lspp_config())
|
|
|
|
+ {
|
|
|
|
+ /*
|
|
|
|
+ * There was no security context so delete the job
|
|
|
|
+ */
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR, "LoadAllJobs: Missing or bad security-context attribute in control file \"%s\"!",
|
|
|
|
+ jobfile);
|
|
|
|
+ ippDelete(job->attrs);
|
|
|
|
+ job->attrs = NULL;
|
|
|
|
+ unlink(jobfile);
|
|
|
|
+ return;
|
|
|
|
+ }
|
2006-10-03 10:57:31 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
2007-03-02 14:13:58 +00:00
|
|
|
+
|
|
|
|
job->sheets = ippFindAttribute(job->attrs, "job-media-sheets-completed",
|
|
|
|
IPP_TAG_INTEGER);
|
|
|
|
job->job_sheets = ippFindAttribute(job->attrs, "job-sheets", IPP_TAG_NAME);
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -1406,6 +1434,13 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
{
|
|
|
|
char filename[1024]; /* Job control filename */
|
|
|
|
cups_file_t *fp; /* Job file */
|
2006-07-21 12:00:05 +00:00
|
|
|
+#ifdef WITH_LSPP
|
2007-03-02 14:13:58 +00:00
|
|
|
+ security_context_t spoolcon; /* context of the job control file */
|
|
|
|
+ context_t jobcon; /* contex_t container for job->scon */
|
|
|
|
+ context_t tmpcon; /* Temp context to swap the level */
|
|
|
|
+ char *jobclearance; /* SELinux low end clearance */
|
|
|
|
+ char *jobrange; /* SELinux sensitivity range */
|
2006-07-21 12:00:05 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
|
|
|
|
|
2007-03-02 14:13:58 +00:00
|
|
|
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdSaveJob(job=%p(%d)): job->attrs=%p",
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -1424,6 +1459,72 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
fchmod(cupsFileNumber(fp), 0600);
|
|
|
|
fchown(cupsFileNumber(fp), RunUser, Group);
|
2006-07-21 12:00:05 +00:00
|
|
|
|
|
|
|
+#ifdef WITH_LSPP
|
2007-03-02 14:13:58 +00:00
|
|
|
+ if (job->scon && strncmp(job->scon, UNKNOWN_SL, strlen(UNKNOWN_SL)) != 0)
|
2006-11-22 11:59:57 +00:00
|
|
|
+ {
|
2007-03-02 14:13:58 +00:00
|
|
|
+ if (getfilecon(filename, &spoolcon) == -1)
|
2006-08-02 09:37:31 +00:00
|
|
|
+ {
|
2007-03-02 14:13:58 +00:00
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR,
|
|
|
|
+ "Unable to get context of job control file \"%s\" - %s.",
|
|
|
|
+ filename, strerror(errno));
|
|
|
|
+ return;
|
2006-08-02 09:37:31 +00:00
|
|
|
+ }
|
2007-03-02 14:13:58 +00:00
|
|
|
+ jobcon = context_new(job->scon);
|
|
|
|
+ tmpcon = context_new(spoolcon);
|
|
|
|
+ freecon(spoolcon);
|
|
|
|
+ if (!jobcon || !tmpcon)
|
|
|
|
+ {
|
|
|
|
+ if (jobcon)
|
|
|
|
+ context_free(jobcon);
|
|
|
|
+ if (tmpcon)
|
|
|
|
+ context_free(tmpcon);
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to get SELinux contexts");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ jobrange = strdup(context_range_get(jobcon));
|
|
|
|
+ if ((jobclearance = strtok(jobrange, "-")) != NULL)
|
|
|
|
+ {
|
|
|
|
+ if (context_range_set(tmpcon, jobclearance) == -1)
|
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR,
|
|
|
|
+ "Unable to set the range for job control file \"%s\" - %s.",
|
|
|
|
+ filename, strerror(errno));
|
|
|
|
+ free(jobrange);
|
|
|
|
+ context_free(tmpcon);
|
|
|
|
+ context_free(jobcon);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (context_range_set(tmpcon, (context_range_get(jobcon))) == -1)
|
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR,
|
|
|
|
+ "Unable to set the range for job control file \"%s\" - %s.",
|
|
|
|
+ filename, strerror(errno));
|
|
|
|
+ free(jobrange);
|
|
|
|
+ context_free(tmpcon);
|
|
|
|
+ context_free(jobcon);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ free(jobrange);
|
|
|
|
+ if (setfilecon(filename, context_str(tmpcon)) == -1)
|
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR,
|
|
|
|
+ "Unable to set context of job control file \"%s\" - %s.",
|
|
|
|
+ filename, strerror(errno));
|
|
|
|
+ context_free(tmpcon);
|
|
|
|
+ context_free(jobcon);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdSaveJob(job=%p): new spool file context=%s",
|
|
|
|
+ job, context_str(tmpcon));
|
|
|
|
+ context_free(tmpcon);
|
|
|
|
+ context_free(jobcon);
|
2006-11-22 11:59:57 +00:00
|
|
|
+ }
|
2006-08-02 09:37:31 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
+
|
2007-03-02 14:13:58 +00:00
|
|
|
job->attrs->state = IPP_IDLE;
|
2006-11-22 11:59:57 +00:00
|
|
|
|
2007-03-02 14:13:58 +00:00
|
|
|
if (ippWriteIO(fp, (ipp_iocb_t)cupsFileWrite, 1, NULL,
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -2422,6 +2523,21 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
/* RIP_MAX_CACHE env variable */
|
|
|
|
static char *options = NULL;/* Full list of options */
|
|
|
|
static int optlength = 0; /* Length of option buffer */
|
2006-11-22 11:59:57 +00:00
|
|
|
+#ifdef WITH_LSPP
|
2007-03-02 14:13:58 +00:00
|
|
|
+ const char *mls_label = NULL; /* SL to put in classification env var */
|
|
|
|
+ char *label_template = NULL; /* SL to put in classification env var */
|
|
|
|
+ char *audit_message = NULL; /* Audit message string */
|
|
|
|
+ char *printerfile = NULL; /* Device file pointed to by the printer */
|
|
|
|
+ context_t jobcon; /* SELinux context of the job */
|
|
|
|
+ security_id_t clisid; /* SELinux SID for the client */
|
|
|
|
+ security_id_t psid; /* SELinux SID for the printer */
|
|
|
|
+ context_t printercon; /* Printer's context string */
|
|
|
|
+ struct stat printerstat; /* Printer's stat buffer */
|
|
|
|
+ security_context_t devcon; /* Printer's SELinux context */
|
|
|
|
+ struct avc_entry_ref avcref; /* Pointer to the access vector cache */
|
|
|
|
+ security_class_t tclass; /* Object class for the SELinux check */
|
|
|
|
+ access_vector_t avr; /* Access method being requested */
|
2006-11-22 11:59:57 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
|
|
|
|
|
2007-07-18 11:55:01 +00:00
|
|
|
cupsdLogMessage(CUPSD_LOG_DEBUG2, "[Job %d] start_job: file = %d/%d",
|
|
|
|
@@ -2673,6 +2789,106 @@
|
|
|
|
fcntl(job->side_pipes[1], F_GETFL) | O_NONBLOCK);
|
|
|
|
}
|
2006-08-02 09:37:31 +00:00
|
|
|
|
|
|
|
+#ifdef WITH_LSPP
|
2007-03-02 14:13:58 +00:00
|
|
|
+ if (is_lspp_config())
|
|
|
|
+ {
|
|
|
|
+ /*
|
|
|
|
+ * Perform an access check before printing, but only if the printer starts with /dev/
|
|
|
|
+ */
|
|
|
|
+ printerfile = strstr(printer->device_uri, "/dev/");
|
|
|
|
+ if (printerfile == NULL && (strncmp(printer->device_uri, "file:/", 6) == 0))
|
|
|
|
+ printerfile = strdup(printer->device_uri + strlen("file:/"));
|
|
|
|
+
|
|
|
|
+ if (printerfile != NULL)
|
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
|
|
|
|
+ "StartJob: Attempting to check access on printer device %s", printerfile);
|
|
|
|
+ if (lstat(printerfile, &printerstat) < 0)
|
|
|
|
+ {
|
|
|
|
+ if (errno != ENOENT)
|
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR, "StartJob: Unable to stat the printer");
|
|
|
|
+ cupsdCancelJob(job, 0, IPP_JOB_ABORTED);
|
|
|
|
+ return ;
|
|
|
|
+ }
|
|
|
|
+ /*
|
|
|
|
+ * The printer does not exist, so for now assume it's a FileDevice
|
|
|
|
+ */
|
|
|
|
+ tclass = SECCLASS_FILE;
|
|
|
|
+ avr = FILE__WRITE;
|
|
|
|
+ }
|
|
|
|
+ else if (S_ISCHR(printerstat.st_mode))
|
|
|
|
+ {
|
|
|
|
+ tclass = SECCLASS_CHR_FILE;
|
|
|
|
+ avr = CHR_FILE__WRITE;
|
|
|
|
+ }
|
|
|
|
+ else if (S_ISREG(printerstat.st_mode))
|
|
|
|
+ {
|
|
|
|
+ tclass = SECCLASS_FILE;
|
|
|
|
+ avr = FILE__WRITE;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR,
|
|
|
|
+ "StartJob: Printer is not a character device or regular file");
|
|
|
|
+ cupsdCancelJob(job, 0, IPP_JOB_ABORTED);
|
|
|
|
+ return ;
|
|
|
|
+ }
|
|
|
|
+ avc_init("cupsd_dequeue_", NULL, NULL, NULL, NULL);
|
|
|
|
+ avc_entry_ref_init(&avcref);
|
|
|
|
+ if (avc_context_to_sid(job->scon, &clisid) != 0)
|
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR,
|
|
|
|
+ "StartJob: Unable to determine the SELinux sid for the job");
|
|
|
|
+ cupsdCancelJob(job, 0, IPP_JOB_ABORTED);
|
|
|
|
+ return ;
|
|
|
|
+ }
|
|
|
|
+ if (getfilecon(printerfile, &devcon) == -1)
|
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR, "StartJob: Unable to get the SELinux context of %s",
|
|
|
|
+ printerfile);
|
|
|
|
+ cupsdCancelJob(job, 0, IPP_JOB_ABORTED);
|
|
|
|
+ return ;
|
|
|
|
+ }
|
|
|
|
+ printercon = context_new(devcon);
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_DEBUG, "StartJob: printer context %s client context %s",
|
|
|
|
+ context_str(printercon), job->scon);
|
|
|
|
+ context_free(printercon);
|
|
|
|
+
|
|
|
|
+ if (avc_context_to_sid(devcon, &psid) != 0)
|
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR,
|
|
|
|
+ "StartJob: Unable to determine the SELinux sid for the printer");
|
|
|
|
+ freecon(devcon);
|
|
|
|
+ cupsdCancelJob(job, 0, IPP_JOB_ABORTED);
|
|
|
|
+ return ;
|
|
|
|
+ }
|
|
|
|
+ freecon(devcon);
|
|
|
|
+
|
|
|
|
+ if (avc_has_perm(clisid, psid, tclass, avr, &avcref, NULL) != 0)
|
|
|
|
+ {
|
|
|
|
+ /*
|
|
|
|
+ * The access check failed, so cancel the job and send an audit message
|
|
|
|
+ */
|
|
|
|
+ if (AuditLog != -1)
|
|
|
|
+ {
|
|
|
|
+ audit_message = NULL;
|
|
|
|
+ cupsdSetStringf(&audit_message, "job=%d auid=%u acct=%s obj=%s canceled"
|
|
|
|
+ " unable to access printer=%s", job->id,
|
|
|
|
+ job->auid, (job->username)?job->username:"?", job->scon, printer->name);
|
|
|
|
+ audit_log_user_message(AuditLog, AUDIT_USER_LABELED_EXPORT, audit_message,
|
|
|
|
+ ServerName, NULL, NULL, 0);
|
|
|
|
+ free(audit_message);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ cupsdCancelJob(job, 0, IPP_JOB_ABORTED);
|
|
|
|
+
|
|
|
|
+ return ;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
2006-08-02 09:37:31 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
2006-11-22 11:59:57 +00:00
|
|
|
+
|
2007-03-02 14:13:58 +00:00
|
|
|
/*
|
2007-07-18 11:55:01 +00:00
|
|
|
* Determine if we are printing a banner page or not...
|
|
|
|
*/
|
|
|
|
@@ -2813,6 +3029,18 @@
|
|
|
|
banner_page)
|
2007-03-29 10:30:29 +00:00
|
|
|
continue;
|
2006-08-02 09:37:31 +00:00
|
|
|
|
|
|
|
+#ifdef WITH_LSPP
|
2007-03-29 10:30:29 +00:00
|
|
|
+ /*
|
|
|
|
+ * In LSPP mode refuse to honor the page-label
|
|
|
|
+ */
|
|
|
|
+ if (is_lspp_config() &&
|
|
|
|
+ !strcmp(attr->name, "page-label"))
|
|
|
|
+ {
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_DEBUG, "Ignoring page-label option due to LSPP mode");
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
+
|
|
|
|
/*
|
|
|
|
* Otherwise add them to the list...
|
|
|
|
*/
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -3029,6 +3257,67 @@
|
2007-03-29 10:30:29 +00:00
|
|
|
envp[envc ++] = final_content_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+ if (is_lspp_config())
|
|
|
|
+ {
|
|
|
|
+ if (!job->scon || strncmp(job->scon, UNKNOWN_SL, strlen(UNKNOWN_SL)) == 0)
|
2006-11-22 11:59:57 +00:00
|
|
|
+ {
|
2007-03-29 10:30:29 +00:00
|
|
|
+ if (AuditLog != -1)
|
2006-08-21 16:26:28 +00:00
|
|
|
+ {
|
2007-03-29 10:30:29 +00:00
|
|
|
+ audit_message = NULL;
|
|
|
|
+ cupsdSetStringf(&audit_message, "job=%d auid=%u acct=%s printer=%s title=%s",
|
|
|
|
+ job->id, job->auid, job->username, printer->name, title);
|
|
|
|
+ audit_log_user_message(AuditLog, AUDIT_USER_UNLABELED_EXPORT, audit_message,
|
|
|
|
+ ServerName, NULL, NULL, 1);
|
|
|
|
+ free(audit_message);
|
2007-03-02 14:13:58 +00:00
|
|
|
+ }
|
2007-03-29 10:30:29 +00:00
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ jobcon = context_new(job->scon);
|
|
|
|
+
|
|
|
|
+ if ((attr = ippFindAttribute(job->attrs, "job-sheets", IPP_TAG_NAME)) == NULL)
|
|
|
|
+ label_template = strdup(Classification);
|
|
|
|
+ else if (attr->num_values > 1 &&
|
|
|
|
+ strcmp(attr->values[1].string.text, "none") != 0)
|
|
|
|
+ label_template = strdup(attr->values[1].string.text);
|
|
|
|
+ else
|
|
|
|
+ label_template = strdup(attr->values[0].string.text);
|
|
|
|
+
|
|
|
|
+ if (strcasecmp(label_template, MLS_CONFIG) == 0)
|
|
|
|
+ mls_label = context_range_get(jobcon);
|
|
|
|
+ else if (strcasecmp(label_template, TE_CONFIG) == 0)
|
|
|
|
+ mls_label = context_type_get(jobcon);
|
|
|
|
+ else if (strcasecmp(label_template, SELINUX_CONFIG) == 0)
|
|
|
|
+ mls_label = context_str(jobcon);
|
|
|
|
+ else
|
|
|
|
+ mls_label = label_template;
|
|
|
|
+
|
|
|
|
+ if (mls_label && (PerPageLabels || banner_page))
|
2007-03-02 14:13:58 +00:00
|
|
|
+ {
|
2007-03-29 10:30:29 +00:00
|
|
|
+ snprintf(classification, sizeof(classification), "CLASSIFICATION=LSPP:%s", mls_label);
|
|
|
|
+ envp[envc ++] = classification;
|
|
|
|
+ }
|
2007-03-02 14:13:58 +00:00
|
|
|
+
|
2007-03-29 10:30:29 +00:00
|
|
|
+ if ((AuditLog != -1) && !banner_page)
|
|
|
|
+ {
|
|
|
|
+ audit_message = NULL;
|
|
|
|
+ cupsdSetStringf(&audit_message, "job=%d auid=%u acct=%s printer=%s title=%s"
|
|
|
|
+ " obj=%s label=%s", job->id, job->auid, job->username,
|
|
|
|
+ printer->name, title, job->scon, mls_label?mls_label:"none");
|
|
|
|
+ audit_log_user_message(AuditLog, AUDIT_USER_LABELED_EXPORT, audit_message,
|
|
|
|
+ ServerName, NULL, NULL, 1);
|
|
|
|
+ free(audit_message);
|
2006-08-21 16:26:28 +00:00
|
|
|
+ }
|
2007-03-29 10:30:29 +00:00
|
|
|
+ context_free(jobcon);
|
|
|
|
+ free(label_template);
|
2006-08-02 09:37:31 +00:00
|
|
|
+ }
|
2007-03-29 10:30:29 +00:00
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ /*
|
|
|
|
+ * Fall through to the non-LSPP behavior
|
|
|
|
+ */
|
2006-08-02 09:37:31 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
2007-03-29 10:30:29 +00:00
|
|
|
if (Classification && !banner_page)
|
|
|
|
{
|
|
|
|
if ((attr = ippFindAttribute(job->attrs, "job-sheets",
|
2007-07-18 11:55:01 +00:00
|
|
|
--- cups-1.3b1/scheduler/printers.c.lspp 2007-07-18 11:40:59.000000000 +0100
|
|
|
|
+++ cups-1.3b1/scheduler/printers.c 2007-07-18 11:40:59.000000000 +0100
|
|
|
|
@@ -50,6 +50,8 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
* printing desktop tools.
|
|
|
|
*/
|
|
|
|
|
|
|
|
+/* (c) Copyright 2005-2006 Hewlett-Packard Development Company, L.P. */
|
2006-08-02 09:37:31 +00:00
|
|
|
+
|
2007-03-02 14:13:58 +00:00
|
|
|
/*
|
|
|
|
* Include necessary headers...
|
|
|
|
*/
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -73,6 +75,10 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
static void write_irix_state(cupsd_printer_t *p);
|
|
|
|
#endif /* __sgi */
|
|
|
|
|
2006-08-02 09:37:31 +00:00
|
|
|
+#ifdef WITH_LSPP
|
2007-03-02 14:13:58 +00:00
|
|
|
+# include <libaudit.h>
|
|
|
|
+# include <selinux/context.h>
|
2006-08-02 09:37:31 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
2006-07-21 12:00:05 +00:00
|
|
|
|
2007-03-02 14:13:58 +00:00
|
|
|
/*
|
|
|
|
* 'cupsdAddPrinter()' - Add a printer to the system.
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -1700,6 +1706,13 @@
|
|
|
|
{ /* No authentication */
|
|
|
|
"none"
|
2007-03-02 14:13:58 +00:00
|
|
|
};
|
2006-07-21 12:00:05 +00:00
|
|
|
+#ifdef WITH_LSPP
|
2007-03-02 14:13:58 +00:00
|
|
|
+ char *audit_message; /* Audit message string */
|
|
|
|
+ char *printerfile; /* Path to a local printer dev */
|
|
|
|
+ char *rangestr; /* Printer's range if its available */
|
|
|
|
+ security_context_t devcon; /* Printer SELinux context */
|
|
|
|
+ context_t printercon; /* context_t for the printer */
|
2006-07-21 12:00:05 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
|
|
|
|
|
2007-03-02 14:13:58 +00:00
|
|
|
DEBUG_printf(("cupsdSetPrinterAttrs: entering name = %s, type = %x\n", p->name,
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -1843,6 +1856,44 @@
|
2007-03-02 14:13:58 +00:00
|
|
|
attr->values[1].string.text = _cupsStrAlloc(Classification ?
|
|
|
|
Classification : p->job_sheets[1]);
|
|
|
|
}
|
2006-07-21 12:00:05 +00:00
|
|
|
+#ifdef WITH_LSPP
|
2007-03-02 14:13:58 +00:00
|
|
|
+ if (AuditLog != -1)
|
|
|
|
+ {
|
|
|
|
+ char uri[HTTP_MAX_URI];
|
|
|
|
+ audit_message = NULL;
|
|
|
|
+ rangestr = NULL;
|
|
|
|
+ printercon = 0;
|
|
|
|
+ printerfile = strstr(p->device_uri, "/dev/");
|
|
|
|
+ if (printerfile == NULL && (strncmp(p->device_uri, "file:/", 6) == 0))
|
|
|
|
+ printerfile = strdup(p->device_uri + strlen("file:/"));
|
2006-11-22 11:59:57 +00:00
|
|
|
+
|
2007-03-02 14:13:58 +00:00
|
|
|
+ if (printerfile != NULL)
|
|
|
|
+ {
|
|
|
|
+ if (getfilecon(printerfile, &devcon) == -1)
|
|
|
|
+ cupsdLogMessage(CUPSD_LOG_ERROR, "cupsdSetPrinterAttrs: Unable to get printer context");
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ printercon = context_new(devcon);
|
|
|
|
+ freecon(devcon);
|
|
|
|
+ }
|
|
|
|
+ }
|
2006-11-22 11:59:57 +00:00
|
|
|
+
|
2007-03-02 14:13:58 +00:00
|
|
|
+ if (printercon && context_range_get(printercon))
|
|
|
|
+ rangestr = strdup(context_range_get(printercon));
|
|
|
|
+ else
|
|
|
|
+ rangestr = strdup("unknown");
|
2006-11-22 11:59:57 +00:00
|
|
|
+
|
2007-03-02 14:13:58 +00:00
|
|
|
+ cupsdSanitizeURI(p->device_uri, uri, sizeof(uri));
|
|
|
|
+ cupsdSetStringf(&audit_message, "printer=%s uri=%s banners=%s,%s range=%s",
|
|
|
|
+ p->name, uri, p->job_sheets[0], p->job_sheets[1], rangestr);
|
|
|
|
+ audit_log_user_message(AuditLog, AUDIT_LABEL_LEVEL_CHANGE, audit_message,
|
|
|
|
+ ServerName, NULL, NULL, 1);
|
|
|
|
+ if (printercon)
|
|
|
|
+ context_free(printercon);
|
|
|
|
+ free(rangestr);
|
|
|
|
+ free(audit_message);
|
|
|
|
+ }
|
2006-08-21 16:26:28 +00:00
|
|
|
+#endif /* WITH_LSPP */
|
2007-03-02 14:13:58 +00:00
|
|
|
}
|
|
|
|
|
2007-07-18 11:55:01 +00:00
|
|
|
p->raw = 0;
|
|
|
|
--- cups-1.3b1/scheduler/job.h.lspp 2007-07-12 23:58:17.000000000 +0100
|
|
|
|
+++ cups-1.3b1/scheduler/job.h 2007-07-18 12:17:36.000000000 +0100
|
|
|
|
@@ -13,6 +13,13 @@
|
|
|
|
* file is missing or damaged, see the license at "http://www.cups.org/".
|
2006-11-22 11:59:57 +00:00
|
|
|
*/
|
2006-08-21 16:26:28 +00:00
|
|
|
|
2006-11-22 11:59:57 +00:00
|
|
|
+/* Copyright (C) 2005 Trusted Computer Solutions, Inc. */
|
|
|
|
+/* (c) Copyright 2005-2006 Hewlett-Packard Development Company, L.P. */
|
|
|
|
+
|
2007-03-02 14:13:58 +00:00
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+#include <selinux/selinux.h>
|
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
+
|
2006-11-22 11:59:57 +00:00
|
|
|
/*
|
2007-03-02 14:13:58 +00:00
|
|
|
* Job request structure...
|
2006-11-22 11:59:57 +00:00
|
|
|
*/
|
2007-07-18 11:55:01 +00:00
|
|
|
@@ -59,6 +66,10 @@
|
|
|
|
#ifdef HAVE_GSSAPI
|
|
|
|
char *ccname; /* KRB5CCNAME environment variable */
|
|
|
|
#endif /* HAVE_GSSAPI */
|
2007-03-02 14:13:58 +00:00
|
|
|
+#ifdef WITH_LSPP
|
|
|
|
+ security_context_t scon; /* Security context of job */
|
|
|
|
+ uid_t auid; /* Audit loginuid for this job */
|
|
|
|
+#endif /* WITH_LSPP */
|
|
|
|
} cupsd_job_t;
|
|
|
|
|
|
|
|
|
2007-07-18 11:55:01 +00:00
|
|
|
--- cups-1.3b1/Makedefs.in.lspp 2007-07-11 22:46:42.000000000 +0100
|
|
|
|
+++ cups-1.3b1/Makedefs.in 2007-07-18 11:40:59.000000000 +0100
|
|
|
|
@@ -133,7 +133,7 @@
|
|
|
|
LIBCUPSORDER = @LIBCUPSORDER@
|
|
|
|
LINKCUPS = @LINKCUPS@ $(SSLLIBS)
|
|
|
|
LINKCUPSIMAGE = @LINKCUPSIMAGE@
|
|
|
|
-LIBS = $(LINKCUPS) $(COMMONLIBS)
|
|
|
|
+LIBS = $(LINKCUPS) $(COMMONLIBS) @LIBAUDIT@ @LIBSELINUX@
|
|
|
|
OPTIM = @OPTIM@
|
|
|
|
OPTIONS =
|
|
|
|
PAMLIBS = @PAMLIBS@
|
|
|
|
@@ -240,7 +240,7 @@
|
|
|
|
# Rules...
|
|
|
|
#
|
2007-03-29 10:30:29 +00:00
|
|
|
|
2007-07-18 11:55:01 +00:00
|
|
|
-.SILENT:
|
2007-03-29 10:30:29 +00:00
|
|
|
+
|
2007-07-18 11:55:01 +00:00
|
|
|
.SUFFIXES: .1 .1.gz .1m .1m.gz .5 .5.gz .7 .7.gz .8 .8.gz .a .c .cxx .h .man .o .32.o .64.o .gz
|
2007-03-29 10:30:29 +00:00
|
|
|
|
2007-07-18 11:55:01 +00:00
|
|
|
.c.o:
|
|
|
|
--- cups-1.3b1/config.h.in.lspp 2007-07-11 22:46:42.000000000 +0100
|
|
|
|
+++ cups-1.3b1/config.h.in 2007-07-18 11:40:59.000000000 +0100
|
|
|
|
@@ -529,6 +529,13 @@
|
|
|
|
#undef HAVE_SYS_UCRED_H
|
2007-03-29 10:30:29 +00:00
|
|
|
|
|
|
|
|
2007-07-18 11:55:01 +00:00
|
|
|
+/*
|
|
|
|
+ * Are we trying to meet LSPP requirements?
|
|
|
|
+ */
|
2007-03-29 10:30:29 +00:00
|
|
|
+
|
2007-07-18 11:55:01 +00:00
|
|
|
+#undef WITH_LSPP
|
2007-03-29 10:30:29 +00:00
|
|
|
+
|
|
|
|
+
|
2007-07-18 11:55:01 +00:00
|
|
|
#endif /* !_CUPS_CONFIG_H_ */
|
2007-03-29 10:30:29 +00:00
|
|
|
|
|
|
|
/*
|
2007-07-18 11:55:01 +00:00
|
|
|
--- cups-1.3b1/configure.in.lspp 2007-07-11 22:46:42.000000000 +0100
|
|
|
|
+++ cups-1.3b1/configure.in 2007-07-18 11:40:59.000000000 +0100
|
|
|
|
@@ -42,6 +42,8 @@
|
|
|
|
sinclude(config-scripts/cups-pdf.m4)
|
|
|
|
sinclude(config-scripts/cups-scripting.m4)
|
|
|
|
|
|
|
|
+sinclude(config-scripts/cups-lspp.m4)
|
|
|
|
+
|
|
|
|
INSTALL_LANGUAGES=""
|
|
|
|
UNINSTALL_LANGUAGES=""
|
|
|
|
LANGFILES=""
|