9ad376b
--- cups-1.2.2-8/config.h.in	2006-08-10 11:42:42.000000000 -0400
9ad376b
+++ cups-1.2.2/config.h.in	2006-08-07 06:19:33.000000000 -0400
5dd9863
@@ -443,6 +443,13 @@
5dd9863
 #undef HAVE_APPLETALK_AT_PROTO_H
5dd9863
 
5dd9863
 
5dd9863
+/*
5dd9863
+ * Are we trying to meet LSPP requirements?
5dd9863
+ */
75d0e82
+
5dd9863
+#undef WITH_LSPP
75d0e82
+
5dd9863
+
5dd9863
 #endif /* !_CUPS_CONFIG_H_ */
5dd9863
 
5dd9863
 /*
9ad376b
--- cups-1.2.2-8/configure.in	2006-08-10 11:43:02.000000000 -0400
9ad376b
+++ cups-1.2.2/configure.in	2006-08-07 06:19:33.000000000 -0400
75d0e82
@@ -47,6 +47,8 @@
75d0e82
 sinclude(config-scripts/cups-pdf.m4)
75d0e82
 sinclude(config-scripts/cups-scripting.m4)
75d0e82
 
75d0e82
+sinclude(config-scripts/cups-lspp.m4)
75d0e82
+
75d0e82
 INSTALL_LANGUAGES=""
75d0e82
 UNINSTALL_LANGUAGES=""
75d0e82
 LANGFILES=""
9ad376b
--- cups-1.2.2-8/config-scripts/cups-lspp.m4	1969-12-31 19:00:00.000000000 -0500
9ad376b
+++ cups-1.2.2/config-scripts/cups-lspp.m4	2006-08-07 06:19:33.000000000 -0400
9ad376b
@@ -0,0 +1,36 @@
9ad376b
+dnl
9ad376b
+dnl   LSPP code for the Common UNIX Printing System (CUPS).
9ad376b
+dnl
9ad376b
+dnl   Copyright 2005-2006 by Hewlett-Packard Development Company, L.P.
9ad376b
+dnl
9ad376b
+dnl   This program is free software; you can redistribute it and/or modify
9ad376b
+dnl   it under the terms of the GNU General Public License as published by
9ad376b
+dnl   the Free Software Foundation; version 2.
9ad376b
+dnl
9ad376b
+dnl   This program is distributed in the hope that it will be useful, but
9ad376b
+dnl   WITHOUT ANY WARRANTY; without even the implied warranty of
9ad376b
+dnl   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9ad376b
+dnl   General Public License for more details.
9ad376b
+dnl
9ad376b
+dnl   You should have received a copy of the GNU General Public License
9ad376b
+dnl   along with this program; if not, write to the Free Software Foundation,
9ad376b
+dnl   Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301 USA
9ad376b
+dnl
9ad376b
+
9ad376b
+dnl Are we trying to meet LSPP requirements
9ad376b
+AC_ARG_ENABLE(lspp, [  --enable-lspp           turn on auditing and label support, default=no])
9ad376b
+
9ad376b
+if test x"$enable_lspp" != xno; then
9ad376b
+    case "$uname" in
9ad376b
+        Linux)
9ad376b
+            AC_CHECK_LIB(audit,audit_log_user_message, [LIBAUDIT="-laudit" AC_SUBST(LIBAUDIT)])
9ad376b
+            AC_CHECK_HEADER(libaudit.h)
9ad376b
+            AC_CHECK_LIB(selinux,getpeercon, [LIBSELINUX="-lselinux" AC_SUBST(LIBSELINUX)])
9ad376b
+            AC_CHECK_HEADER(selinux/selinux.h)
9ad376b
+            AC_DEFINE(WITH_LSPP)
9ad376b
+            ;;
9ad376b
+        *)
9ad376b
+            # All others
9ad376b
+            ;;
9ad376b
+    esac
9ad376b
+fi
9ad376b
--- cups-1.2.2-8/cups/cups.h	2006-08-10 11:43:02.000000000 -0400
9ad376b
+++ cups-1.2.2/cups/cups.h	2006-08-07 06:19:33.000000000 -0400
5dd9863
@@ -24,6 +24,8 @@
5dd9863
  *   This file is subject to the Apple OS-Developed Software exception.
5dd9863
  */
5dd9863
 
5dd9863
+/* Copyright (C) 2005 Trusted Computer Solutions, Inc. */
5dd9863
+
5dd9863
 #ifndef _CUPS_CUPS_H_
5dd9863
 #  define _CUPS_CUPS_H_
5dd9863
 
5dd9863
@@ -68,6 +70,12 @@
5dd9863
 #  define CUPS_DATE_ANY		-1
5dd9863
 
5dd9863
 
5dd9863
+# ifdef WITH_LSPP
5dd9863
+# define MLS_CONFIG "mls"
5dd9863
+# define TE_CONFIG "te"
5dd9863
+# define SELINUX_CONFIG "SELinux"
5dd9863
+# define UNKNOWN_SL "UNKNOWN SL"
5dd9863
+# endif /* WITH_LSPP */
5dd9863
 /*
5dd9863
  * Types and structures...
5dd9863
  */
9ad376b
--- cups-1.2.2-8/data/Makefile	2006-08-10 11:43:02.000000000 -0400
9ad376b
+++ cups-1.2.2/data/Makefile	2006-08-07 06:19:33.000000000 -0400
5dd9863
@@ -34,7 +34,10 @@
5dd9863
 		secret \
5dd9863
 		standard \
5dd9863
 		topsecret \
5dd9863
-		unclassified
5dd9863
+		unclassified \
5dd9863
+		selinux \
5dd9863
+		mls \
5dd9863
+		te
5dd9863
 
5dd9863
 CHARMAPS =	\
5dd9863
 		euc-cn.txt \
9ad376b
--- cups-1.2.2-8/data/mls	1969-12-31 19:00:00.000000000 -0500
9ad376b
+++ cups-1.2.2/data/mls	2006-08-07 06:19:33.000000000 -0400
75d0e82
@@ -0,0 +1,277 @@
75d0e82
+%!PS-Adobe-3.0
75d0e82
+%%BoundingBox: 0 0 612 792
75d0e82
+%%Pages: 1
75d0e82
+%%LanguageLevel: 1
75d0e82
+%%DocumentData: Clean7Bit
75d0e82
+%%DocumentSuppliedResources: procset bannerprint/1.0
75d0e82
+%%DocumentNeededResources: font Helvetica Helvetica-Bold Times-Roman
75d0e82
+%%Creator: Michael Sweet, Easy Software Products
75d0e82
+%%CreationDate: May 10, 2000
75d0e82
+%%Title: Test Page
75d0e82
+%%EndComments
75d0e82
+%%BeginProlog
75d0e82
+%%BeginResource procset bannerprint 1.1 0
75d0e82
+%
75d0e82
+%   PostScript banner page for the Common UNIX Printing System ("CUPS").
75d0e82
+%
75d0e82
+%   Copyright 1993-2005 by Easy Software Products
75d0e82
+%
75d0e82
+%   These coded instructions, statements, and computer programs are the
75d0e82
+%   property of Easy Software Products and are protected by Federal
75d0e82
+%   copyright law.  Distribution and use rights are outlined in the file
75d0e82
+%   "LICENSE.txt" which should have been included with this file.  If this
75d0e82
+%   file is missing or damaged please contact Easy Software Products
75d0e82
+%   at:
75d0e82
+%
75d0e82
+%       Attn: CUPS Licensing Information
75d0e82
+%       Easy Software Products
75d0e82
+%       44141 Airport View Drive, Suite 204
75d0e82
+%       Hollywood, Maryland 20636 USA
75d0e82
+%
75d0e82
+%       Voice: (301) 373-9600
75d0e82
+%       EMail: cups-info@cups.org
75d0e82
+%         WWW: http://www.cups.org
75d0e82
+%
75d0e82
+/CENTER {			% Draw centered text
75d0e82
+				% (name) CENTER -
75d0e82
+  dup stringwidth pop		% Get the width of the string
75d0e82
+  0.5 mul neg 0 rmoveto		% Shift left 1/2 of the distance
75d0e82
+  show				% Show the string
75d0e82
+} bind def
75d0e82
+/RIGHT {			% Draw right-justified text
75d0e82
+				% (name) RIGHT -
75d0e82
+  dup stringwidth pop		% Get the width of the string
75d0e82
+  neg 0 rmoveto			% Shift left the entire distance
75d0e82
+  show				% Show the string
75d0e82
+} bind def
75d0e82
+/NUMBER {			% Draw a number
75d0e82
+				% power n NUMBER -
75d0e82
+  1 index 1 eq {		% power == 1?
75d0e82
+    round cvi exch pop		% Convert "n" to integer
75d0e82
+  } {
75d0e82
+    1 index mul round exch div	% Truncate extra decimal places
75d0e82
+  } ifelse
75d0e82
+  100 string cvs show		% Convert to a string and show it...
75d0e82
+} bind def
75d0e82
+/CUPSLOGO {			% Draw the CUPS logo
75d0e82
+				% height CUPSLOGO
75d0e82
+  % Start with a big C...
75d0e82
+  /Helvetica findfont 1 index scalefont setfont
75d0e82
+  0 setgray
75d0e82
+  0 0 moveto
75d0e82
+  (C) show
75d0e82
+
75d0e82
+  % Then "UNIX Printing System" much smaller...
75d0e82
+  /Helvetica-Bold findfont 1 index 9 div scalefont setfont
75d0e82
+  0.25 mul
75d0e82
+  dup dup 2.0 mul moveto
75d0e82
+  (UNIX) show
75d0e82
+  dup dup 1.6 mul moveto
75d0e82
+  (Printing) show
75d0e82
+  dup 1.2 mul moveto
75d0e82
+  (System) show
75d0e82
+} bind def
75d0e82
+/ESPLOGO {			% Draw the ESP logo
75d0e82
+				% height ESPLOGO
75d0e82
+  % Compute the size of the logo...
75d0e82
+  0 0
75d0e82
+  2 index 1.5 mul 3 index
75d0e82
+
75d0e82
+  % Do the "metallic" fill from 10% black to 40% black...
75d0e82
+  1 -0.001 0 {
75d0e82
+    dup			% loopval
75d0e82
+    -0.15 mul		% loopval * -0.15
75d0e82
+    0.9 add		% 0.9 - loopval * 0.15
75d0e82
+    setgray		% set gray shade
75d0e82
+
75d0e82
+    0			% x
75d0e82
+    1 index neg		% loopval
75d0e82
+    1 add		% 1 - loopval
75d0e82
+    3 index		% height
75d0e82
+    mul			% height * (1 - loopval)
75d0e82
+    moveto		% starting point
75d0e82
+
75d0e82
+    dup			% loopval
75d0e82
+    3 index		% width
75d0e82
+    mul			% loopval * width
75d0e82
+    2 index		% height
75d0e82
+    lineto		% Next point
75d0e82
+
75d0e82
+    0			% x
75d0e82
+    2 index		% height
75d0e82
+    lineto		% Next point
75d0e82
+
75d0e82
+    closepath
75d0e82
+    fill
75d0e82
+
75d0e82
+    dup			% loopval
75d0e82
+    0.15 mul		% loopval * 0.15
75d0e82
+    0.6 add		% 0.6 + loopval * 0.15
75d0e82
+    setgray
75d0e82
+
75d0e82
+    dup			% loopval
75d0e82
+    neg 1 add		% 1 - loopval
75d0e82
+    3 index		% width
75d0e82
+    mul			% (1 - loopval) * width
75d0e82
+    0			% y
75d0e82
+    moveto		% Starting point
75d0e82
+
75d0e82
+    2 index		% width
75d0e82
+    exch		% loopval
75d0e82
+    2 index		% height
75d0e82
+    mul			% loopval * height
75d0e82
+    lineto		% Next point
75d0e82
+
75d0e82
+    1 index		% width
75d0e82
+    0			% y
75d0e82
+    lineto		% Next point
75d0e82
+
75d0e82
+    closepath
75d0e82
+    fill
75d0e82
+  } for
75d0e82
+
75d0e82
+  0 setgray rectstroke
75d0e82
+
75d0e82
+  /Helvetica-BoldOblique findfont 1 index 3 div scalefont setfont
75d0e82
+  dup 40 div
75d0e82
+
75d0e82
+  dup 4 mul 1 index 25 mul moveto (E) show
75d0e82
+  dup 10 mul 1 index 15 mul moveto (S) show
75d0e82
+  dup 16 mul 1 index 5 mul moveto (P) show
75d0e82
+
75d0e82
+  /Helvetica-BoldOblique findfont 2 index 5 div scalefont setfont
75d0e82
+  dup 14 mul 1 index 29 mul moveto (asy) show
75d0e82
+  dup 20 mul 1 index 19 mul moveto (oftware) show
75d0e82
+  dup 26 mul 1 index 9 mul moveto (roducts) show
75d0e82
+
75d0e82
+  pop
75d0e82
+} bind def
75d0e82
+%%EndResource
75d0e82
+%%EndProlog
75d0e82
+%%Page: 1 1
75d0e82
+gsave
75d0e82
+
75d0e82
+  % Determine the imageable area and device resolution...
75d0e82
+  initclip newpath clippath pathbbox	% Get bounding rectangle
75d0e82
+  72 div /pageTop exch def		% Get top margin in inches
75d0e82
+  72 div /pageRight exch def		% Get right margin in inches
75d0e82
+  72 div /pageBottom exch def		% Get bottom margin in inches
75d0e82
+  72 div /pageLeft exch def		% Get left margin in inches
75d0e82
+
75d0e82
+  /pageWidth pageRight pageLeft sub def	% pageWidth = pageRight - pageLeft
75d0e82
+  /pageHeight pageTop pageBottom sub def% pageHeight = pageTop - pageBottom
75d0e82
+
75d0e82
+  /boxWidth				% width of text box
75d0e82
+  pageWidth pageHeight lt
75d0e82
+  { pageWidth 54 mul }
75d0e82
+  { pageHeight 42 mul }
75d0e82
+  ifelse def
75d0e82
+
75d0e82
+  newpath				% Clear bounding path
75d0e82
+
75d0e82
+  % Create fonts...
75d0e82
+  /bigFont /Helvetica-Bold findfont	% bigFont = Helvetica-Bold
75d0e82
+  pageHeight 3 mul scalefont def	% size = pageHeight * 3 (nominally 33)
75d0e82
+
75d0e82
+  /mediumFont /Helvetica findfont	% mediumFont = Helvetica
75d0e82
+  pageHeight 1.5 mul scalefont def	% size = pageHeight * 1.5 (nominally 16.5)
75d0e82
+
75d0e82
+  % Offset page to account for lower-left margin...
75d0e82
+  pageLeft 72 mul
75d0e82
+  pageBottom 72 mul
75d0e82
+  translate
75d0e82
+
75d0e82
+  % Draw the label at the top and bottom...
75d0e82
+  0 setgray				% Color
75d0e82
+
75d0e82
+  pageWidth 36 mul			% Center of page
75d0e82
+  pageHeight 72 mul			% Top of page
75d0e82
+  pageWidth -7 mul add			% - 2 lines
75d0e82
+  moveto				% Position text
75d0e82
+  bigFont setfont			% Font
75d0e82
+  ({mls-label}) CENTER		% Show text centered
75d0e82
+
75d0e82
+  pageWidth 36 mul			% Center of page
75d0e82
+  pageHeight 6 mul			% Bottom of page
75d0e82
+  moveto				% Position text
75d0e82
+  bigFont setfont			% Font
75d0e82
+  ({mls-label}) CENTER		% Show text centered
75d0e82
+
75d0e82
+  % Job information box...
75d0e82
+  pageWidth 36 mul 9 add		% x = pageWidth * 1/2 * 72 + 9
75d0e82
+  boxWidth 0.5 mul sub			% x-= 1/2 box width
75d0e82
+  pageHeight 30 mul 9 sub		% y = pageHeight * 1/2 * 72 - 9
75d0e82
+  boxWidth				% w = box width
75d0e82
+  pageHeight 14 mul			% h = pageHeight * 1/2 * 72
75d0e82
+  0.5 setgray rectfill			% Draw a shadow
75d0e82
+
75d0e82
+  pageWidth 36 mul			% x = pageWidth * 1/2 * 72
75d0e82
+  boxWidth 0.5 mul sub			% x-= 1/2 box width
75d0e82
+  pageHeight 30 mul			% y = pageHeight * 1/4 * 72
75d0e82
+  boxWidth				% w = box width
75d0e82
+  pageHeight 14 mul			% h = pageHeight * 1/2 * 72
75d0e82
+
75d0e82
+  4 copy 1 setgray rectfill		% Clear the box to white
75d0e82
+  0 setgray rectstroke			% Draw a black box around it...
75d0e82
+
75d0e82
+  % Job information text...
75d0e82
+  mediumFont setfont			% Medium sized font
75d0e82
+
75d0e82
+  pageWidth 36 mul			% x = pageWidth * 1/2 * 72
75d0e82
+  pageHeight 36 mul			% y = pageHeight * 1/2 * 72
75d0e82
+  pageHeight 5 mul add			% y += 2 lines
75d0e82
+  2 copy				% Copy X & Y
75d0e82
+  moveto
75d0e82
+  (Job ID: ) RIGHT
75d0e82
+  moveto
75d0e82
+  ({printer-name}-{job-id}) show
75d0e82
+
75d0e82
+  pageWidth 36 mul			% x = pageWidth * 1/2 * 72
75d0e82
+  pageHeight 36 mul			% y = pageHeight * 1/2 * 72
75d0e82
+  pageHeight 2 mul add			% y += 1 line
75d0e82
+  2 copy				% Copy X & Y
75d0e82
+  moveto
75d0e82
+  (Title: ) RIGHT
75d0e82
+  moveto
75d0e82
+  ({job-name}) show
75d0e82
+
75d0e82
+  pageWidth 36 mul			% x = pageWidth * 1/2 * 72
75d0e82
+  pageHeight 36 mul			% y = pageHeight * 1/2 * 72
75d0e82
+  pageHeight -1 mul add			% y -= 1 line
75d0e82
+  2 copy				% Copy X & Y
75d0e82
+  moveto
75d0e82
+  (Requesting User: ) RIGHT
75d0e82
+  moveto
75d0e82
+  ({job-originating-user-name}) show
75d0e82
+
75d0e82
+  pageWidth 36 mul			% x = pageWidth * 1/2 * 72
75d0e82
+  pageHeight 36 mul			% y = pageHeight * 1/2 * 72
75d0e82
+  pageHeight -4 mul add			% y -= 2 lines
75d0e82
+  2 copy				% Copy X & Y
75d0e82
+  moveto
75d0e82
+  (Billing Info: ) RIGHT
75d0e82
+  moveto
75d0e82
+  ({?job-billing}) show
75d0e82
+
75d0e82
+  % Then the CUPS logo....
75d0e82
+  gsave
75d0e82
+    pageWidth 4 mul
75d0e82
+    pageWidth 6 mul
75d0e82
+    translate
75d0e82
+    pageWidth 9 mul CUPSLOGO
75d0e82
+  grestore
75d0e82
+
75d0e82
+  % And the ESP logo....
75d0e82
+  gsave
75d0e82
+    pageWidth 59 mul
75d0e82
+    pageWidth 6 mul
75d0e82
+    translate
75d0e82
+    pageWidth 6 mul ESPLOGO
75d0e82
+  grestore
75d0e82
+% Show the page...
75d0e82
+grestore
75d0e82
+showpage
75d0e82
+%
75d0e82
+% End of "$Id: mls_template,v 1.1 2005/06/27 18:44:46 colmo Exp $".
75d0e82
+%
75d0e82
+%%EOF
9ad376b
--- cups-1.2.2-8/data/selinux	1969-12-31 19:00:00.000000000 -0500
9ad376b
+++ cups-1.2.2/data/selinux	2006-08-07 06:19:33.000000000 -0400
75d0e82
@@ -0,0 +1,277 @@
75d0e82
+%!PS-Adobe-3.0
75d0e82
+%%BoundingBox: 0 0 612 792
75d0e82
+%%Pages: 1
75d0e82
+%%LanguageLevel: 1
75d0e82
+%%DocumentData: Clean7Bit
75d0e82
+%%DocumentSuppliedResources: procset bannerprint/1.0
75d0e82
+%%DocumentNeededResources: font Helvetica Helvetica-Bold Times-Roman
75d0e82
+%%Creator: Michael Sweet, Easy Software Products
75d0e82
+%%CreationDate: May 10, 2000
75d0e82
+%%Title: Test Page
75d0e82
+%%EndComments
75d0e82
+%%BeginProlog
75d0e82
+%%BeginResource procset bannerprint 1.1 0
75d0e82
+%
75d0e82
+%   PostScript banner page for the Common UNIX Printing System ("CUPS").
75d0e82
+%
75d0e82
+%   Copyright 1993-2005 by Easy Software Products
75d0e82
+%
75d0e82
+%   These coded instructions, statements, and computer programs are the
75d0e82
+%   property of Easy Software Products and are protected by Federal
75d0e82
+%   copyright law.  Distribution and use rights are outlined in the file
75d0e82
+%   "LICENSE.txt" which should have been included with this file.  If this
75d0e82
+%   file is missing or damaged please contact Easy Software Products
75d0e82
+%   at:
75d0e82
+%
75d0e82
+%       Attn: CUPS Licensing Information
75d0e82
+%       Easy Software Products
75d0e82
+%       44141 Airport View Drive, Suite 204
75d0e82
+%       Hollywood, Maryland 20636 USA
75d0e82
+%
75d0e82
+%       Voice: (301) 373-9600
75d0e82
+%       EMail: cups-info@cups.org
75d0e82
+%         WWW: http://www.cups.org
75d0e82
+%
75d0e82
+/CENTER {			% Draw centered text
75d0e82
+				% (name) CENTER -
75d0e82
+  dup stringwidth pop		% Get the width of the string
75d0e82
+  0.5 mul neg 0 rmoveto		% Shift left 1/2 of the distance
75d0e82
+  show				% Show the string
75d0e82
+} bind def
75d0e82
+/RIGHT {			% Draw right-justified text
75d0e82
+				% (name) RIGHT -
75d0e82
+  dup stringwidth pop		% Get the width of the string
75d0e82
+  neg 0 rmoveto			% Shift left the entire distance
75d0e82
+  show				% Show the string
75d0e82
+} bind def
75d0e82
+/NUMBER {			% Draw a number
75d0e82
+				% power n NUMBER -
75d0e82
+  1 index 1 eq {		% power == 1?
75d0e82
+    round cvi exch pop		% Convert "n" to integer
75d0e82
+  } {
75d0e82
+    1 index mul round exch div	% Truncate extra decimal places
75d0e82
+  } ifelse
75d0e82
+  100 string cvs show		% Convert to a string and show it...
75d0e82
+} bind def
75d0e82
+/CUPSLOGO {			% Draw the CUPS logo
75d0e82
+				% height CUPSLOGO
75d0e82
+  % Start with a big C...
75d0e82
+  /Helvetica findfont 1 index scalefont setfont
75d0e82
+  0 setgray
75d0e82
+  0 0 moveto
75d0e82
+  (C) show
75d0e82
+
75d0e82
+  % Then "UNIX Printing System" much smaller...
75d0e82
+  /Helvetica-Bold findfont 1 index 9 div scalefont setfont
75d0e82
+  0.25 mul
75d0e82
+  dup dup 2.0 mul moveto
75d0e82
+  (UNIX) show
75d0e82
+  dup dup 1.6 mul moveto
75d0e82
+  (Printing) show
75d0e82
+  dup 1.2 mul moveto
75d0e82
+  (System) show
75d0e82
+} bind def
75d0e82
+/ESPLOGO {			% Draw the ESP logo
75d0e82
+				% height ESPLOGO
75d0e82
+  % Compute the size of the logo...
75d0e82
+  0 0
75d0e82
+  2 index 1.5 mul 3 index
75d0e82
+
75d0e82
+  % Do the "metallic" fill from 10% black to 40% black...
75d0e82
+  1 -0.001 0 {
75d0e82
+    dup			% loopval
75d0e82
+    -0.15 mul		% loopval * -0.15
75d0e82
+    0.9 add		% 0.9 - loopval * 0.15
75d0e82
+    setgray		% set gray shade
75d0e82
+
75d0e82
+    0			% x
75d0e82
+    1 index neg		% loopval
75d0e82
+    1 add		% 1 - loopval
75d0e82
+    3 index		% height
75d0e82
+    mul			% height * (1 - loopval)
75d0e82
+    moveto		% starting point
75d0e82
+
75d0e82
+    dup			% loopval
75d0e82
+    3 index		% width
75d0e82
+    mul			% loopval * width
75d0e82
+    2 index		% height
75d0e82
+    lineto		% Next point
75d0e82
+
75d0e82
+    0			% x
75d0e82
+    2 index		% height
75d0e82
+    lineto		% Next point
75d0e82
+
75d0e82
+    closepath
75d0e82
+    fill
75d0e82
+
75d0e82
+    dup			% loopval
75d0e82
+    0.15 mul		% loopval * 0.15
75d0e82
+    0.6 add		% 0.6 + loopval * 0.15
75d0e82
+    setgray
75d0e82
+
75d0e82
+    dup			% loopval
75d0e82
+    neg 1 add		% 1 - loopval
75d0e82
+    3 index		% width
75d0e82
+    mul			% (1 - loopval) * width
75d0e82
+    0			% y
75d0e82
+    moveto		% Starting point
75d0e82
+
75d0e82
+    2 index		% width
75d0e82
+    exch		% loopval
75d0e82
+    2 index		% height
75d0e82
+    mul			% loopval * height
75d0e82
+    lineto		% Next point
75d0e82
+
75d0e82
+    1 index		% width
75d0e82
+    0			% y
75d0e82
+    lineto		% Next point
75d0e82
+
75d0e82
+    closepath
75d0e82
+    fill
75d0e82
+  } for
75d0e82
+
75d0e82
+  0 setgray rectstroke
75d0e82
+
75d0e82
+  /Helvetica-BoldOblique findfont 1 index 3 div scalefont setfont
75d0e82
+  dup 40 div
75d0e82
+
75d0e82
+  dup 4 mul 1 index 25 mul moveto (E) show
75d0e82
+  dup 10 mul 1 index 15 mul moveto (S) show
75d0e82
+  dup 16 mul 1 index 5 mul moveto (P) show
75d0e82
+
75d0e82
+  /Helvetica-BoldOblique findfont 2 index 5 div scalefont setfont
75d0e82
+  dup 14 mul 1 index 29 mul moveto (asy) show
75d0e82
+  dup 20 mul 1 index 19 mul moveto (oftware) show
75d0e82
+  dup 26 mul 1 index 9 mul moveto (roducts) show
75d0e82
+
75d0e82
+  pop
75d0e82
+} bind def
75d0e82
+%%EndResource
75d0e82
+%%EndProlog
75d0e82
+%%Page: 1 1
75d0e82
+gsave
75d0e82
+
75d0e82
+  % Determine the imageable area and device resolution...
75d0e82
+  initclip newpath clippath pathbbox	% Get bounding rectangle
75d0e82
+  72 div /pageTop exch def		% Get top margin in inches
75d0e82
+  72 div /pageRight exch def		% Get right margin in inches
75d0e82
+  72 div /pageBottom exch def		% Get bottom margin in inches
75d0e82
+  72 div /pageLeft exch def		% Get left margin in inches
75d0e82
+
75d0e82
+  /pageWidth pageRight pageLeft sub def	% pageWidth = pageRight - pageLeft
75d0e82
+  /pageHeight pageTop pageBottom sub def% pageHeight = pageTop - pageBottom
75d0e82
+
75d0e82
+  /boxWidth				% width of text box
75d0e82
+  pageWidth pageHeight lt
75d0e82
+  { pageWidth 54 mul }
75d0e82
+  { pageHeight 42 mul }
75d0e82
+  ifelse def
75d0e82
+
75d0e82
+  newpath				% Clear bounding path
75d0e82
+
75d0e82
+  % Create fonts...
75d0e82
+  /bigFont /Helvetica-Bold findfont	% bigFont = Helvetica-Bold
75d0e82
+  pageHeight 3 mul scalefont def	% size = pageHeight * 3 (nominally 33)
75d0e82
+
75d0e82
+  /mediumFont /Helvetica findfont	% mediumFont = Helvetica
75d0e82
+  pageHeight 1.5 mul scalefont def	% size = pageHeight * 1.5 (nominally 16.5)
75d0e82
+
75d0e82
+  % Offset page to account for lower-left margin...
75d0e82
+  pageLeft 72 mul
75d0e82
+  pageBottom 72 mul
75d0e82
+  translate
75d0e82
+
75d0e82
+  % Draw the label at the top and bottom...
75d0e82
+  0 setgray				% Color
75d0e82
+
75d0e82
+  pageWidth 36 mul			% Center of page
75d0e82
+  pageHeight 72 mul			% Top of page
75d0e82
+  pageWidth -7 mul add			% - 2 lines
75d0e82
+  moveto				% Position text
75d0e82
+  bigFont setfont			% Font
75d0e82
+  ({mls-label}) CENTER		% Show text centered
75d0e82
+
75d0e82
+  pageWidth 36 mul			% Center of page
75d0e82
+  pageHeight 6 mul			% Bottom of page
75d0e82
+  moveto				% Position text
75d0e82
+  bigFont setfont			% Font
75d0e82
+  ({mls-label}) CENTER		% Show text centered
75d0e82
+
75d0e82
+  % Job information box...
75d0e82
+  pageWidth 36 mul 9 add		% x = pageWidth * 1/2 * 72 + 9
75d0e82
+  boxWidth 0.5 mul sub			% x-= 1/2 box width
75d0e82
+  pageHeight 30 mul 9 sub		% y = pageHeight * 1/2 * 72 - 9
75d0e82
+  boxWidth				% w = box width
75d0e82
+  pageHeight 14 mul			% h = pageHeight * 1/2 * 72
75d0e82
+  0.5 setgray rectfill			% Draw a shadow
75d0e82
+
75d0e82
+  pageWidth 36 mul			% x = pageWidth * 1/2 * 72
75d0e82
+  boxWidth 0.5 mul sub			% x-= 1/2 box width
75d0e82
+  pageHeight 30 mul			% y = pageHeight * 1/4 * 72
75d0e82
+  boxWidth				% w = box width
75d0e82
+  pageHeight 14 mul			% h = pageHeight * 1/2 * 72
75d0e82
+
75d0e82
+  4 copy 1 setgray rectfill		% Clear the box to white
75d0e82
+  0 setgray rectstroke			% Draw a black box around it...
75d0e82
+
75d0e82
+  % Job information text...
75d0e82
+  mediumFont setfont			% Medium sized font
75d0e82
+
75d0e82
+  pageWidth 36 mul			% x = pageWidth * 1/2 * 72
75d0e82
+  pageHeight 36 mul			% y = pageHeight * 1/2 * 72
75d0e82
+  pageHeight 5 mul add			% y += 2 lines
75d0e82
+  2 copy				% Copy X & Y
75d0e82
+  moveto
75d0e82
+  (Job ID: ) RIGHT
75d0e82
+  moveto
75d0e82
+  ({printer-name}-{job-id}) show
75d0e82
+
75d0e82
+  pageWidth 36 mul			% x = pageWidth * 1/2 * 72
75d0e82
+  pageHeight 36 mul			% y = pageHeight * 1/2 * 72
75d0e82
+  pageHeight 2 mul add			% y += 1 line
75d0e82
+  2 copy				% Copy X & Y
75d0e82
+  moveto
75d0e82
+  (Title: ) RIGHT
75d0e82
+  moveto
75d0e82
+  ({job-name}) show
75d0e82
+
75d0e82
+  pageWidth 36 mul			% x = pageWidth * 1/2 * 72
75d0e82
+  pageHeight 36 mul			% y = pageHeight * 1/2 * 72
75d0e82
+  pageHeight -1 mul add			% y -= 1 line
75d0e82
+  2 copy				% Copy X & Y
75d0e82
+  moveto
75d0e82
+  (Requesting User: ) RIGHT
75d0e82
+  moveto
75d0e82
+  ({job-originating-user-name}) show
75d0e82
+
75d0e82
+  pageWidth 36 mul			% x = pageWidth * 1/2 * 72
75d0e82
+  pageHeight 36 mul			% y = pageHeight * 1/2 * 72
75d0e82
+  pageHeight -4 mul add			% y -= 2 lines
75d0e82
+  2 copy				% Copy X & Y
75d0e82
+  moveto
75d0e82
+  (Billing Info: ) RIGHT
75d0e82
+  moveto
75d0e82
+  ({?job-billing}) show
75d0e82
+
75d0e82
+  % Then the CUPS logo....
75d0e82
+  gsave
75d0e82
+    pageWidth 4 mul
75d0e82
+    pageWidth 6 mul
75d0e82
+    translate
75d0e82
+    pageWidth 9 mul CUPSLOGO
75d0e82
+  grestore
75d0e82
+
75d0e82
+  % And the ESP logo....
75d0e82
+  gsave
75d0e82
+    pageWidth 59 mul
75d0e82
+    pageWidth 6 mul
75d0e82
+    translate
75d0e82
+    pageWidth 6 mul ESPLOGO
75d0e82
+  grestore
75d0e82
+% Show the page...
75d0e82
+grestore
75d0e82
+showpage
75d0e82
+%
75d0e82
+% End of "$Id: mls_template,v 1.1 2005/06/27 18:44:46 colmo Exp $".
75d0e82
+%
75d0e82
+%%EOF
9ad376b
--- cups-1.2.2-8/data/te	1969-12-31 19:00:00.000000000 -0500
9ad376b
+++ cups-1.2.2/data/te	2006-08-07 06:19:33.000000000 -0400
75d0e82
@@ -0,0 +1,277 @@
75d0e82
+%!PS-Adobe-3.0
75d0e82
+%%BoundingBox: 0 0 612 792
75d0e82
+%%Pages: 1
75d0e82
+%%LanguageLevel: 1
75d0e82
+%%DocumentData: Clean7Bit
75d0e82
+%%DocumentSuppliedResources: procset bannerprint/1.0
75d0e82
+%%DocumentNeededResources: font Helvetica Helvetica-Bold Times-Roman
75d0e82
+%%Creator: Michael Sweet, Easy Software Products
75d0e82
+%%CreationDate: May 10, 2000
75d0e82
+%%Title: Test Page
75d0e82
+%%EndComments
75d0e82
+%%BeginProlog
75d0e82
+%%BeginResource procset bannerprint 1.1 0
75d0e82
+%
75d0e82
+%   PostScript banner page for the Common UNIX Printing System ("CUPS").
75d0e82
+%
75d0e82
+%   Copyright 1993-2005 by Easy Software Products
75d0e82
+%
75d0e82
+%   These coded instructions, statements, and computer programs are the
75d0e82
+%   property of Easy Software Products and are protected by Federal
75d0e82
+%   copyright law.  Distribution and use rights are outlined in the file
75d0e82
+%   "LICENSE.txt" which should have been included with this file.  If this
75d0e82
+%   file is missing or damaged please contact Easy Software Products
75d0e82
+%   at:
75d0e82
+%
75d0e82
+%       Attn: CUPS Licensing Information
75d0e82
+%       Easy Software Products
75d0e82
+%       44141 Airport View Drive, Suite 204
75d0e82
+%       Hollywood, Maryland 20636 USA
75d0e82
+%
75d0e82
+%       Voice: (301) 373-9600
75d0e82
+%       EMail: cups-info@cups.org
75d0e82
+%         WWW: http://www.cups.org
75d0e82
+%
75d0e82
+/CENTER {			% Draw centered text
75d0e82
+				% (name) CENTER -
75d0e82
+  dup stringwidth pop		% Get the width of the string
75d0e82
+  0.5 mul neg 0 rmoveto		% Shift left 1/2 of the distance
75d0e82
+  show				% Show the string
75d0e82
+} bind def
75d0e82
+/RIGHT {			% Draw right-justified text
75d0e82
+				% (name) RIGHT -
75d0e82
+  dup stringwidth pop		% Get the width of the string
75d0e82
+  neg 0 rmoveto			% Shift left the entire distance
75d0e82
+  show				% Show the string
75d0e82
+} bind def
75d0e82
+/NUMBER {			% Draw a number
75d0e82
+				% power n NUMBER -
75d0e82
+  1 index 1 eq {		% power == 1?
75d0e82
+    round cvi exch pop		% Convert "n" to integer
75d0e82
+  } {
75d0e82
+    1 index mul round exch div	% Truncate extra decimal places
75d0e82
+  } ifelse
75d0e82
+  100 string cvs show		% Convert to a string and show it...
75d0e82
+} bind def
75d0e82
+/CUPSLOGO {			% Draw the CUPS logo
75d0e82
+				% height CUPSLOGO
75d0e82
+  % Start with a big C...
75d0e82
+  /Helvetica findfont 1 index scalefont setfont
75d0e82
+  0 setgray
75d0e82
+  0 0 moveto
75d0e82
+  (C) show
75d0e82
+
75d0e82
+  % Then "UNIX Printing System" much smaller...
75d0e82
+  /Helvetica-Bold findfont 1 index 9 div scalefont setfont
75d0e82
+  0.25 mul
75d0e82
+  dup dup 2.0 mul moveto
75d0e82
+  (UNIX) show
75d0e82
+  dup dup 1.6 mul moveto
75d0e82
+  (Printing) show
75d0e82
+  dup 1.2 mul moveto
75d0e82
+  (System) show
75d0e82
+} bind def
75d0e82
+/ESPLOGO {			% Draw the ESP logo
75d0e82
+				% height ESPLOGO
75d0e82
+  % Compute the size of the logo...
75d0e82
+  0 0
75d0e82
+  2 index 1.5 mul 3 index
75d0e82
+
75d0e82
+  % Do the "metallic" fill from 10% black to 40% black...
75d0e82
+  1 -0.001 0 {
75d0e82
+    dup			% loopval
75d0e82
+    -0.15 mul		% loopval * -0.15
75d0e82
+    0.9 add		% 0.9 - loopval * 0.15
75d0e82
+    setgray		% set gray shade
75d0e82
+
75d0e82
+    0			% x
75d0e82
+    1 index neg		% loopval
75d0e82
+    1 add		% 1 - loopval
75d0e82
+    3 index		% height
75d0e82
+    mul			% height * (1 - loopval)
75d0e82
+    moveto		% starting point
75d0e82
+
75d0e82
+    dup			% loopval
75d0e82
+    3 index		% width
75d0e82
+    mul			% loopval * width
75d0e82
+    2 index		% height
75d0e82
+    lineto		% Next point
75d0e82
+
75d0e82
+    0			% x
75d0e82
+    2 index		% height
75d0e82
+    lineto		% Next point
75d0e82
+
75d0e82
+    closepath
75d0e82
+    fill
75d0e82
+
75d0e82
+    dup			% loopval
75d0e82
+    0.15 mul		% loopval * 0.15
75d0e82
+    0.6 add		% 0.6 + loopval * 0.15
75d0e82
+    setgray
75d0e82
+
75d0e82
+    dup			% loopval
75d0e82
+    neg 1 add		% 1 - loopval
75d0e82
+    3 index		% width
75d0e82
+    mul			% (1 - loopval) * width
75d0e82
+    0			% y
75d0e82
+    moveto		% Starting point
75d0e82
+
75d0e82
+    2 index		% width
75d0e82
+    exch		% loopval
75d0e82
+    2 index		% height
75d0e82
+    mul			% loopval * height
75d0e82
+    lineto		% Next point
75d0e82
+
75d0e82
+    1 index		% width
75d0e82
+    0			% y
75d0e82
+    lineto		% Next point
75d0e82
+
75d0e82
+    closepath
75d0e82
+    fill
75d0e82
+  } for
75d0e82
+
75d0e82
+  0 setgray rectstroke
75d0e82
+
75d0e82
+  /Helvetica-BoldOblique findfont 1 index 3 div scalefont setfont
75d0e82
+  dup 40 div
75d0e82
+
75d0e82
+  dup 4 mul 1 index 25 mul moveto (E) show
75d0e82
+  dup 10 mul 1 index 15 mul moveto (S) show
75d0e82
+  dup 16 mul 1 index 5 mul moveto (P) show
75d0e82
+
75d0e82
+  /Helvetica-BoldOblique findfont 2 index 5 div scalefont setfont
75d0e82
+  dup 14 mul 1 index 29 mul moveto (asy) show
75d0e82
+  dup 20 mul 1 index 19 mul moveto (oftware) show
75d0e82
+  dup 26 mul 1 index 9 mul moveto (roducts) show
75d0e82
+
75d0e82
+  pop
75d0e82
+} bind def
75d0e82
+%%EndResource
75d0e82
+%%EndProlog
75d0e82
+%%Page: 1 1
75d0e82
+gsave
75d0e82
+
75d0e82
+  % Determine the imageable area and device resolution...
75d0e82
+  initclip newpath clippath pathbbox	% Get bounding rectangle
75d0e82
+  72 div /pageTop exch def		% Get top margin in inches
75d0e82
+  72 div /pageRight exch def		% Get right margin in inches
75d0e82
+  72 div /pageBottom exch def		% Get bottom margin in inches
75d0e82
+  72 div /pageLeft exch def		% Get left margin in inches
75d0e82
+
75d0e82
+  /pageWidth pageRight pageLeft sub def	% pageWidth = pageRight - pageLeft
75d0e82
+  /pageHeight pageTop pageBottom sub def% pageHeight = pageTop - pageBottom
75d0e82
+
75d0e82
+  /boxWidth				% width of text box
75d0e82
+  pageWidth pageHeight lt
75d0e82
+  { pageWidth 54 mul }
75d0e82
+  { pageHeight 42 mul }
75d0e82
+  ifelse def
75d0e82
+
75d0e82
+  newpath				% Clear bounding path
75d0e82
+
75d0e82
+  % Create fonts...
75d0e82
+  /bigFont /Helvetica-Bold findfont	% bigFont = Helvetica-Bold
75d0e82
+  pageHeight 3 mul scalefont def	% size = pageHeight * 3 (nominally 33)
75d0e82
+
75d0e82
+  /mediumFont /Helvetica findfont	% mediumFont = Helvetica
75d0e82
+  pageHeight 1.5 mul scalefont def	% size = pageHeight * 1.5 (nominally 16.5)
75d0e82
+
75d0e82
+  % Offset page to account for lower-left margin...
75d0e82
+  pageLeft 72 mul
75d0e82
+  pageBottom 72 mul
75d0e82
+  translate
75d0e82
+
75d0e82
+  % Draw the label at the top and bottom...
75d0e82
+  0 setgray				% Color
75d0e82
+
75d0e82
+  pageWidth 36 mul			% Center of page
75d0e82
+  pageHeight 72 mul			% Top of page
75d0e82
+  pageWidth -7 mul add			% - 2 lines
75d0e82
+  moveto				% Position text
75d0e82
+  bigFont setfont			% Font
75d0e82
+  ({mls-label}) CENTER		% Show text centered
75d0e82
+
75d0e82
+  pageWidth 36 mul			% Center of page
75d0e82
+  pageHeight 6 mul			% Bottom of page
75d0e82
+  moveto				% Position text
75d0e82
+  bigFont setfont			% Font
75d0e82
+  ({mls-label}) CENTER		% Show text centered
75d0e82
+
75d0e82
+  % Job information box...
75d0e82
+  pageWidth 36 mul 9 add		% x = pageWidth * 1/2 * 72 + 9
75d0e82
+  boxWidth 0.5 mul sub			% x-= 1/2 box width
75d0e82
+  pageHeight 30 mul 9 sub		% y = pageHeight * 1/2 * 72 - 9
75d0e82
+  boxWidth				% w = box width
75d0e82
+  pageHeight 14 mul			% h = pageHeight * 1/2 * 72
75d0e82
+  0.5 setgray rectfill			% Draw a shadow
75d0e82
+
75d0e82
+  pageWidth 36 mul			% x = pageWidth * 1/2 * 72
75d0e82
+  boxWidth 0.5 mul sub			% x-= 1/2 box width
75d0e82
+  pageHeight 30 mul			% y = pageHeight * 1/4 * 72
75d0e82
+  boxWidth				% w = box width
75d0e82
+  pageHeight 14 mul			% h = pageHeight * 1/2 * 72
75d0e82
+
75d0e82
+  4 copy 1 setgray rectfill		% Clear the box to white
75d0e82
+  0 setgray rectstroke			% Draw a black box around it...
75d0e82
+
75d0e82
+  % Job information text...
75d0e82
+  mediumFont setfont			% Medium sized font
75d0e82
+
75d0e82
+  pageWidth 36 mul			% x = pageWidth * 1/2 * 72
75d0e82
+  pageHeight 36 mul			% y = pageHeight * 1/2 * 72
75d0e82
+  pageHeight 5 mul add			% y += 2 lines
75d0e82
+  2 copy				% Copy X & Y
75d0e82
+  moveto
75d0e82
+  (Job ID: ) RIGHT
75d0e82
+  moveto
75d0e82
+  ({printer-name}-{job-id}) show
75d0e82
+
75d0e82
+  pageWidth 36 mul			% x = pageWidth * 1/2 * 72
75d0e82
+  pageHeight 36 mul			% y = pageHeight * 1/2 * 72
75d0e82
+  pageHeight 2 mul add			% y += 1 line
75d0e82
+  2 copy				% Copy X & Y
75d0e82
+  moveto
75d0e82
+  (Title: ) RIGHT
75d0e82
+  moveto
75d0e82
+  ({job-name}) show
75d0e82
+
75d0e82
+  pageWidth 36 mul			% x = pageWidth * 1/2 * 72
75d0e82
+  pageHeight 36 mul			% y = pageHeight * 1/2 * 72
75d0e82
+  pageHeight -1 mul add			% y -= 1 line
75d0e82
+  2 copy				% Copy X & Y
75d0e82
+  moveto
75d0e82
+  (Requesting User: ) RIGHT
75d0e82
+  moveto
75d0e82
+  ({job-originating-user-name}) show
75d0e82
+
75d0e82
+  pageWidth 36 mul			% x = pageWidth * 1/2 * 72
75d0e82
+  pageHeight 36 mul			% y = pageHeight * 1/2 * 72
75d0e82
+  pageHeight -4 mul add			% y -= 2 lines
75d0e82
+  2 copy				% Copy X & Y
75d0e82
+  moveto
75d0e82
+  (Billing Info: ) RIGHT
75d0e82
+  moveto
75d0e82
+  ({?job-billing}) show
75d0e82
+
75d0e82
+  % Then the CUPS logo....
75d0e82
+  gsave
75d0e82
+    pageWidth 4 mul
75d0e82
+    pageWidth 6 mul
75d0e82
+    translate
75d0e82
+    pageWidth 9 mul CUPSLOGO
75d0e82
+  grestore
75d0e82
+
75d0e82
+  % And the ESP logo....
75d0e82
+  gsave
75d0e82
+    pageWidth 59 mul
75d0e82
+    pageWidth 6 mul
75d0e82
+    translate
75d0e82
+    pageWidth 6 mul ESPLOGO
75d0e82
+  grestore
75d0e82
+% Show the page...
75d0e82
+grestore
75d0e82
+showpage
75d0e82
+%
75d0e82
+% End of "$Id: mls_template,v 1.1 2005/06/27 18:44:46 colmo Exp $".
75d0e82
+%
75d0e82
+%%EOF
9ad376b
--- cups-1.2.2-8/Makedefs.in	2006-08-10 11:43:02.000000000 -0400
9ad376b
+++ cups-1.2.2/Makedefs.in	2006-08-07 06:19:33.000000000 -0400
5dd9863
@@ -135,7 +135,7 @@
5dd9863
 			@LDFLAGS@ @RELROFLAG@ @PIEFLAGS@ $(OPTIM)
5dd9863
 LINKCUPS	=	@LINKCUPS@ $(SSLLIBS)
5dd9863
 LINKCUPSIMAGE	=	@LINKCUPSIMAGE@
5dd9863
-LIBS		=	$(LINKCUPS) $(COMMONLIBS)
5dd9863
+LIBS		=	$(LINKCUPS) $(COMMONLIBS) @LIBAUDIT@ @LIBSELINUX@
5dd9863
 OPTIM		=	@OPTIM@
5dd9863
 OPTIONS		=
5dd9863
 PAMLIBS		=	@PAMLIBS@
9ad376b
--- cups-1.2.2-8/scheduler/client.c	2006-08-10 11:43:02.000000000 -0400
9ad376b
+++ cups-1.2.2/scheduler/client.c	2006-08-07 06:19:33.000000000 -0400
5dd9863
@@ -43,12 +43,17 @@
5dd9863
  *   make_certificate()      - Make a self-signed SSL/TLS certificate.
5dd9863
  *   pipe_command()          - Pipe the output of a command to the remote client.
5dd9863
  *   write_file()            - Send a file via HTTP.
5dd9863
+ *   client_pid_to_auid()    - Get the audit login uid of the client.
75d0e82
  */
75d0e82
 
5dd9863
+/* Copyright (C) 2005 Trusted Computer Solutions, Inc. */
75d0e82
+/* (c) Copyright 2005-2006 Hewlett-Packard Development Company, L.P. */
75d0e82
+
75d0e82
 /*
75d0e82
  * Include necessary headers...
75d0e82
  */
75d0e82
 
5dd9863
+#define _GNU_SOURCE
5dd9863
 #include <cups/http-private.h>
5dd9863
 #include "cupsd.h"
75d0e82
 
5dd9863
@@ -64,6 +69,11 @@
5dd9863
 #  include <gnutls/x509.h>
5dd9863
 #endif /* HAVE_GNUTLS */
75d0e82
 
75d0e82
+#ifdef WITH_LSPP
75d0e82
+#include <selinux/selinux.h>
5dd9863
+#include <fcntl.h>
75d0e82
+#endif /* WITH_LSPP */
5dd9863
+
75d0e82
 
75d0e82
 /*
5dd9863
  * Local functions...
5dd9863
@@ -380,6 +390,53 @@
5dd9863
                   "cupsdAcceptClient: %d connected to server on %s:%d",
5dd9863
                   con->http.fd, con->servername, con->serverport);
75d0e82
 
75d0e82
+#ifdef WITH_LSPP
5dd9863
+  if (is_lspp_config())
75d0e82
+  {
5dd9863
+    struct ucred cr;
5dd9863
+    unsigned int cl=sizeof(cr);
5dd9863
+
5dd9863
+    if (getsockopt(con->http.fd, SOL_SOCKET, SO_PEERCRED, &cr, &cl) == 0)
5dd9863
+    {
5dd9863
+     /*
5dd9863
+      * client_pid_to_auid() can be racey
5dd9863
+      * In this case the pid is based on a socket connected to the client
5dd9863
+      */
5dd9863
+      if ((con->auid = client_pid_to_auid(cr.pid)) == -1)
5dd9863
+      {
5dd9863
+        close(con->http.fd);
5dd9863
+        cupsdLogMessage(CUPSD_LOG_ERROR, "cupsdAcceptClient: unable to determine client auid");
5dd9863
+        return (cupsdCloseClient(con));
5dd9863
+      }
5dd9863
+      cupsdLogMessage(CUPSD_LOG_INFO, "cupsdAcceptClient: peer's pid=%d, uid=%d, gid=%d, auid=%d",
5dd9863
+                      cr.pid, cr.uid, cr.gid, con->auid);
5dd9863
+    }
5dd9863
+    else
5dd9863
+    {
5dd9863
+      close(con->http.fd);
5dd9863
+      cupsdLogMessage(CUPSD_LOG_ERROR, "cupsdAcceptClient: getsockopt() failed");
5dd9863
+      return (cupsdCloseClient(con));
5dd9863
+    }
5dd9863
+
75d0e82
+   /*
5dd9863
+    * get the context of the peer connection
75d0e82
+    */
5dd9863
+    if (getpeercon(con->http.fd, &con->scon))
5dd9863
+    {
5dd9863
+      cupsdLogMessage(CUPSD_LOG_ERROR, "cupsdAcceptClient: getpeercon() failed");
5dd9863
+      cupsdSetString(&con->scon, UNKNOWN_SL);
5dd9863
+    }
5dd9863
+
5dd9863
+    cupsdLogMessage(CUPSD_LOG_INFO, "cupsdAcceptClient: client context=%s", con->scon);
5dd9863
+
5dd9863
+  }
5dd9863
+  else
5dd9863
+  {
5dd9863
+    cupsdLogMessage(CUPSD_LOG_ERROR, "cupsdAcceptClient: skipping getpeercon()");
5dd9863
+    cupsdSetString(&con->scon, UNKNOWN_SL);
75d0e82
+  }
75d0e82
+#endif /* WITH_LSPP */
75d0e82
+
5dd9863
  /*
5dd9863
   * Using TCP_NODELAY improves responsiveness, especially on systems
5dd9863
   * with a slow loopback interface...  Since we write large buffers
5dd9863
@@ -3465,7 +3522,6 @@
5dd9863
   time_t		curtime;	/* Current time */
5dd9863
   int			result;		/* Result of GNU TLS calls */
75d0e82
 
5dd9863
-
5dd9863
  /*
5dd9863
   * Create the encryption key...
5dd9863
   */
5dd9863
@@ -3664,6 +3720,49 @@
5dd9863
 #endif /* HAVE_SSL */
75d0e82
 
75d0e82
 
75d0e82
+#ifdef WITH_LSPP
5dd9863
+/*
5dd9863
+ * 'client_pid_to_auid()' - Using the client's pid, read /proc and determine the loginuid.
5dd9863
+ */
75d0e82
+
5dd9863
+uid_t client_pid_to_auid(pid_t clipid)
5dd9863
+{
5dd9863
+  uid_t uid;
5dd9863
+  int len, in;
5dd9863
+  char buf[16] = {0};
5dd9863
+  char fname[32] = {0};
75d0e82
+
75d0e82
+
5dd9863
+ /*
5dd9863
+  * Hopefully this pid is still the one we are interested in.
5dd9863
+  */
5dd9863
+  snprintf(fname, 32, "/proc/%d/loginuid", clipid);
5dd9863
+  in = open(fname, O_NOFOLLOW|O_RDONLY);
75d0e82
+
5dd9863
+  if (in < 0)
5dd9863
+    return -1;
75d0e82
+
5dd9863
+  errno = 0;
75d0e82
+
5dd9863
+  do {
5dd9863
+    len = read(in, buf, sizeof(buf));
5dd9863
+  } while (len < 0 && errno == EINTR);
75d0e82
+
5dd9863
+  close(in);
75d0e82
+
5dd9863
+  if (len < 0 || len >= sizeof(buf))
5dd9863
+    return -1;
5dd9863
+
5dd9863
+  buf[len] = 0;
5dd9863
+  uid = strtol(buf, 0, 10);
5dd9863
+
5dd9863
+  if (errno != 0)
5dd9863
+    return -1;
5dd9863
+  else
5dd9863
+    return uid;
5dd9863
+}
75d0e82
+#endif /* WITH_LSPP */
5dd9863
+
5dd9863
 /*
5dd9863
  * 'pipe_command()' - Pipe the output of a command to the remote client.
5dd9863
  */
9ad376b
--- cups-1.2.2-8/scheduler/client.h	2006-08-10 11:43:02.000000000 -0400
9ad376b
+++ cups-1.2.2/scheduler/client.h	2006-08-07 06:19:33.000000000 -0400
75d0e82
@@ -22,6 +22,13 @@
75d0e82
  *         WWW: http://www.cups.org
75d0e82
  */
75d0e82
 
75d0e82
+/* Copyright (C) 2005 Trusted Computer Solutions, Inc. */
75d0e82
+/* (c) Copyright 2005-2006 Hewlett-Packard Development Company, L.P. */
75d0e82
+
75d0e82
+#ifdef WITH_LSPP
75d0e82
+#include <selinux/selinux.h>
75d0e82
+#endif /* WITH_LSPP */
75d0e82
+
75d0e82
 /*
75d0e82
  * HTTP client structure...
75d0e82
  */
75d0e82
@@ -55,6 +62,10 @@
75d0e82
   http_addr_t		clientaddr;	/* Client address */
75d0e82
   char			servername[256];/* Server name for connection */
75d0e82
   int			serverport;	/* Server port for connection */
75d0e82
+#ifdef WITH_LSPP
75d0e82
+  security_context_t	scon;		/* Security context of connection */
75d0e82
+  uid_t			auid;		/* Audit loginuid of the client */
75d0e82
+#endif /* WITH_LSPP */
75d0e82
 };
75d0e82
 
75d0e82
 #define HTTP(con) &((con)->http)
75d0e82
@@ -118,6 +129,9 @@
75d0e82
 extern void	cupsdStopListening(void);
75d0e82
 extern void	cupsdUpdateCGI(void);
75d0e82
 extern int	cupsdWriteClient(cupsd_client_t *con);
75d0e82
+#ifdef WITH_LSPP
75d0e82
+extern uid_t	client_pid_to_auid(pid_t clipid);
75d0e82
+#endif /* WITH_LSPP */
75d0e82
 
75d0e82
 
75d0e82
 /*
9ad376b
--- cups-1.2.2-8/scheduler/conf.c	2006-08-10 11:43:02.000000000 -0400
9ad376b
+++ cups-1.2.2/scheduler/conf.c	2006-08-14 06:09:33.000000000 -0400
5dd9863
@@ -35,6 +35,7 @@
5dd9863
  *   read_configuration()     - Read a configuration file.
5dd9863
  *   read_location()          - Read a <Location path> definition.
5dd9863
  *   read_policy()            - Read a <Policy name> definition.
5dd9863
+ *   is_lspp_config()         - Is the system configured for LSPP
75d0e82
  */
75d0e82
 
75d0e82
 /*
5dd9863
@@ -60,6 +61,9 @@
5dd9863
 #  define INADDR_NONE	0xffffffff
5dd9863
 #endif /* !INADDR_NONE */
75d0e82
 
75d0e82
+#ifdef WITH_LSPP
75d0e82
+#  include <libaudit.h>
75d0e82
+#endif /* WITH_LSPP */
75d0e82
 
75d0e82
 /*
5dd9863
  * Configuration variable structure...
5dd9863
@@ -161,6 +165,9 @@
5dd9863
   { "ServerKey",		&ServerKey,		CUPSD_VARTYPE_STRING },
5dd9863
 #  endif /* HAVE_LIBSSL || HAVE_GNUTLS */
5dd9863
 #endif /* HAVE_SSL */
5dd9863
+#ifdef WITH_LSPP
5dd9863
+  { "AuditLog",			&AuditLog,		CUPSD_VARTYPE_INTEGER },
5dd9863
+#endif /* WITH_LSPP */
5dd9863
 #ifdef HAVE_LAUNCHD
5dd9863
   { "LaunchdTimeout",		&LaunchdTimeout,	CUPSD_VARTYPE_INTEGER },
5dd9863
   { "LaunchdConf",		&LaunchdConf,		CUPSD_VARTYPE_STRING },
5dd9863
@@ -223,6 +230,9 @@
5dd9863
 		*old_requestroot;	/* Old RequestRoot */
5dd9863
   const char	*tmpdir;		/* TMPDIR environment variable */
5dd9863
   struct stat	tmpinfo;		/* Temporary directory info */
5dd9863
+#ifdef WITH_LSPP
5dd9863
+  char		*audit_message;		/* Audit message string */
5dd9863
+#endif /* WITH_LSPP */
5dd9863
 
5dd9863
 
5dd9863
  /*
9ad376b
@@ -377,6 +387,7 @@
5dd9863
     }
75d0e82
   }
75d0e82
 
9ad376b
+
9ad376b
  /*
9ad376b
   * Numeric options...
9ad376b
   */
9ad376b
@@ -470,6 +481,16 @@
9ad376b
 
9ad376b
   RunUser = getuid();
9ad376b
 
75d0e82
+#ifdef WITH_LSPP
5dd9863
+  /*
5dd9863
+   * ClassifyOverride is set during read_configuration, if its on, report it now
5dd9863
+   */
9ad376b
+  if (ClassifyOverride && AuditLog != -1)
5dd9863
+    audit_log_user_message(AuditLog, AUDIT_USYS_CONFIG,
5dd9863
+              "[Config] ClassifyOverride=enabled Users can override print banners",
5dd9863
+              ServerName, NULL, NULL, 1);
75d0e82
+#endif /* WITH_LSPP */
75d0e82
+
75d0e82
  /*
9ad376b
   * See if the ServerName is an IP address...
75d0e82
   */
9ad376b
@@ -779,7 +800,19 @@
5dd9863
     cupsdClearString(&Classification);
75d0e82
 
5dd9863
   if (Classification)
5dd9863
+  {
5dd9863
     cupsdLogMessage(CUPSD_LOG_INFO, "Security set to \"%s\"", Classification);
75d0e82
+#ifdef WITH_LSPP
9ad376b
+    if (AuditLog != -1)
9ad376b
+    {
9ad376b
+      audit_message = NULL;
9ad376b
+      cupsdSetStringf(&audit_message, "[Config] Security level=%s", Classification);
9ad376b
+      audit_log_user_message(AuditLog, AUDIT_LABEL_LEVEL_CHANGE, audit_message,
9ad376b
+                             ServerName, NULL, NULL, 1);
9ad376b
+      free(audit_message);
9ad376b
+    }
75d0e82
+#endif /* WITH_LSPP */
5dd9863
+  }
75d0e82
 
5dd9863
  /*
5dd9863
   * Update the MaxClientsPerHost value, as needed...
9ad376b
@@ -2233,7 +2266,6 @@
5dd9863
 
5dd9863
       cupsd_dirsvc_addr_t	*dira;	/* New browse address array */
5dd9863
 
5dd9863
-
5dd9863
       if (NumBrowsers == 0)
5dd9863
         dira = malloc(sizeof(cupsd_dirsvc_addr_t));
5dd9863
       else
9ad376b
@@ -3286,6 +3318,18 @@
5dd9863
   return (0);
5dd9863
 }
75d0e82
 
75d0e82
+#ifdef WITH_LSPP
5dd9863
+int is_lspp_config()
5dd9863
+{
5dd9863
+  if (Classification != NULL)
5dd9863
+    return ((strcasecmp(Classification, MLS_CONFIG) == 0) 
5dd9863
+            || (strcasecmp(Classification, TE_CONFIG) == 0)
5dd9863
+            || (strcasecmp(Classification, SELINUX_CONFIG) == 0));
5dd9863
+  else
5dd9863
+    return 0;
5dd9863
+}
75d0e82
+#endif /* WITH_LSPP */
5dd9863
+
5dd9863
 
5dd9863
 /*
5dd9863
  * End of "$Id: conf.c 5736 2006-07-13 19:59:36Z mike $".
9ad376b
--- cups-1.2.2-8/scheduler/conf.h	2006-08-10 11:43:02.000000000 -0400
9ad376b
+++ cups-1.2.2/scheduler/conf.h	2006-08-07 06:19:33.000000000 -0400
5dd9863
@@ -182,7 +182,6 @@
5dd9863
 					/* Number of MIME types */
5dd9863
 VAR const char		**MimeTypes		VALUE(NULL);
5dd9863
 					/* Array of MIME types */
5dd9863
-
5dd9863
 #ifdef HAVE_SSL
5dd9863
 VAR char		*ServerCertificate	VALUE(NULL);
5dd9863
 					/* Server certificate file */
5dd9863
@@ -191,6 +190,10 @@
5dd9863
 					/* Server key file */
5dd9863
 #  endif /* HAVE_LIBSSL || HAVE_GNUTLS */
5dd9863
 #endif /* HAVE_SSL */
5dd9863
+#ifdef WITH_LSPP
5dd9863
+VAR int			AuditLog		VALUE(-1);
5dd9863
+					/* File descriptor for audit */
5dd9863
+#endif /* WITH_LSPP */
5dd9863
 
5dd9863
 #ifdef HAVE_LAUNCHD
5dd9863
 VAR int			LaunchdTimeout		VALUE(DEFAULT_TIMEOUT);
5dd9863
@@ -213,6 +216,9 @@
5dd9863
 ;
5dd9863
 extern int	cupsdLogPage(cupsd_job_t *job, const char *page);
75d0e82
 
5dd9863
+#ifdef WITH_LSPP
5dd9863
+extern int	is_lspp_config(void);
5dd9863
+#endif /* WITH_LSPP */
75d0e82
 
5dd9863
 /*
5dd9863
  * End of "$Id: conf.h 5696 2006-06-26 18:34:20Z mike $".
9ad376b
--- cups-1.2.2-8/scheduler/ipp.c	2006-08-10 11:43:02.000000000 -0400
9ad376b
+++ cups-1.2.2/scheduler/ipp.c	2006-08-21 06:57:47.000000000 -0400
75d0e82
@@ -96,6 +96,9 @@
75d0e82
  *   validate_user()             - Validate the user for the request.
75d0e82
  */
75d0e82
 
75d0e82
+/* Copyright (C) 2005 Trusted Computer Solutions, Inc. */
75d0e82
+/* (c) Copyright 2005-2006 Hewlett-Packard Development Company, L.P. */
75d0e82
+
75d0e82
 /*
75d0e82
  * Include necessary headers...
75d0e82
  */
75d0e82
@@ -106,6 +109,14 @@
75d0e82
 #  include <paper.h>
75d0e82
 #endif /* HAVE_LIBPAPER */
75d0e82
 
75d0e82
+#ifdef WITH_LSPP
75d0e82
+#include <libaudit.h>
75d0e82
+#include <selinux/selinux.h>
75d0e82
+#include <selinux/context.h>
75d0e82
+#include <selinux/avc.h>
75d0e82
+#include <selinux/flask.h>
75d0e82
+#include <selinux/av_permissions.h>
75d0e82
+#endif /* WITH_LSPP */
75d0e82
 
75d0e82
 /*
75d0e82
  * PPD default choice structure...
9ad376b
@@ -1166,6 +1177,18 @@
75d0e82
   int		kbytes;			/* Size of print file */
75d0e82
   int		i;			/* Looping var */
75d0e82
   int		lowerpagerange;		/* Page range bound */
75d0e82
+#ifdef WITH_LSPP
75d0e82
+  char		*argv[3];		/* Command line args */
75d0e82
+  char		*envp[MAX_ENV];		/* Environment */
75d0e82
+  char		*audit_message;		/* Audit message string */
75d0e82
+  char		buffer[1024] = {0};	/* argv[0] buffer */
75d0e82
+  int		acstatus;		/* return value of the access check */
75d0e82
+  pid_t		acpid;			/* pid for the access check */
75d0e82
+  char		*printerfile;		/* device file pointed to by the printer */
9ad376b
+  char		*userheader = NULL;	/* User supplied job-sheets[0] */
9ad376b
+  char		*userfooter = NULL;	/* User supplied job-sheets[1] */
9ad376b
+  int		override = 0;		/* Was a banner overrode on a job */
75d0e82
+#endif /* WITH_LSPP */
75d0e82
 
75d0e82
 
75d0e82
   cupsdLogMessage(CUPSD_LOG_DEBUG2, "add_job(%p[%d], %s)", con,
9ad376b
@@ -1342,6 +1365,90 @@
75d0e82
     return (NULL);
75d0e82
   }
75d0e82
 
75d0e82
+#ifdef WITH_LSPP
75d0e82
+  if (is_lspp_config())
75d0e82
+  {
75d0e82
+    if (!con->scon || strlen(con->scon) == 0)
75d0e82
+    {
75d0e82
+      cupsdLogMessage(CUPSD_LOG_ERROR, "add_job: missing classification for connection \'%s\'!", dest);
75d0e82
+      send_ipp_status(con, IPP_INTERNAL_ERROR, _("Missing required secuirty attributes."));
75d0e82
+      return (NULL);
75d0e82
+    }
75d0e82
+    else
75d0e82
+    {
75d0e82
+     /*
75d0e82
+      * duplicate the security context and auid of the connection into the job structure
75d0e82
+      */
75d0e82
+      job->scon    = strdup(con->scon);
75d0e82
+      job->auid    = con->auid;
75d0e82
+
75d0e82
+     /* 
75d0e82
+      * add the security context to the request so that on a restart the security
75d0e82
+      * attributes will be able to be restored
75d0e82
+      */
75d0e82
+      ippAddString(con->request, IPP_TAG_JOB, IPP_TAG_NAME, "security-context", 
75d0e82
+                   NULL, job->scon);
75d0e82
+    }
75d0e82
+
75d0e82
+   /*
75d0e82
+    * Perform an access check so that if the user gets feedback at enqueue time
75d0e82
+    */
75d0e82
+
9ad376b
+    printerfile = strstr(printer->device_uri, "/dev/");
9ad376b
+    if (printerfile != NULL)
75d0e82
+    {
75d0e82
+      cupsdLogMessage(CUPSD_LOG_DEBUG, "add_job: Attempting an access check on printer device %s",
75d0e82
+                      printerfile);
75d0e82
+
75d0e82
+      if (setexeccon(job->scon) != 0)
75d0e82
+      {
75d0e82
+        cupsdLogMessage(CUPSD_LOG_ERROR, "add_job: Unable to setexeccon to %s", job->scon);
75d0e82
+        send_ipp_status(con, IPP_INTERNAL_ERROR, _("Internal SELinux error"));
75d0e82
+        return (NULL);
75d0e82
+      }
75d0e82
+
5dd9863
+      snprintf(buffer, sizeof(buffer), "%s/daemon/lspp-access", ServerBin);
9ad376b
+      argv[0] = "lspp-access";
75d0e82
+      argv[1] = printerfile;
75d0e82
+      argv[2] = NULL;
75d0e82
+
75d0e82
+      cupsdLoadEnv(envp, (int)(sizeof(envp) / sizeof(envp[0])));
75d0e82
+    
75d0e82
+      if (!cupsdStartProcess(buffer, argv, envp, -1, -1, -1, -1, 0, &acpid))
75d0e82
+      {
75d0e82
+        waitpid(acpid, &acstatus, 0);
75d0e82
+        if (WIFEXITED(acstatus))
75d0e82
+        {
75d0e82
+          if (WEXITSTATUS(acstatus) != 0)
75d0e82
+          {
75d0e82
+           /*
75d0e82
+            * The access check failed, so cancel the job and send an audit message
75d0e82
+            */
9ad376b
+            if (AuditLog != -1)
9ad376b
+            {
9ad376b
+              audit_message = NULL;
9ad376b
+              cupsdSetStringf(&audit_message, "job=%d auid=%u acct=%s obj=%s refused,"
9ad376b
+                              "unable to access printer=%s", job->id, con->auid,
9ad376b
+                              con->username, con->scon, printer->name);
9ad376b
+              audit_log_user_message(AuditLog, AUDIT_USER_LABELED_EXPORT, audit_message,
9ad376b
+                                     ServerName, NULL, NULL, 0);
9ad376b
+              free(audit_message);
9ad376b
+            }
75d0e82
+
75d0e82
+            send_ipp_status(con, IPP_NOT_AUTHORIZED, _("SELinux prohibits access to the printer"));
75d0e82
+            return (NULL);
75d0e82
+          }
75d0e82
+          else
75d0e82
+          {
75d0e82
+            cupsdLogMessage(CUPSD_LOG_DEBUG, "add_job: access check succeeded (returned %d)",
75d0e82
+                            WEXITSTATUS(acstatus));
75d0e82
+          }
75d0e82
+        }
75d0e82
+      }
75d0e82
+    }
75d0e82
+  }
75d0e82
+#endif /* WITH_LSPP */
75d0e82
+
75d0e82
   job->dtype   = dtype;
75d0e82
   job->attrs   = con->request;
75d0e82
   con->request = NULL;
9ad376b
@@ -1537,6 +1644,29 @@
9ad376b
       attr->values[0].string.text = _cupsStrAlloc(printer->job_sheets[0]);
9ad376b
       attr->values[1].string.text = _cupsStrAlloc(printer->job_sheets[1]);
9ad376b
     }
75d0e82
+#ifdef WITH_LSPP
9ad376b
+    else
9ad376b
+    {
9ad376b
+     /*
9ad376b
+      * The option was present, so capture the user supplied strings
9ad376b
+      */
9ad376b
+      userheader = strdup(attr->values[0].string.text);
9ad376b
+
9ad376b
+      if (attr->num_values > 1)
9ad376b
+        userfooter = strdup(attr->values[1].string.text);
9ad376b
+  
9ad376b
+      if ((strcmp(userheader, Classification) == 0)
d90f391
+          && userfooter &&(strcmp(userfooter, Classification) == 0))
9ad376b
+      {
75d0e82
+       /*
9ad376b
+        * Since both values are Classification, the user is not trying to Override
75d0e82
+        */
9ad376b
+        free(userheader);
d90f391
+        if (userfooter) free(userfooter);
9ad376b
+        userheader = userfooter = NULL;
9ad376b
+      }
9ad376b
+    }
9ad376b
+#endif /* WITH_LSPP */
9ad376b
 
9ad376b
     job->job_sheets = attr;
9ad376b
 
9ad376b
@@ -1567,6 +1697,9 @@
9ad376b
 	                		    "job-sheets=\"%s,none\", "
9ad376b
 					    "job-originating-user-name=\"%s\"",
9ad376b
 	        	 job->id, Classification, job->username);
9ad376b
+#ifdef WITH_LSPP
9ad376b
+          override = 1;
9ad376b
+#endif /* WITH_LSPP */
9ad376b
 	}
9ad376b
 	else if (attr->num_values == 2 &&
9ad376b
 	         strcmp(attr->values[0].string.text,
9ad376b
@@ -1585,6 +1718,9 @@
9ad376b
 					    "job-originating-user-name=\"%s\"",
9ad376b
 	        	 job->id, attr->values[0].string.text,
9ad376b
 			 attr->values[1].string.text, job->username);
9ad376b
+#ifdef WITH_LSPP
9ad376b
+          override = 1;
9ad376b
+#endif /* WITH_LSPP */
9ad376b
 	}
9ad376b
 	else if (strcmp(attr->values[0].string.text, Classification) &&
9ad376b
 	         strcmp(attr->values[0].string.text, "none") &&
9ad376b
@@ -1605,6 +1741,9 @@
9ad376b
 			    "job-originating-user-name=\"%s\"",
9ad376b
 	        	    job->id, attr->values[0].string.text,
9ad376b
 			    attr->values[1].string.text, job->username);
9ad376b
+#ifdef WITH_LSPP
9ad376b
+          override = 1;
9ad376b
+#endif /* WITH_LSPP */
9ad376b
         }
9ad376b
       }
9ad376b
       else if (strcmp(attr->values[0].string.text, Classification) &&
9ad376b
@@ -1645,9 +1784,52 @@
9ad376b
 	                  "job-sheets=\"%s\", "
9ad376b
 			  "job-originating-user-name=\"%s\"",
9ad376b
 	        	 job->id, Classification, job->username);
9ad376b
+#ifdef WITH_LSPP
9ad376b
+        override = 1;
9ad376b
+#endif /* WITH_LSPP */
9ad376b
+      }
9ad376b
+#ifdef WITH_LSPP
9ad376b
+      if (is_lspp_config() && AuditLog != -1)
9ad376b
+      {
75d0e82
+        audit_message = NULL;
9ad376b
+
9ad376b
+        if (userheader || userfooter)
9ad376b
+        {
9ad376b
+          if (!override)
9ad376b
+          {
9ad376b
+           /*
9ad376b
+            * The user overrode the banner, so audit it
9ad376b
+            */
9ad376b
+            cupsdSetStringf(&audit_message, "job=%d user supplied classification \"%s\" \"%s\""
9ad376b
+                            " using \"%s\" \"%s\"", job->id, userheader,
9ad376b
+                            userfooter, attr->values[0].string.text,
9ad376b
+                            (attr->num_values > 1) ? attr->values[1].string.text : "(null)");
9ad376b
+            audit_log_user_message(AuditLog, AUDIT_LABEL_OVERRIDE, audit_message,
9ad376b
+                                   ServerName, NULL, NULL, 1);
9ad376b
+          }
9ad376b
+          else
9ad376b
+          {
9ad376b
+           /*
9ad376b
+            * The user tried to override the banner, audit the failure
9ad376b
+            */
9ad376b
+            cupsdSetStringf(&audit_message, "job=%d user supplied classification \"%s\" \"%s\""
9ad376b
+                            ", ignored using \"%s\" \"%s\"", job->id, userheader,
9ad376b
+                            userfooter, attr->values[0].string.text,
9ad376b
+                            (attr->num_values > 1) ? attr->values[1].string.text : "(null)");
9ad376b
+            audit_log_user_message(AuditLog, AUDIT_LABEL_OVERRIDE, audit_message,
9ad376b
+                                   ServerName, NULL, NULL, 0);
9ad376b
+          }
9ad376b
+          free(audit_message);
9ad376b
       }
9ad376b
     }
9ad376b
 
9ad376b
+      if (userheader)
9ad376b
+        free(userheader);
9ad376b
+      if (userfooter)
9ad376b
+        free(userfooter);
75d0e82
+#endif /* WITH_LSPP */
9ad376b
+    }
9ad376b
+
9ad376b
    /*
9ad376b
     * See if we need to add the starting sheet...
9ad376b
     */
9ad376b
@@ -3501,6 +3683,11 @@
75d0e82
   char		attrname[255],		/* Name of attribute */
75d0e82
 		*s;			/* Pointer into name */
75d0e82
   ipp_attribute_t *attr;		/* Attribute */
75d0e82
+#ifdef WITH_LSPP
75d0e82
+  const char	*mls_label = NULL;	/* SL of print job */
75d0e82
+  context_t	job_context;		/* SELinux context of the job */
75d0e82
+#endif /* WITH_LSPP */
75d0e82
+
75d0e82
 
75d0e82
 
75d0e82
   cupsdLogMessage(CUPSD_LOG_DEBUG2, "copy_banner(%p[%d], %p[%d], %s)",
9ad376b
@@ -3628,6 +3815,24 @@
75d0e82
       else
75d0e82
         s = attrname;
75d0e82
 
75d0e82
+#ifdef WITH_LSPP
75d0e82
+      if (strcmp(s, "mls-label") == 0)
75d0e82
+      {
75d0e82
+        if (con->scon != NULL && strcmp(con->scon, UNKNOWN_SL) != 0)
75d0e82
+        {
75d0e82
+          job_context = context_new(con->scon);
75d0e82
+          if (strcasecmp(name, MLS_CONFIG) == 0)
75d0e82
+            mls_label = context_range_get(job_context);
75d0e82
+          else if (strcasecmp(name, TE_CONFIG) == 0)
75d0e82
+            mls_label = context_type_get(job_context);
75d0e82
+          else // default to using the whole context string
75d0e82
+            mls_label = context_str(job_context);
75d0e82
+          cupsFilePuts(out, mls_label);
75d0e82
+          context_free(job_context);
75d0e82
+        }
75d0e82
+        continue;
75d0e82
+      }
75d0e82
+#endif /* WITH_LSPP */
75d0e82
       if (!strcmp(s, "printer-name"))
75d0e82
       {
75d0e82
         cupsFilePuts(out, job->dest);
9ad376b
@@ -5353,6 +5558,15 @@
75d0e82
   cupsd_printer_t *printer;		/* Printer */
75d0e82
   cups_array_t	*list;			/* Which job list... */
75d0e82
   cups_array_t	*ra;			/* Requested attributes array */
75d0e82
+#ifdef WITH_LSPP
75d0e82
+  int			selinuxcheck;	/* perform the SELinux access check? */
75d0e82
+  security_id_t		clisid;		/* SELinux SID of the client */
75d0e82
+  security_id_t		jobsid;		/* SELinux SID of the job */
75d0e82
+  struct av_decision	avd;		/* SELinux decision stuct */
75d0e82
+  struct avc_entry_ref	avcref;		/* AVC entry cache pointer */
75d0e82
+  security_class_t	tclass;		/* SELinux security class */
75d0e82
+  access_vector_t	avr;		/* SELinux access being queried */
75d0e82
+#endif /* WITH_LSPP */
75d0e82
 
75d0e82
 
75d0e82
   cupsdLogMessage(CUPSD_LOG_DEBUG2, "get_jobs(%p[%d], %s)", con, con->http.fd,
9ad376b
@@ -5470,6 +5684,40 @@
75d0e82
 
75d0e82
   ra = create_requested_array(con->request);
75d0e82
 
75d0e82
+#ifdef WITH_LSPP
75d0e82
+ /*
75d0e82
+  * Determine outside the loop if we are concerned about SELinux
75d0e82
+  */
75d0e82
+  selinuxcheck = is_lspp_config();
75d0e82
+  if (selinuxcheck)
75d0e82
+  {
75d0e82
+    selinuxcheck = security_getenforce();
75d0e82
+    if (selinuxcheck == -1)
75d0e82
+    {
75d0e82
+      cupsdLogMessage(CUPSD_LOG_ERROR, "get_jobs: unable to determine SELinux enforcement");
75d0e82
+      send_ipp_status(con, IPP_INTERNAL_ERROR, _("Internal SELinux error (getenforce)."));
75d0e82
+      return;
75d0e82
+    }
75d0e82
+    if (avc_init("cups", NULL, NULL, NULL, NULL) < 0)
75d0e82
+    {
75d0e82
+      cupsdLogMessage(CUPSD_LOG_ERROR, "get_jobs: unable avc_init");
75d0e82
+      send_ipp_status(con, IPP_INTERNAL_ERROR, _("Internal SELinux error (avc_init)."));
75d0e82
+      return;
75d0e82
+    } 
75d0e82
+    if (avc_context_to_sid(con->scon, &clisid) != 0)
75d0e82
+    {
75d0e82
+      cupsdLogMessage(CUPSD_LOG_ERROR, "get_jobs: unable to convert %s to SELinux sid", con->scon);
75d0e82
+      send_ipp_status(con, IPP_INTERNAL_ERROR, _("Internal SELinux error (avc_context_to_sid)."));
75d0e82
+      return;
75d0e82
+    }
75d0e82
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "get_jobs: client context %s", con->scon);
75d0e82
+
75d0e82
+    avr = FILE__READ;
75d0e82
+    tclass = SECCLASS_FILE;
75d0e82
+  }
75d0e82
+#endif /* WITH_LSPP */
75d0e82
+
75d0e82
+
75d0e82
  /*
75d0e82
   * OK, build a list of jobs for this printer...
75d0e82
   */
9ad376b
@@ -5507,6 +5755,19 @@
75d0e82
     if (count > 0)
75d0e82
       ippAddSeparator(con->response);
75d0e82
 
75d0e82
+#ifdef WITH_LSPP
75d0e82
+    if (selinuxcheck)
75d0e82
+    {
75d0e82
+      cupsdLogMessage(CUPSD_LOG_DEBUG, "get_jobs: job context %s", job->scon);
75d0e82
+
75d0e82
+      avc_context_to_sid(job->scon, &jobsid);
75d0e82
+      avc_entry_ref_init(&avcref);
75d0e82
+      
75d0e82
+      if (avc_has_perm_noaudit(clisid, jobsid, tclass, avr, &avcref, &avd) != 0)
75d0e82
+        continue;
75d0e82
+    }
75d0e82
+#endif /* WITH_LSPP */
75d0e82
+
75d0e82
     count ++;
75d0e82
 
75d0e82
     cupsdLogMessage(CUPSD_LOG_DEBUG2, "get_jobs: count = %d", count);
9ad376b
@@ -7935,12 +8196,22 @@
75d0e82
     * See if we need to add the ending sheet...
75d0e82
     */
75d0e82
 
75d0e82
+#ifdef WITH_LSPP
75d0e82
+    if (printer &&
75d0e82
+        ( is_lspp_config() ||
75d0e82
+        !(printer->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT)) ) &&
75d0e82
+        (attr = ippFindAttribute(job->attrs, "job-sheets",
75d0e82
+	                         IPP_TAG_ZERO)) != NULL &&
75d0e82
+        attr->num_values > 1)
75d0e82
+    {
75d0e82
+#else /* !WITH_LSPP */
75d0e82
     if (printer &&
75d0e82
         !(printer->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_IMPLICIT)) &&
75d0e82
         (attr = ippFindAttribute(job->attrs, "job-sheets",
75d0e82
 	                         IPP_TAG_ZERO)) != NULL &&
75d0e82
         attr->num_values > 1)
75d0e82
     {
75d0e82
+#endif /* WITH_LSPP */
75d0e82
      /*
75d0e82
       * Yes...
75d0e82
       */
9ad376b
--- cups-1.2.2-8/scheduler/job.c	2006-08-10 11:43:02.000000000 -0400
9ad376b
+++ cups-1.2.2/scheduler/job.c	2006-08-17 10:38:41.000000000 -0400
5dd9863
@@ -68,6 +68,9 @@
5dd9863
  *   unload_job()               - Unload a job from memory.
75d0e82
  */
75d0e82
 
5dd9863
+/* Copyright (C) 2005 Trusted Computer Solutions, Inc. */
5dd9863
+/* (c) Copyright 2005-2006 Hewlett-Packard Development Company, L.P. */
5dd9863
+
75d0e82
 /*
5dd9863
  * Include necessary headers...
5dd9863
  */
5dd9863
@@ -77,6 +80,11 @@
5dd9863
 #include <cups/backend.h>
5dd9863
 #include <cups/dir.h>
75d0e82
 
75d0e82
+#ifdef WITH_LSPP
5dd9863
+#include <selinux/selinux.h>
5dd9863
+#include <selinux/context.h>
5dd9863
+#include <libaudit.h>
75d0e82
+#endif /* WITH_LSPP */
75d0e82
 
75d0e82
 /*
5dd9863
  * Local globals...
5dd9863
@@ -985,6 +993,23 @@
5dd9863
     cupsdSetString(&job->dest, dest);
75d0e82
   }
75d0e82
 
75d0e82
+#ifdef WITH_LSPP
5dd9863
+  if ((attr = ippFindAttribute(job->attrs, "security-context", IPP_TAG_NAME)) != NULL)
5dd9863
+    cupsdSetString(&job->scon, attr->values[0].string.text);
5dd9863
+  else if (is_lspp_config())
5dd9863
+  {
5dd9863
+   /*
5dd9863
+    * There was no security context so delete the job
5dd9863
+    */
5dd9863
+    cupsdLogMessage(CUPSD_LOG_ERROR, "LoadAllJobs: Missing or bad security-context attribute in control file \"%s\"!",
5dd9863
+                    jobfile);
5dd9863
+    ippDelete(job->attrs);
5dd9863
+    job->attrs = NULL;
5dd9863
+    unlink(jobfile);
5dd9863
+    return;
5dd9863
+  }
75d0e82
+#endif /* WITH_LSPP */
75d0e82
+
5dd9863
   job->sheets     = ippFindAttribute(job->attrs, "job-media-sheets-completed",
5dd9863
                                      IPP_TAG_INTEGER);
5dd9863
   job->job_sheets = ippFindAttribute(job->attrs, "job-sheets", IPP_TAG_NAME);
9ad376b
@@ -2428,6 +2453,18 @@
5dd9863
   int			remote_job;	/* Remote print job? */
5dd9863
   static char		*options = NULL;/* Full list of options */
5dd9863
   static int		optlength = 0;	/* Length of option buffer */
75d0e82
+#ifdef WITH_LSPP
5dd9863
+  int			acstatus = 0;	/* return value of the access check */
5dd9863
+  pid_t			acpid = -1;	/* pid for the access check */
5dd9863
+  const char		*mls_label = NULL;	/* SL to put in classification env var */
9ad376b
+  char			*label_template = NULL;	/* SL to put in classification env var */
5dd9863
+  char			*audit_message = NULL;	/* Audit message string */
5dd9863
+  char			*printerfile = NULL;	/* Device file pointed to by the printer */
5dd9863
+  char			*acargv[3];	/* Command line args */
5dd9863
+  char			buffer[1024] = {0};	/* argv[0] buffer */
5dd9863
+  char			*acenvp[MAX_ENV];	/* Environment */
5dd9863
+  context_t		job_context;	/* SELinux context of the job */
75d0e82
+#endif /* WITH_LSPP */
75d0e82
 
75d0e82
 
5dd9863
   cupsdLogMessage(CUPSD_LOG_DEBUG2, "start_job: id = %d, file = %d/%d",
9ad376b
@@ -2709,6 +2746,69 @@
75d0e82
 
5dd9863
   cupsdLogMessage(CUPSD_LOG_DEBUG, "banner_page = %d", banner_page);
75d0e82
 
75d0e82
+#ifdef WITH_LSPP
5dd9863
+  if (is_lspp_config())
5dd9863
+  {
5dd9863
+   /*
5dd9863
+    * Perform an access check before printing, but only if the printer starts with /dev/
5dd9863
+    */
9ad376b
+    printerfile = strstr(printer->device_uri, "/dev/");
75d0e82
+
9ad376b
+    if (printerfile != NULL)
5dd9863
+    {
9ad376b
+      cupsdLogMessage(CUPSD_LOG_DEBUG, "StartJob: Attempting to check access on printer device %s",
9ad376b
+                      printerfile);
9ad376b
+
5dd9863
+      if (setexeccon(job->scon) != 0)
5dd9863
+      {
5dd9863
+        cupsdLogMessage(CUPSD_LOG_ERROR, "StartJob: Unable to setexeccon to %s", job->scon);
5dd9863
+        cupsdCancelJob(job, 0);
5dd9863
+        return;
5dd9863
+      }
75d0e82
+
5dd9863
+      snprintf(buffer, sizeof(buffer), "%s/daemon/lspp-access", ServerBin);
9ad376b
+      acargv[0] = "lspp-access";
5dd9863
+      acargv[1] = printerfile;
5dd9863
+      acargv[2] = NULL;
75d0e82
+
5dd9863
+      cupsdLoadEnv(acenvp, (int)(sizeof(acenvp) / sizeof(acenvp[0])));
75d0e82
+
5dd9863
+      if (!cupsdStartProcess(buffer, acargv, acenvp, -1, -1, -1, -1, 0, &acpid))
5dd9863
+      {
5dd9863
+        waitpid(acpid, &acstatus, 0);
5dd9863
+        if (WIFEXITED(acstatus))
5dd9863
+        {
5dd9863
+          if (WEXITSTATUS(acstatus) != 0) 
5dd9863
+          {
5dd9863
+           /*
5dd9863
+            * The access check failed, so cancel the job and send an audit message
5dd9863
+            */
9ad376b
+            if (AuditLog != -1)
9ad376b
+            {
9ad376b
+              audit_message = NULL;
9ad376b
+              cupsdSetStringf(&audit_message, "job=%d auid=%u acct=%s obj=%s cancelled,"
9ad376b
+                                              " unable to access printer=%s",
9ad376b
+                              job->id, job->auid, job->username, job->scon, printer->name);
9ad376b
+              audit_log_user_message(AuditLog, AUDIT_USER_LABELED_EXPORT, audit_message,
9ad376b
+                                     ServerName, NULL, NULL, 0);
9ad376b
+              free(audit_message);
9ad376b
+            }
5dd9863
+
5dd9863
+            cupsdCancelJob(job, 0);
5dd9863
+
5dd9863
+            return;
5dd9863
+          }
5dd9863
+          else
5dd9863
+          {
5dd9863
+            cupsdLogMessage(CUPSD_LOG_DEBUG, "StartJob: access check succeeded (returned %d)",
5dd9863
+                            WEXITSTATUS(acstatus));
5dd9863
+          }
5dd9863
+        }
5dd9863
+      }
5dd9863
+    }
75d0e82
+  }
5dd9863
+#endif /* WITH_LSPP */
5dd9863
+
5dd9863
  /*
5dd9863
   * Building the options string is harder than it needs to be, but
5dd9863
   * for the moment we need to pass strings for command-line args and
9ad376b
@@ -3041,6 +3141,61 @@
9ad376b
       snprintf(classification, sizeof(classification), "CLASSIFICATION=%s",
9ad376b
                attr->values[0].string.text);
5dd9863
 
5dd9863
+#ifdef WITH_LSPP
9ad376b
+    if (is_lspp_config())
5dd9863
+    {
9ad376b
+      if (job->scon == NULL)
9ad376b
+      {
9ad376b
+        if (AuditLog != -1)
9ad376b
+        {
9ad376b
+          audit_message = NULL;
9ad376b
+          cupsdSetStringf(&audit_message, "job=%d auid=%u acct=%s printer=%s title=%s",
9ad376b
+                          job->id, job->auid, job->username, printer->name, title);
9ad376b
+          audit_log_user_message(AuditLog, AUDIT_USER_UNLABELED_EXPORT, audit_message,
9ad376b
+                                 ServerName, NULL, NULL, 1);
9ad376b
+          free(audit_message);
9ad376b
+        }
9ad376b
+      }
9ad376b
+      else 
9ad376b
+      {
9ad376b
+        job_context = context_new(job->scon);
9ad376b
+  
9ad376b
+        if ((attr = ippFindAttribute(job->attrs, "job-sheets", IPP_TAG_NAME)) == NULL)
9ad376b
+          label_template = strdup(Classification);
9ad376b
+        else if (attr->num_values > 1 &&
9ad376b
+                 strcmp(attr->values[1].string.text, "none") != 0)
9ad376b
+          label_template = strdup(attr->values[1].string.text);
9ad376b
+        else
9ad376b
+          label_template = strdup(attr->values[0].string.text);
9ad376b
+  
9ad376b
+        if (strcasecmp(label_template, MLS_CONFIG) == 0)
9ad376b
+          mls_label = context_range_get(job_context);
9ad376b
+        else if (strcasecmp(label_template, TE_CONFIG) == 0)
9ad376b
+          mls_label = context_type_get(job_context);
9ad376b
+        else if (strcasecmp(label_template, SELINUX_CONFIG) == 0)
9ad376b
+          mls_label = context_str(job_context);
9ad376b
+
9ad376b
+        if (!mls_label)
9ad376b
+          mls_label = label_template;
9ad376b
+
9ad376b
+        snprintf(classification, sizeof(classification), "CLASSIFICATION=%s", mls_label);
9ad376b
+  
9ad376b
+        if (AuditLog != -1)
9ad376b
+        {
9ad376b
+          audit_message = NULL;
9ad376b
+          cupsdSetStringf(&audit_message, "job=%d auid=%u acct=%s printer=%s title=%s"
9ad376b
+                          " obj=%s label=%s", job->id, job->auid, job->username,
9ad376b
+                          printer->name, title, job->scon, mls_label);
9ad376b
+          audit_log_user_message(AuditLog, AUDIT_USER_LABELED_EXPORT, audit_message,
9ad376b
+                                 ServerName, NULL, NULL, 1);
9ad376b
+          free(audit_message);
9ad376b
+        }
9ad376b
+        context_free(job_context);
9ad376b
+        free(label_template);
9ad376b
+      }
5dd9863
+    }
5dd9863
+#endif /* WITH_LSPP */
9ad376b
+
9ad376b
     envp[envc ++] = classification;
9ad376b
   }
9ad376b
 
9ad376b
--- cups-1.2.2-8/scheduler/job.h	2006-08-10 11:43:02.000000000 -0400
9ad376b
+++ cups-1.2.2/scheduler/job.h	2006-08-07 06:19:33.000000000 -0400
5dd9863
@@ -22,6 +22,13 @@
5dd9863
  *         WWW: http://www.cups.org
5dd9863
  */
5dd9863
 
5dd9863
+/* Copyright (C) 2005 Trusted Computer Solutions, Inc. */
5dd9863
+/* (c) Copyright 2005-2006 Hewlett-Packard Development Company, L.P. */
5dd9863
+
5dd9863
+#ifdef WITH_LSPP
5dd9863
+#include <selinux/selinux.h>
5dd9863
+#endif /* WITH_LSPP */
5dd9863
+
5dd9863
 /*
5dd9863
  * Job request structure...
5dd9863
  */
5dd9863
@@ -55,6 +62,10 @@
5dd9863
   int			status;		/* Status code from filters */
5dd9863
   cupsd_printer_t	*printer;	/* Printer this job is assigned to */
5dd9863
   int			tries;		/* Number of tries for this job */
5dd9863
+#ifdef WITH_LSPP
5dd9863
+  security_context_t	scon;		/* Security context of job */
5dd9863
+  uid_t			auid;		/* Audit loginuid for this job */
5dd9863
+#endif /* WITH_LSPP */
5dd9863
 } cupsd_job_t;
5dd9863
 
5dd9863
 
9ad376b
--- cups-1.2.2-8/scheduler/lspp-access.c	1969-12-31 19:00:00.000000000 -0500
9ad376b
+++ cups-1.2.2/scheduler/lspp-access.c	2006-08-07 06:19:33.000000000 -0400
9ad376b
@@ -0,0 +1,56 @@
9ad376b
+/*
9ad376b
+ *   Copyright (C) Hewlett-Packard Development Company, L.P., 2006
9ad376b
+ *
9ad376b
+ *   This program is free software;  you can redistribute it and/or modify
9ad376b
+ *   it under the terms of the GNU General Public License as published by
9ad376b
+ *   the Free Software Foundation; either version 2 of the License, or
9ad376b
+ *   (at your option) any later version.
9ad376b
+ *
9ad376b
+ *   This program is distributed in the hope that it will be useful,
9ad376b
+ *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
9ad376b
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
9ad376b
+ *   the GNU General Public License for more details.
9ad376b
+ *
9ad376b
+ *   You should have received a copy of the GNU General Public License
9ad376b
+ *   along with this program;  if not, write to the Free Software
9ad376b
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
9ad376b
+ *
9ad376b
+ * Contents:
9ad376b
+ *
9ad376b
+ *   main()               - Main entry for the access checker.
9ad376b
+ */
9ad376b
+
9ad376b
+#include <stdio.h>
9ad376b
+#include <unistd.h>
9ad376b
+#include <string.h>
9ad376b
+
9ad376b
+int main(int argc, char *argv[]) {
9ad376b
+  int status = -1;
9ad376b
+  char filename[FILENAME_MAX+1] = {0};
9ad376b
+
9ad376b
+  if (argc < 2)
9ad376b
+  {
9ad376b
+    printf("Check for access to which file? ");
9ad376b
+    scanf("%s", (char *)&filename);
9ad376b
+  }
9ad376b
+  else
9ad376b
+  {
9ad376b
+    strncpy(filename, argv[1], FILENAME_MAX);
9ad376b
+  }
9ad376b
+
9ad376b
+  status = access(filename, R_OK|W_OK);
9ad376b
+
9ad376b
+  if (argc < 2)
9ad376b
+  {
9ad376b
+   /*
9ad376b
+    * Assume the user would like to hear the answer on the terminal
9ad376b
+    * since the filename was received interactively.
9ad376b
+    */
9ad376b
+    if (status != 0)
9ad376b
+      printf("Unable to access that file.\n");
9ad376b
+    else
9ad376b
+      printf("Access Granted\n");
9ad376b
+  }
9ad376b
+  
9ad376b
+  return status;
9ad376b
+}
9ad376b
--- cups-1.2.2-8/scheduler/main.c	2006-08-10 11:43:02.000000000 -0400
9ad376b
+++ cups-1.2.2/scheduler/main.c	2006-08-15 09:15:28.000000000 -0400
5dd9863
@@ -47,6 +47,8 @@
5dd9863
  *   usage()                   - Show scheduler usage.
5dd9863
  */
5dd9863
 
5dd9863
+/* (c) Copyright 2005-2006 Hewlett-Packard Development Company, L.P. */
5dd9863
+
5dd9863
 /*
5dd9863
  * Include necessary headers...
5dd9863
  */
5dd9863
@@ -69,6 +71,9 @@
5dd9863
 #  include <notify.h>
5dd9863
 #endif /* HAVE_NOTIFY_H */
5dd9863
 
5dd9863
+#ifdef WITH_LSPP
5dd9863
+#  include <libaudit.h>
5dd9863
+#endif /* WITH_LSPP */
5dd9863
 
5dd9863
 /*
5dd9863
  * Local functions...
9ad376b
@@ -141,6 +146,9 @@
9ad376b
   int			launchd_idle_exit;
9ad376b
 					/* Idle exit on select timeout? */
9ad376b
 #endif	/* HAVE_LAUNCHD */
9ad376b
+#if WITH_LSPP
9ad376b
+  auditfail_t           failmode;       /* Action for audit_open failure */
9ad376b
+#endif /* WITH_LSPP */
9ad376b
 
9ad376b
 
9ad376b
  /*
9ad376b
@@ -351,6 +359,25 @@
5dd9863
 #endif /* DEBUG */
5dd9863
   }
5dd9863
 
5dd9863
+#ifdef WITH_LSPP
5dd9863
+  if ((AuditLog = audit_open()) < 0 )
5dd9863
+  {
9ad376b
+    if (get_auditfail_action(&failmode) == 0)
5dd9863
+    {
9ad376b
+      if (failmode == FAIL_LOG)
9ad376b
+      {
9ad376b
+        cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to connect to audit subsystem.");
9ad376b
+        AuditLog = -1;
9ad376b
+      }
9ad376b
+      else if (failmode == FAIL_TERMINATE)
9ad376b
+      {
9ad376b
+        fprintf(stderr, "cupsd: unable to start auditing, terminating");
9ad376b
+        return -1;
9ad376b
+      }
5dd9863
+    }
5dd9863
+  }
5dd9863
+#endif /* WITH_LSPP */
5dd9863
+
5dd9863
  /*
5dd9863
   * Set the timezone info...
5dd9863
   */
9ad376b
@@ -1115,6 +1142,11 @@
5dd9863
   free(input);
5dd9863
   free(output);
5dd9863
 
5dd9863
+#ifdef WITH_LSPP
9ad376b
+  if (AuditLog != -1)
9ad376b
+    audit_close(AuditLog);
5dd9863
+#endif /* WITH_LSPP */
5dd9863
+
5dd9863
   return (!stop_scheduler);
5dd9863
 }
5dd9863
 
9ad376b
--- cups-1.2.2-8/scheduler/Makefile	2006-08-10 11:43:02.000000000 -0400
9ad376b
+++ cups-1.2.2/scheduler/Makefile	2006-08-07 06:19:33.000000000 -0400
75d0e82
@@ -54,6 +54,7 @@
75d0e82
 OBJS	=	\
75d0e82
 		$(CUPSDOBJS) \
75d0e82
 		$(MIMEOBJS) \
5dd9863
+		lspp-access.o \
75d0e82
 		cups-deviced.o \
75d0e82
 		cups-driverd.o \
75d0e82
 		cups-lpd.o \
75d0e82
@@ -63,6 +64,7 @@
75d0e82
 		testspeed.o \
75d0e82
 		util.o
75d0e82
 TARGETS	=	\
5dd9863
+		lspp-access \
75d0e82
 		cupsd \
75d0e82
 		cups-deviced \
75d0e82
 		cups-driverd \
5dd9863
@@ -111,11 +113,12 @@
75d0e82
 	$(INSTALL_DIR) -m 755 $(SERVERBIN)
75d0e82
 	echo Creating $(SERVERBIN)/daemon...
75d0e82
 	$(INSTALL_DIR) -m 755 $(SERVERBIN)/daemon
75d0e82
-	echo Installing cups-deviced, cups-driverd, cups-lpd, and cups-polld in $(SERVERBIN)/daemon...
5dd9863
+	echo Installing cups-deviced, cups-driverd, cups-lpd, cups-polld, and lspp-access in $(SERVERBIN)/daemon...
75d0e82
 	$(INSTALL_BIN) cups-deviced $(SERVERBIN)/daemon
75d0e82
 	$(INSTALL_BIN) cups-driverd $(SERVERBIN)/daemon
75d0e82
 	$(INSTALL_BIN) cups-lpd $(SERVERBIN)/daemon
5dd9863
 	$(INSTALL_BIN) cups-polld $(SERVERBIN)/daemon
5dd9863
+	$(INSTALL_BIN) lspp-access $(SERVERBIN)/daemon
5dd9863
 	echo Creating $(SERVERBIN)/driver...
5dd9863
 	$(INSTALL_DIR) -m 755 $(SERVERBIN)/driver
5dd9863
 	echo Creating $(SERVERROOT)...
5dd9863
@@ -161,6 +164,7 @@
75d0e82
 	$(RM) $(SERVERBIN)/daemon/cups-driverd
75d0e82
 	$(RM) $(SERVERBIN)/daemon/cups-lpd
5dd9863
 	$(RM) $(SERVERBIN)/daemon/cups-polld
5dd9863
+	$(RM) $(SERVERBIN)/daemon/lspp-access
5dd9863
 	-$(RMDIR) $(STATEDIR)/certs
5dd9863
 	-$(RMDIR) $(STATEDIR)
5dd9863
 	-$(RMDIR) $(SERVERROOT)/ppd
1119287
--- cups-1.2.2/scheduler/printers.c.lspp	2006-08-24 12:28:38.000000000 +0100
1119287
+++ cups-1.2.2/scheduler/printers.c	2006-08-24 12:30:49.000000000 +0100
5dd9863
@@ -57,6 +57,8 @@
5dd9863
  *                                 printing desktop tools.
75d0e82
  */
75d0e82
 
75d0e82
+/* (c) Copyright 2005-2006 Hewlett-Packard Development Company, L.P. */
75d0e82
+
75d0e82
 /*
75d0e82
  * Include necessary headers...
75d0e82
  */
9ad376b
@@ -79,6 +81,10 @@
5dd9863
 static void	write_irix_state(cupsd_printer_t *p);