components/cups/patches/18-audit-tx.patch
author Sonam Gupta <sonam.x.gupta@oracle.com>
Wed, 13 Feb 2013 01:14:45 -0800
branchs11-update
changeset 2490 ee4391c71c07
permissions -rw-r--r--
15698471 cups should audit printing information in TX environments 14850597 TX printing is reported to print jobs even when request authorization fail. 16182423 Update error code for all the failed use of authorization records in CUPS 16182458 Print 3 files requesting nolabel and nobanner should produce 6 audit records 16201093 For remote print requests, the path token in AR from GZ needs modification
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2490
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
     1
--- configure.in	Thu Jan  3 02:44:26 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
     2
+++ configure.in	Wed Jan  2 21:45:05 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
     3
@@ -42,6 +42,7 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
     4
 sinclude(config-scripts/cups-pdf.m4)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
     5
 sinclude(config-scripts/cups-scripting.m4)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
     6
 sinclude(config-scripts/cups-labeling.m4)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
     7
+sinclude(config-scripts/cups-auditing.m4)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
     8
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
     9
 INSTALL_LANGUAGES=""
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    10
 UNINSTALL_LANGUAGES=""
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    11
--- config-scripts/cups-auditing.m4	Wed Jan  2 23:23:52 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    12
+++ config-scripts/cups-auditing.m4	Wed Jan  2 21:45:18 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    13
@@ -0,0 +1,35 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    14
+dnl
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    15
+dnl    Auditing support for the Common UNIX Printing System (CUPS).
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    16
+dnl
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    17
+dnl    Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    18
+dnl
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    19
+dnl   This program is free software; you can redistribute it and/or modify
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    20
+dnl   it under the terms of the GNU General Public License as published by
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    21
+dnl   the Free Software Foundation; version 2.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    22
+dnl
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    23
+dnl   This program is distributed in the hope that it will be useful, but
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    24
+dnl   WITHOUT ANY WARRANTY; without even the implied warranty of
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    25
+dnl   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    26
+dnl   General Public License for more details.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    27
+dnl
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    28
+dnl   You should have received a copy of the GNU General Public License
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    29
+dnl   along with this program; if not, write to the Free Software Foundation,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    30
+dnl   Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301 USA
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    31
+dnl
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    32
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    33
+AC_ARG_ENABLE(auditing, [ --enable-auditing enable support for auditing, default=auto])
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    34
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    35
+if test x"$enable_auditing" != xno; then
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    36
+    case "$uname" in
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    37
+        SunOS)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    38
+		AC_CHECK_LIB(bsm, adt_start_session,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    39
+		    [AUDITING_LIBS="-lbsm" AC_SUBST(AUDITING_LIBS)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    40
+		    AC_CHECK_HEADER(bsm/adt.h)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    41
+		    AC_CHECK_HEADER(bsm/adt_event.h)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    42
+		    AC_DEFINE(HAVE_ADT)])
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    43
+            ;;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    44
+        *)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    45
+            # All others
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    46
+            ;;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    47
+    esac
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    48
+fi
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    49
--- config.h.in	Wed Jan  2 23:21:36 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    50
+++ config.h.in	Wed Jan  2 21:44:45 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    51
@@ -672,6 +672,11 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    52
 #undef HAVE_TSOL
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    53
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    54
 /*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    55
+ * Do we have Auditing support ?
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    56
+ */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    57
+#undef HAVE_ADT
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    58
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    59
+/*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    60
  * Do we have SELinux support?
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    61
  */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    62
 #undef HAVE_SELINUX
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    63
--- Makedefs.in	Wed Jan  2 23:21:36 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    64
+++ Makedefs.in	Wed Jan  2 21:46:40 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    65
@@ -125,7 +125,7 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    66
 BANNERTOPS	=	@BANNERTOPS@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    67
 CFLAGS		=	@CPPFLAGS@ @CFLAGS@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    68
 COMMONLIBS	=	@LIBS@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    69
-CUPSDLIBS	=	@CUPSDLIBS@ @LABELING_LIBS@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    70
+CUPSDLIBS	=	@CUPSDLIBS@ @LABELING_LIBS@ @AUDITING_LIBS@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    71
 CXXFLAGS	=	@CPPFLAGS@ @CXXFLAGS@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    72
 CXXLIBS		=	@CXXLIBS@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    73
 DBUS_NOTIFIER	=	@DBUS_NOTIFIER@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    74
--- scheduler/client.h	Wed Jan  2 23:21:36 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    75
+++ scheduler/client.h	Wed Jan  2 21:44:36 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    76
@@ -17,6 +17,9 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    77
 #  include <Security/Authorization.h>
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    78
 #endif /* HAVE_AUTHORIZATION_H */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    79
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    80
+#ifdef HAVE_ADT
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    81
+#include <bsm/adt.h>
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    82
+#endif /* HAVE_ADT */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    83
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    84
 /*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    85
  * HTTP client structure...
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    86
@@ -64,8 +67,13 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    87
 #ifdef HAVE_AUTHORIZATION_H
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    88
   AuthorizationRef	authref;	/* Authorization ref */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    89
 #endif /* HAVE_AUTHORIZATION_H */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    90
-  char                  *slabel;		/* security context for security
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    91
+#ifdef HAVE_TSOL
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    92
+  char                  *slabel;	/* security context for security
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    93
 					   labeled environments */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    94
+#endif /* HAVE_TSOL */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    95
+#ifdef HAVE_ADT
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    96
+  adt_session_data_t	*ah		/* audit handle for print requests */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    97
+#endif /* HAVE_ADT */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    98
 };
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    99
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   100
 #define HTTP(con) &((con)->http)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   101
--- scheduler/job.h	Wed Jan  2 23:21:36 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   102
+++ scheduler/job.h	Wed Jan  2 21:46:16 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   103
@@ -13,6 +13,10 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   104
  *   file is missing or damaged, see the license at "http://www.cups.org/".
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   105
  */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   106
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   107
+#ifdef HAVE_ADT
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   108
+#include <bsm/adt.h>
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   109
+#endif /* HAVE_ADT */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   110
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   111
 /*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   112
  * Constants...
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   113
  */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   114
@@ -83,8 +87,13 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   115
   krb5_ccache		ccache;		/* Kerberos credential cache */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   116
   char			*ccname;	/* KRB5CCNAME environment variable */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   117
 #endif /* HAVE_GSSAPI */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   118
-  char                  *slabel;		/* security context for security
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   119
+#ifdef HAVE_TSOL
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   120
+  char                  *slabel;	/* security context for security
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   121
 					   labeled environments */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   122
+#endif /* HAVE_TSOL */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   123
+#ifdef HAVE_ADT
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   124
+  adt_session_data_t	*ah;		/* audit handle for print requests */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   125
+#endif /* HAVE_ADT */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   126
 };
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   127
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   128
 typedef struct cupsd_joblog_s		/**** Job log message ****/
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   129
--- scheduler/ipp.c	Wed Jan  2 23:21:36 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   130
+++ scheduler/ipp.c	Wed Jan  2 23:25:46 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   131
@@ -1425,12 +1425,20 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   132
 		*media_margin;		/* media-*-margin attribute */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   133
   ipp_t		*unsup_col;		/* media-col in unsupported response */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   134
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   135
-
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   136
   cupsdLogMessage(CUPSD_LOG_DEBUG2, "add_job(%p[%d], %p(%s), %p(%s/%s))",
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   137
                   con, con->http.fd, printer, printer->name,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   138
 		  filetype, filetype ? filetype->super : "none",
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   139
 		  filetype ? filetype->type : "none");
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   140
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   141
+#if defined(HAVE_TSOL)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   142
+  /* Start audit session to audit CUPS print requests */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   143
+  if (is_system_labeled() != 0) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   144
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "add_job: Start CUPS audit session"
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   145
+		    " for connection");
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   146
+    cups_audit_start_session(con);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   147
+  }
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   148
+#endif /* HAVE_TSOL */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   149
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   150
   /*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   151
    * Validate that the label associated with the connection is acceptable for
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   152
    * printing on the printer.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   153
@@ -1437,6 +1445,11 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   154
    */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   155
   if (cupsdInPrinterLabelRange(con->slabel, printer) == 0)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   156
   {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   157
+#if defined(HAVE_TSOL)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   158
+    /* Audit the print request */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   159
+    if (is_system_labeled() != 0)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   160
+      cups_audit_print_request_denial(con, NULL, printer, -1, EACCES);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   161
+#endif /* HAVE_TSOL */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   162
     send_ipp_status(con, IPP_NOT_AUTHORIZED, _("label violation."));
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   163
     return (NULL);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   164
   }
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   165
@@ -1450,6 +1463,12 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   166
       strcasecmp(con->http.hostname, "localhost") &&
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   167
       strcasecmp(con->http.hostname, ServerName))
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   168
   {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   169
+#if defined(HAVE_TSOL)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   170
+    /* Audit the print request */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   171
+    if (is_system_labeled() != 0)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   172
+      cups_audit_print_request_denial(con, NULL, printer, -1, EPERM);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   173
+#endif /* HAVE_TSOL */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   174
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   175
     send_ipp_status(con, IPP_NOT_AUTHORIZED,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   176
                     _("The printer or class is not shared!"));
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   177
     return (NULL);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   178
@@ -1463,6 +1482,11 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   179
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   180
   if ((status = cupsdCheckPolicy(printer->op_policy_ptr, con, NULL)) != HTTP_OK)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   181
   {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   182
+#if defined(HAVE_TSOL)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   183
+    /* Audit the print request */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   184
+    if (is_system_labeled() != 0)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   185
+      cups_audit_print_request_denial(con, NULL, printer, -1, EPERM);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   186
+#endif /* HAVE_TSOL */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   187
     send_http_error(con, status, printer);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   188
     return (NULL);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   189
   }
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   190
@@ -1714,6 +1738,21 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   191
 		 NULL, label_to_page_top_bottom_string(job->slabel));
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   192
   }
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   193
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   194
+#if defined(HAVE_TSOL)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   195
+  /*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   196
+   * Initialize audit handle for job.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   197
+   * Audit handle for job is same as that for connection.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   198
+   * Connection handle is not available in job.c where job requests
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   199
+   * are processed so the same is copied to job handle so that
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   200
+   * job requests can be audited.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   201
+   * Here just the handle pointer is being copied. It will stay valid
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   202
+   * throughout the processing of a print request.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   203
+   */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   204
+  if (is_system_labeled() != 0)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   205
+    job->ah = con->ah;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   206
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   207
+#endif /* HAVE_TSOL */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   208
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   209
   job->dtype   = printer->type & (CUPS_PRINTER_CLASS | CUPS_PRINTER_IMPLICIT |
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   210
                                   CUPS_PRINTER_REMOTE);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   211
   job->attrs   = con->request;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   212
@@ -1851,6 +1890,7 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   213
   */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   214
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   215
   ippAddInteger(job->attrs, IPP_TAG_JOB, IPP_TAG_INTEGER, "job-id", job->id);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   216
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   217
   job->state = ippAddInteger(job->attrs, IPP_TAG_JOB, IPP_TAG_ENUM,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   218
                              "job-state", IPP_JOB_STOPPED);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   219
   job->state_value = (ipp_jstate_t)job->state->values[0].integer;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   220
@@ -4081,6 +4121,11 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   221
     if ((status = cupsdCheckPolicy(printer->op_policy_ptr, con,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   222
                                    NULL)) != HTTP_OK)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   223
     {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   224
+#if defined(HAVE_TSOL)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   225
+      /* Audit the print request */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   226
+      if (is_system_labeled() != 0)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   227
+        cups_audit_print_request_denial(con, NULL, printer, -1, EPERM);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   228
+#endif /* HAVE_TSOL */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   229
       send_http_error(con, status, printer);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   230
       return;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   231
     }
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   232
--- scheduler/job.c	Wed Jan  2 23:21:36 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   233
+++ scheduler/job.c	Wed Jan  2 21:46:11 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   234
@@ -75,6 +75,9 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   235
 #include <cups/backend.h>
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   236
 #include <cups/dir.h>
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   237
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   238
+#if defined(HAVE_TSOL)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   239
+#include <bsm/adt_event.h>
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   240
+#endif /* HAVE_TSOL */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   241
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   242
 /*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   243
  * Design Notes for Job Management
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   244
@@ -2712,6 +2715,9 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   245
   const char		*message;	/* Message for job state */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   246
   char			buffer[1024];	/* Buffer for formatted messages */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   247
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   248
+#if defined(HAVE_TSOL)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   249
+  ipp_attribute_t	*attr;		/* Current attributes */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   250
+#endif /* HAVE_TSOL */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   251
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   252
   cupsdLogMessage(CUPSD_LOG_DEBUG2, "finalize_job(job=%p(%d))", job, job->id);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   253
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   254
@@ -2986,6 +2992,13 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   255
 		  "error_log file for details.";
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   256
     }
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   257
   }
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   258
+#if defined(HAVE_TSOL)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   259
+  /* Audit the print request. */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   260
+  if (is_system_labeled() != 0) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   261
+    cupsdLogMessage(CUPSD_LOG_DEBUG, "finalize_job(cups_audit_print_request)");
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   262
+    cups_audit_print_request(job, job_state);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   263
+  }
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   264
+#endif /* HAVE_TSOL */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   265
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   266
  /*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   267
   * Update the printer and job state.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   268
@@ -4037,6 +4050,12 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   269
                     "start_job(): job label outside of printer label range");
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   270
     cupsdSetJobState(job, IPP_JOB_CANCELED, CUPSD_JOB_DEFAULT,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   271
                      "job label is outside of printer label range");
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   272
+#if defined(HAVE_TSOL)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   273
+    if (is_system_labeled() != 0)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   274
+	cups_audit_print_request_denial(NULL, job, printer,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   275
+				    job->state_value, EACCES);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   276
+#endif /*HAVE_TSOL */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   277
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   278
     cupsdCheckJobs();
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   279
     return;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   280
   }
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   281
@@ -4586,7 +4605,6 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   282
    /*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   283
     * Handle the end of job stuff...
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   284
     */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   285
-
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   286
     finalize_job(job, 1);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   287
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   288
    /*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   289
--- scheduler/cups-lpd.c	Wed Sep  3 05:57:17 2008
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   290
+++ scheduler/cups-lpd.c	Wed Jan  2 21:45:33 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   291
@@ -348,8 +348,11 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   292
   ipp_attribute_t *attr;		/* IPP attribute */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   293
   char		uri[HTTP_MAX_URI];	/* Printer URI */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   294
   int		id;			/* Job ID */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   295
+#if defined(HAVE_TSOL)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   296
+  char		*hostname;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   297
+  const char    uid[11], gid[11];	/* user id and group id */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   298
+#endif /* HAVE_TSOL */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   299
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   300
-
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   301
  /*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   302
   * Setup the Create-Job request...
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   303
   */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   304
@@ -373,6 +376,29 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   305
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "document-name", 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   306
                  NULL, docname);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   307
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   308
+#if defined(HAVE_TSOL)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   309
+  if (is_system_labeled() != 0) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   310
+    /* Add job-originating-host-name to the request */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   311
+    if ((hostname = cupsGetOption("job-originating-host-name", num_options,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   312
+	options)) != NULL)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   313
+      ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   314
+		   "job-originating-host-name", NULL, hostname);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   315
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   316
+    /* Add userID and groupID of the user who submitted the request */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   317
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   318
+    /*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   319
+     * When uid and gid are added to the attributes using ippAddInteger,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   320
+     * ippFindAttribute from the scheduler is not able to read the attribute,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   321
+     * so using ippAddString to add uid and gid.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   322
+     */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   323
+    snprintf(uid, sizeof(uid), "%d", getuid());
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   324
+    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "userID", NULL, uid);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   325
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   326
+    snprintf(gid, sizeof(gid), "%d", getgid());
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   327
+    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "groupID", NULL, gid);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   328
+  }
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   329
+#endif /* HAVE_TSOL */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   330
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   331
   cupsEncodeOptions(request, num_options, options);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   332
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   333
  /*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   334
--- scheduler/audit.c	Wed Jan  2 23:26:12 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   335
+++ scheduler/audit.c	Wed Jan  2 21:44:22 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   336
@@ -0,0 +1,781 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   337
+/*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   338
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   339
+ */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   340
+/*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   341
+ * This program is free software; you can redistribute it and/or modify
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   342
+ * it under the terms of the GNU General Public License as published by
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   343
+ * the Free Software Foundation; version 2.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   344
+ *
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   345
+ * This program is distributed in the hope that it will be useful, but
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   346
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   347
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   348
+ * General Public License for more details.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   349
+ *
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   350
+ * You should have received a copy of the GNU General Public License
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   351
+ * along with this program; if not, write to the Free Software Foundation,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   352
+ * Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301 USA
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   353
+ */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   354
+#include <syslog.h>
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   355
+#include "cupsd.h"
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   356
+#include <bsm/adt.h>
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   357
+#include <bsm/adt_event.h>
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   358
+#include <auth_attr.h>
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   359
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   360
+#define	PRINT_UNLABELED_AUTH	"solaris.print.unlabeled"
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   361
+#define	PRINT_NOBANNER_AUTH	"solaris.print.nobanner"
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   362
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   363
+/*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   364
+ * Maximum length of string to hold requested job id:
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   365
+ * <printer-name>-<job-id>
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   366
+ * IPP_MAX_NAME+1+10+1
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   367
+ */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   368
+#define	REQ_MAX_NAME		IPP_MAX_NAME+1+10+1
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   369
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   370
+uid_t	uid = ADT_NO_ATTRIB;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   371
+gid_t	gid = ADT_NO_ATTRIB;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   372
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   373
+void cups_audit_start_session(cupsd_client_t *con);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   374
+void cups_audit_print_request_denial(cupsd_client_t *con, cupsd_job_t *job,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   375
+     cupsd_printer_t *printer, ipp_jstate_t job_state, int fail_reason);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   376
+void cups_audit_print_request(cupsd_job_t *job, ipp_jstate_t job_state);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   377
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   378
+/*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   379
+ * Set up an audit session for auditing the current print request.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   380
+ */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   381
+void
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   382
+cups_audit_start_session(cupsd_client_t *con)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   383
+{
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   384
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   385
+	if (adt_start_session(&con->ah, NULL, 0) != 0) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   386
+		cupsdLogMessage(CUPSD_LOG_EMERG, "cups_audit_start_session(): "
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   387
+		    "adt_start_session(): %d", errno);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   388
+		con->ah = NULL;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   389
+		return;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   390
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   391
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   392
+	if (strcasecmp(con->http.hostname, "localhost") == 0) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   393
+		/* Local Request */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   394
+		ucred_t *cred = NULL;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   395
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   396
+		if (getpeerucred(con->http.fd, &cred) == -1) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   397
+			cupsdLogMessage(CUPSD_LOG_EMERG,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   398
+			    "cups_audit_start_session(): "
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   399
+			    "getpeerucred(): %d", errno);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   400
+			(void) adt_end_session(con->ah);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   401
+			con->ah = NULL;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   402
+			return;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   403
+		}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   404
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   405
+		if (adt_set_from_ucred(con->ah, cred, ADT_NEW) != 0) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   406
+			cupsdLogMessage(CUPSD_LOG_EMERG,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   407
+			    "cups_audit_start_session(): "
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   408
+			    "adt_set_from_ucred(): %d", errno);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   409
+			(void) adt_end_session(con->ah);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   410
+			con->ah = NULL;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   411
+			return;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   412
+		}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   413
+	} else {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   414
+		/* Remote Request */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   415
+		ipp_attribute_t	*userID = NULL, *grpID = NULL;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   416
+		adt_termid_t	*termid = NULL;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   417
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   418
+		if ((userID = ippFindAttribute(con->request, "userID",
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   419
+		    IPP_TAG_NAME)) != NULL) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   420
+			cupsdLogMessage(CUPSD_LOG_DEBUG,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   421
+			    "cups_audit_start_session():"
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   422
+			    "userID = %s", userID->values[0].string.text);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   423
+			uid = atoi(userID->values[0].string.text);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   424
+		} else {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   425
+			cupsdLogMessage(CUPSD_LOG_DEBUG,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   426
+			    "cups_audit_start_session():"
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   427
+			    "userID = NULL");
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   428
+		}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   429
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   430
+		if ((grpID = ippFindAttribute(con->request, "groupID",
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   431
+		    IPP_TAG_NAME)) != NULL) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   432
+			cupsdLogMessage(CUPSD_LOG_DEBUG,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   433
+			    "cups_audit_start_session():"
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   434
+			    "grpID = %s", grpID->values[0].string.text);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   435
+			gid = atoi(grpID->values[0].string.text);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   436
+		} else {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   437
+			cupsdLogMessage(CUPSD_LOG_DEBUG,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   438
+			    "cups_audit_start_session():"
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   439
+			    "grpID = NULL");
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   440
+		}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   441
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   442
+		if (adt_load_termid(con->http.fd, &termid) != 0) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   443
+			cupsdLogMessage(CUPSD_LOG_ERROR,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   444
+			    "cups_audit_start_session(): "
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   445
+			    "adt_load_termid(): %d", errno);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   446
+		}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   447
+		if (adt_set_user(con->ah, uid, gid, uid, gid, termid,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   448
+		    ADT_NEW) != 0) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   449
+			cupsdLogMessage(CUPSD_LOG_EMERG,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   450
+			    "cups_audit_start_session(): "
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   451
+			    "adt_set_user(): %d", errno);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   452
+			(void) adt_end_session(con->ah);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   453
+			con->ah = NULL;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   454
+			free(termid);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   455
+			return;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   456
+		}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   457
+		free(termid);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   458
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   459
+}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   460
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   461
+/*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   462
+ * Routine for filling in the audit event details for each of the
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   463
+ * three types of TX-related printing audit records:
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   464
+ *    AUE_print_request - audit each file in print request
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   465
+ *    AUE_print_request_unlabeled - audit use of the solaris.print.nolabels auth
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   466
+ *    AUE_print_request_nobanner - audit use of the solaris.print.nobanner auth
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   467
+ * One AUE_print_request audit record is written for each text file in the
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   468
+ * print request. The '-o nolabels' and '-o nobanner' options apply to the
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   469
+ * entire print request so one AUE_print_request_unlabeled audit record and one
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   470
+ * AUE_print_request_nobanner audit record is written, respectively, for each
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   471
+ * file in the print request when these options are supplied.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   472
+ * 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   473
+ * event_ID		= type of TX-related printing audit record
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   474
+ * event		= audit event structure
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   475
+ * printer		= printer name
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   476
+ * slabel		= Sensitivity Label
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   477
+ * job_ID		= request_ID; <printe-name>-<job-id>
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   478
+ * job_ID_remote	= remote request_ID; <printe-name>-<remote-job_id>
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   479
+ *			job id for the same request differ on client and server
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   480
+ * filelist		= file to be printed;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   481
+ *			 In case 'filelist' is 'stdin', temporary filename
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   482
+ *			 created in /var/spool/cups/ is read 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   483
+ * ai			= struct addrinfo; 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   484
+ * status 		= audit request status;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   485
+ *			 ADT_FAILURE, ADT_SUCCESS
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   486
+ * return_val		= return value of audit request;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   487
+ *			 If user is not authorized then ADT_FAIL_VALUE_AUTH
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   488
+ *			 If print job is successfully completed then ADT_SUCCESS
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   489
+ *			 If job is cancelled then
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   490
+ *			 ADT_FAIL_VALUE_PRINT_JOB_CANCELLED
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   491
+ *			MAC failures it is EACESS
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   492
+ *			DAC failures it is EPERM
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   493
+ * i = which of the job files is this 000-999 for the CUPS max of 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   494
+ *	1000 jobs.  See util.c
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   495
+ * job_id 		= print request job id; this is used to get the location
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   496
+ *			 of the temporary file in spool directory which is of the format:
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   497
+ *			 /var/spool/cups/d00550-001
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   498
+ *			where 550 is the job-id.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   499
+ * remote		= true: remote request
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   500
+ *			 false: local request
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   501
+ */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   502
+static void
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   503
+cups_audit_print_request_data(au_event_t event_ID,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   504
+    adt_event_data_t *event, char *printer, char *slabel,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   505
+    char *job_ID, char *job_ID_remote, char *filelist,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   506
+    struct addrinfo *ai, int status, int return_val, int i,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   507
+    int job_id, boolean_t remote)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   508
+{
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   509
+	char		tmpfile[IPP_MAX_NAME];
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   510
+	char		tfile[IPP_MAX_NAME];
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   511
+	char		r_job_ID[IPP_MAX_NAME];
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   512
+	char		*file, *f_job_ID = NULL;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   513
+	struct stat	attributes;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   514
+	m_label_t	*file_label = NULL;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   515
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   516
+	/*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   517
+	 * If 'filelist' is 'stdin', read the temporary filename
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   518
+	 * created for the file contents in /var/spool/cups/
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   519
+	 * This will be useful to audit the files printed
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   520
+	 * via standard input.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   521
+	 * Scheduler can't discern the difference between a
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   522
+	 * file printed via stdin and one printed normally so
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   523
+	 * the file attributes and label are always included
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   524
+	 * even though they refer to the temporary file created
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   525
+	 * in the case of stdin.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   526
+	 * The label is going to be the same regardless of wheather
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   527
+	 * it is of the tmp file that was used for stdin or the real file.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   528
+	 */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   529
+	if (remote) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   530
+	    	/*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   531
+		 * temporary filename is of the format:
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   532
+		 * /var/spool/cups/d00550-001
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   533
+		 * where 550 is the job-id.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   534
+		 */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   535
+		snprintf(tmpfile, sizeof (tmpfile), "%s/d%05d-%03d",
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   536
+		    RequestRoot, job_id, i + 1);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   537
+		/*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   538
+		 * In case of remote request,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   539
+		 * Job_ID string is like:
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   540
+		 * 'Local JOB_ID: <printer>-id |
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   541
+		 * Remote JOB_ID: <printer>-<remote-id>'
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   542
+		 */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   543
+		if (job_ID_remote != NULL) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   544
+			snprintf(r_job_ID, sizeof (r_job_ID),
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   545
+			    "Local JOB_ID: %s |"
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   546
+			    " Remote JOB_ID: %s-%s",
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   547
+			    job_ID, printer, job_ID_remote);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   548
+			f_job_ID = r_job_ID;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   549
+		} else {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   550
+			f_job_ID = job_ID;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   551
+		}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   552
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   553
+	} else {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   554
+		f_job_ID = job_ID;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   555
+		if (job_id != -1) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   556
+			if ((strncmp(filelist, "(stdin)", 7)) == 0) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   557
+				snprintf(tmpfile, sizeof (tmpfile),
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   558
+				    "%s/d%05d-%03d", RequestRoot,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   559
+				    job_id, i + 1);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   560
+			} else {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   561
+				strlcpy(tmpfile, filelist, sizeof (tmpfile));
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   562
+			}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   563
+		} else {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   564
+			strlcpy(tmpfile, filelist, sizeof (tmpfile));
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   565
+		}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   566
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   567
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   568
+	file = tmpfile;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   569
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   570
+	if (stat(file, &attributes) == -1) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   571
+		cupsdLogMessage(CUPSD_LOG_ERROR,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   572
+		    "cups_audit_print_request_data():"
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   573
+		    "stat(): %d", errno);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   574
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   575
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   576
+	/*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   577
+	 * In case of remote request, filelist contains client document-name.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   578
+	 * Append the same to filename before writing to the audit record.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   579
+	 */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   580
+	if (remote && (filelist != NULL)) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   581
+		strlcpy(tfile, "Local file: ", sizeof (tmpfile));
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   582
+		strcat(tfile, tmpfile);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   583
+		strcat(tfile, " | Remote file: ");
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   584
+		strcat(tfile, filelist);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   585
+		file = tfile;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   586
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   587
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   588
+	/* extract label from slabel */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   589
+	if (str_to_label(slabel, &file_label, MAC_LABEL,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   590
+	    L_NO_CORRECTION, NULL) == 0) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   591
+		cupsdLogMessage(CUPSD_LOG_DEBUG2,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   592
+		    "cups_audit_print_request_data():"
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   593
+		    "file_label extracted");
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   594
+	} else {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   595
+		cupsdLogMessage(CUPSD_LOG_ERROR,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   596
+		    "cups_audit_print_request_data():"
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   597
+		    "file_label not extracted");
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   598
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   599
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   600
+	/* Populate audit event structure */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   601
+	switch (event_ID) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   602
+	case ADT_print_request_unlabeled:
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   603
+		if (remote) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   604
+			if (ai->ai_family == AF_INET) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   605
+				event->adt_print_request_unlabeled.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   606
+				    remote_host_ip_type = ADT_IPv4;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   607
+				    
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   608
+				(void) memcpy(event->
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   609
+				    adt_print_request_unlabeled.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   610
+				    remote_host_ipaddress,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   611
+				    &((struct sockaddr_in *)ai->
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   612
+				    ai_addr)->sin_addr,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   613
+				    sizeof (struct in_addr));
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   614
+			} else if (ai->ai_family == AF_INET6) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   615
+				event->adt_print_request_unlabeled.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   616
+				    remote_host_ip_type = ADT_IPv6;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   617
+				    
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   618
+				(void) memcpy(event->
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   619
+				    adt_print_request_unlabeled.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   620
+				    remote_host_ipaddress,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   621
+				    &((struct sockaddr_in6 *)ai->
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   622
+				    ai_addr)->sin6_addr,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   623
+				    sizeof (struct in6_addr));
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   624
+			}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   625
+		}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   626
+		event->adt_print_request_unlabeled.request_ID = f_job_ID;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   627
+		event->adt_print_request_unlabeled.printer = printer;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   628
+		event->adt_print_request_unlabeled.file = file;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   629
+		event->adt_print_request_unlabeled.file_attrs = &attributes;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   630
+		event->adt_print_request_unlabeled.file_label = file_label;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   631
+		event->adt_print_request_unlabeled.override_auth =
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   632
+		    PRINT_UNLABELED_AUTH;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   633
+		break;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   634
+	case ADT_print_request_nobanner:
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   635
+		if (remote) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   636
+			if (ai->ai_family == AF_INET) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   637
+				event->adt_print_request_nobanner.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   638
+				    remote_host_ip_type = ADT_IPv4;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   639
+				    
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   640
+				(void) memcpy(event->
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   641
+				    adt_print_request_nobanner.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   642
+				    remote_host_ipaddress,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   643
+				    &((struct sockaddr_in *)ai->
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   644
+				    ai_addr)->sin_addr,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   645
+				    sizeof (struct in_addr));
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   646
+			} else if (ai->ai_family == AF_INET6) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   647
+				event->adt_print_request_nobanner.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   648
+				    remote_host_ip_type = ADT_IPv6;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   649
+				    
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   650
+				(void) memcpy(event->
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   651
+				    adt_print_request_nobanner.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   652
+				    remote_host_ipaddress,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   653
+				    &((struct sockaddr_in6 *)ai->
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   654
+				    ai_addr)->sin6_addr,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   655
+				    sizeof (struct in6_addr));
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   656
+			}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   657
+		}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   658
+		event->adt_print_request_nobanner.request_ID = f_job_ID;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   659
+		event->adt_print_request_nobanner.printer = printer;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   660
+		event->adt_print_request_nobanner.file = file;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   661
+		event->adt_print_request_nobanner.file_attrs = &attributes;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   662
+		event->adt_print_request_nobanner.file_label = file_label;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   663
+		event->adt_print_request_nobanner.override_auth =
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   664
+		    PRINT_NOBANNER_AUTH;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   665
+		break;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   666
+	case ADT_print_request:
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   667
+		if (remote) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   668
+			if (ai->ai_family == AF_INET) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   669
+				event->adt_print_request.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   670
+				    remote_host_ip_type = ADT_IPv4;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   671
+				    
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   672
+				(void) memcpy(event->
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   673
+				    adt_print_request.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   674
+				    remote_host_ipaddress,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   675
+				    &((struct sockaddr_in *)ai->
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   676
+				    ai_addr)->sin_addr,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   677
+				    sizeof (struct in_addr));
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   678
+			} else if (ai->ai_family == AF_INET6) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   679
+				event->adt_print_request.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   680
+				    remote_host_ip_type = ADT_IPv6;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   681
+				    
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   682
+				(void) memcpy(event->
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   683
+				    adt_print_request.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   684
+				    remote_host_ipaddress,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   685
+				    &((struct sockaddr_in6 *)ai->
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   686
+				    ai_addr)->sin6_addr,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   687
+				    sizeof (struct in6_addr));
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   688
+			}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   689
+		}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   690
+		event->adt_print_request.request_ID = f_job_ID;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   691
+		event->adt_print_request.printer = printer;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   692
+		event->adt_print_request.file = file;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   693
+		event->adt_print_request.file_attrs = &attributes;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   694
+		event->adt_print_request.file_label = file_label;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   695
+		break;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   696
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   697
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   698
+	if (adt_put_event(event, status, return_val) != 0) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   699
+		cupsdLogMessage(CUPSD_LOG_EMERG,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   700
+		    "cups_audit_print_request_data():"
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   701
+		    "adt_put_event(): %d", errno);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   702
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   703
+}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   704
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   705
+/*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   706
+ * To populate the audit events, cups_audit_print_request() is called.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   707
+ * cups_audit_print_request() calls cups_audit_print_request_common()
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   708
+ * which in turn calls cups_audit_print_request_sub() which finally
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   709
+ * calls cups_audit_print_request_data().
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   710
+ *
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   711
+ * event_ID		= type of TX-related printing audit record
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   712
+ *			 ADT_print_request_unlabeled
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   713
+ *			 ADT_print_request_nobanner
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   714
+ *			 ADT_print_request 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   715
+ * ah 			= Audit session handle
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   716
+ * printer              = printer name
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   717
+ * job_ID		= request_ID; <printe-name>-<job-id> 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   718
+ * job_id		= job->id; Job identification number.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   719
+ *			 -1 in case of denial request when
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   720
+ *			 a request is denied before job gets created.	
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   721
+ *			 -1 in case of denial request when
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   722
+ *			 a request is denied before job gets created.	
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   723
+ * job_ID_remote	= remote request_ID; <printe-name>-<remote-job_id>
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   724
+ *			 local job_id and remote job_id are different
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   725
+ * job_state		= ipp_jstate_t enum:
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   726
+ *	IPP_JOB_PENDING = 3,	Job is waiting to be printed
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   727
+ *	IPP_JOB_HELD,		Job is held for printing
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   728
+ * 	IPP_JOB_PROCESSING,	Job is currently printing
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   729
+ * 	IPP_JOB_STOPPED,	Job has been stopped
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   730
+ * 	IPP_JOB_CANCELED,	Job has been canceled
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   731
+ * 	IPP_JOB_ABORTED,	Job has aborted due to error
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   732
+ * 	IPP_JOB_COMPLETED	Job has completed successfully
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   733
+ *			 current job state 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   734
+ *			 -1 in case of denial request when
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   735
+ *			 a request is denied before job gets created.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   736
+ * job_state_value 	= ipp_jstate_t; cached job state
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   737
+ *			 -1 in case of denial request when
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   738
+ *			 a request is denied before job gets created.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   739
+ * hostname		= name of connected host
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   740
+ * document_list	= list of files to be printed
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   741
+ * job_name		= job title; usually the first filename in filelist
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   742
+ * slabel		= Sensitivity Label 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   743
+ * fail_reason 		= failure reason; EPERM, EACESS
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   744
+ * authorized		= true: user has required autorization to print
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   745
+ *			 false: user is not authorized to print 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   746
+ * num_files		= 0 for initial MAC/DAC
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   747
+ *			 1 - 999 for number of files printed in a job.       
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   748
+ * wants_nobanner	= true: user does not want to print banner and trailer page
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   749
+ *			 false: user wants to print banner and trailer page 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   750
+ */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   751
+static void
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   752
+cups_audit_print_request_sub(au_event_t event_ID, adt_session_data_t *ah,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   753
+    char *printer, char *job_ID, int job_id, char *job_ID_remote,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   754
+    ipp_jstate_t job_state, ipp_jstate_t job_state_value, char *hostname,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   755
+    char *document_list, char *job_name, char *slabel, int fail_reason,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   756
+    int authorized, int num_files, boolean_t wants_nobanner)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   757
+{
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   758
+	adt_event_data_t	*event;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   759
+	char			*dlist, *filelist;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   760
+	int			status, return_val;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   761
+	struct addrinfo		*ai = NULL;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   762
+	boolean_t		remote = B_FALSE;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   763
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   764
+	if ((event = adt_alloc_event(ah, event_ID)) == NULL) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   765
+		cupsdLogMessage(CUPSD_LOG_EMERG,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   766
+		    "cups_audit_print_request_sub():"
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   767
+		    "adt_alloc_event(): %d", errno);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   768
+		return;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   769
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   770
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   771
+	if ((job_id == -1) && (job_state == -1) && (job_state_value == -1)) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   772
+		status = ADT_FAILURE;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   773
+		return_val = fail_reason;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   774
+	} else {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   775
+		if (authorized != 1) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   776
+			status = ADT_FAILURE;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   777
+			return_val = ADT_FAIL_VALUE_AUTH;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   778
+		} else {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   779
+			if (job_state == IPP_JOB_COMPLETED) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   780
+				status = ADT_SUCCESS;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   781
+				return_val = ADT_SUCCESS;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   782
+			} else {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   783
+				status = ADT_FAILURE;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   784
+				if ((fail_reason == 0) &&
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   785
+				    (job_state_value == IPP_JOB_CANCELED)) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   786
+					return_val =
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   787
+					    ADT_FAIL_VALUE_PRINT_JOB_CANCELLED;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   788
+				} else if (fail_reason == 0) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   789
+					return_val =
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   790
+					    ADT_FAIL_VALUE_PRINT_JOB_FAILED;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   791
+				} else {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   792
+					return_val = fail_reason;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   793
+				}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   794
+			}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   795
+		}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   796
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   797
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   798
+	if (hostname != NULL) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   799
+		int err;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   800
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   801
+		cupsdLogMessage(CUPSD_LOG_DEBUG,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   802
+		    "cups_audit_print_request_sub():"
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   803
+		    "host = %s", hostname);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   804
+		if ((err = getaddrinfo(hostname,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   805
+		    NULL, NULL, &ai)) != 0) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   806
+			cupsdLogMessage(CUPSD_LOG_ERROR,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   807
+			    "cups_audit_print_request_sub():"
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   808
+			    "getaddrinfo(%s) failed[%s]",
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   809
+			    hostname, gai_strerror(err));
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   810
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   811
+		}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   812
+		if (strcasecmp(hostname, "localhost") != 0) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   813
+			remote = B_TRUE;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   814
+		}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   815
+	} else {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   816
+		cupsdLogMessage(CUPSD_LOG_DEBUG,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   817
+		    "cups_audit_print_request_sub():"
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   818
+		    "host is NULL");
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   819
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   820
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   821
+	if (document_list == NULL) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   822
+		dlist = job_name;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   823
+	} else {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   824
+		dlist = document_list;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   825
+		cupsdLogMessage(CUPSD_LOG_DEBUG2,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   826
+		    "cups_audit_print_request_sub():"
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   827
+		    "document-names is %s ", dlist);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   828
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   829
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   830
+	/*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   831
+	 * document-names=f1,f2,f3...
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   832
+	 * extract the files from it.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   833
+	 */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   834
+	if (dlist != NULL) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   835
+		filelist = strtok(dlist, ",");
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   836
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   837
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   838
+	if (remote) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   839
+		/* Remote Request */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   840
+		int i = 1;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   841
+		int max_files = (num_files - 1);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   842
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   843
+		/*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   844
+		 * remote root always sends banner and trailer files
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   845
+		 * to the server. Whereas in case of non-root if
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   846
+		 * nobanner is set it sends only the job file to
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   847
+		 * the server.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   848
+		 */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   849
+		if ((uid != 0) && (gid != 0) && wants_nobanner) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   850
+			i = 0;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   851
+			max_files = num_files;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   852
+		}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   853
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   854
+		for (; i < max_files; i++) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   855
+			cups_audit_print_request_data(event_ID,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   856
+			    event, printer, slabel, job_ID, job_ID_remote,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   857
+			    filelist, ai, status, return_val,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   858
+			    i, job_id, remote);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   859
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   860
+			if (filelist != NULL) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   861
+				filelist = strtok(NULL, ",");
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   862
+			}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   863
+		}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   864
+	} else {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   865
+		/* Local Request */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   866
+		while (filelist != NULL) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   867
+			cups_audit_print_request_data(event_ID,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   868
+			    event, printer, slabel, job_ID, job_ID_remote,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   869
+			    filelist, ai, status, return_val,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   870
+			    0, job_id, remote);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   871
+			filelist = strtok(NULL, ",");
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   872
+		}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   873
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   874
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   875
+	if (ai != NULL) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   876
+		freeaddrinfo(ai);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   877
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   878
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   879
+	adt_free_event(event);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   880
+}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   881
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   882
+/*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   883
+ * To populate the audit events, cups_audit_print_request() is called.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   884
+ * cups_audit_print_request() calls cups_audit_print_request_common()
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   885
+ * which in turns calls cups_audit_print_request_sub() which finally
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   886
+ * calls cups_audit_print_request_data().
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   887
+ *
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   888
+ * ah 			= Audit session handle
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   889
+ * request_ID		= <printer-name>-<job_id>;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   890
+ *			 <printer-name>-none in case of denial request when
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   891
+ *			 a request is denied before job gets created.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   892
+ * job_id		= job->id; Job identification number.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   893
+ *			 -1 in case of denial request when
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   894
+ *			 a request is denied before job gets created.	
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   895
+ * job_state		= ipp_jstate_t enum:
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   896
+ *	IPP_JOB_PENDING = 3,	Job is waiting to be printed
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   897
+ *	IPP_JOB_HELD,		Job is held for printing
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   898
+ * 	IPP_JOB_PROCESSING,	Job is currently printing
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   899
+ * 	IPP_JOB_STOPPED,	Job has been stopped
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   900
+ * 	IPP_JOB_CANCELED,	Job has been canceled
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   901
+ * 	IPP_JOB_ABORTED,	Job has aborted due to error
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   902
+ * 	IPP_JOB_COMPLETED	Job has completed successfully
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   903
+ *			 current job state 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   904
+ *			 -1 in case of denial request when
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   905
+ *			 a request is denied before job gets created.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   906
+ * job_state_value 	= ipp_jstate_t; cached job state
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   907
+ *			 -1 in case of denial request when
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   908
+ *			 a request is denied before job gets created.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   909
+ * ipp 			= ipp_t; Request information
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   910
+ * printer 		= cupsd_printer_t
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   911
+ * slabel 		= Sensitivity Label
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   912
+ * username 		= Username from Authorization
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   913
+ * hname 		= name of connected host
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   914
+ * fail_reason 		= failure reason; EPERM, EACESS
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   915
+ * num_files		= 0 for initial MAC/DAC
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   916
+ *			 1 - 999 for number of files printed in a job.       
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   917
+ * denial_request	= false if cups_audit_print_request()
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   918
+ *			 true if cups_audit_print_request_denial()
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   919
+ */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   920
+static void
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   921
+cups_audit_print_request_common(adt_session_data_t *ah,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   922
+    char *request_ID, int job_id, ipp_jstate_t job_state,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   923
+    ipp_jstate_t job_state_value, ipp_t *ipp, cupsd_printer_t *printer,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   924
+    char *slabel, char *username, char *hname, int fail_reason,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   925
+    int num_files, boolean_t denial_request)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   926
+{
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   927
+	int		authorized = 0;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   928
+	boolean_t	wants_nobanner = B_FALSE;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   929
+	boolean_t	wants_nolabels = B_FALSE;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   930
+	ipp_attribute_t	*attr = NULL;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   931
+	char		*document_list = NULL, *job_name = NULL;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   932
+	char		*hostname = NULL, *job_id_remote = NULL;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   933
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   934
+	/*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   935
+	 * Read 'document-names', 'job-name',
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   936
+	 * 'job-id-remote' and 'job-originating-host-name'
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   937
+	 * from request.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   938
+	 */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   939
+	if ((attr = ippFindAttribute(ipp, "document-names",
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   940
+	    IPP_TAG_NAME)) != NULL) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   941
+		document_list = attr->values[0].string.text;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   942
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   943
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   944
+	if ((attr = ippFindAttribute(ipp, "job-name", IPP_TAG_NAME)) != NULL) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   945
+		job_name = attr->values[0].string.text;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   946
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   947
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   948
+	/* If input hostname is NULL, then read hostname from job */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   949
+	if (hname == NULL) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   950
+		if ((attr = ippFindAttribute(ipp, "job-originating-host-name",
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   951
+		    IPP_TAG_NAME)) != NULL) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   952
+			hostname = attr->values[0].string.text;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   953
+		}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   954
+	} else {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   955
+		hostname = hname;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   956
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   957
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   958
+	if ((attr = ippFindAttribute(ipp, "job-id-remote",
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   959
+	    IPP_TAG_NAME)) != NULL) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   960
+		job_id_remote = attr->values[0].string.text;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   961
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   962
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   963
+	/*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   964
+	 * '-o job-sheets=none,none' means
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   965
+	 * user does not want to print banner and trailer page.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   966
+	 * In trusted system, '-o job-sheets=none' and '-o job-sheets=none,none'
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   967
+	 * means same.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   968
+	 */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   969
+	if ((attr = ippFindAttribute(ipp, "job-sheets",
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   970
+	    IPP_TAG_ZERO)) != NULL) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   971
+		if (strcmp(attr->values[0].string.text, "none") == 0) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   972
+			wants_nobanner = B_TRUE;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   973
+		}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   974
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   975
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   976
+	if (wants_nobanner) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   977
+		authorized = chkauthattr(PRINT_NOBANNER_AUTH, username);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   978
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   979
+		/*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   980
+		 * In case of normal print request
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   981
+		 * fail_reason is based on authorized.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   982
+		 */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   983
+		if (!denial_request) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   984
+			if (authorized) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   985
+				fail_reason = 0;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   986
+			} else {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   987
+				fail_reason = ADT_FAIL_VALUE_AUTH;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   988
+			}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   989
+		}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   990
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   991
+		cups_audit_print_request_sub(
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   992
+		    ADT_print_request_nobanner, ah, printer->name,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   993
+		    request_ID, job_id, job_id_remote, job_state,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   994
+		    job_state_value, hostname, document_list,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   995
+		    job_name, slabel, fail_reason,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   996
+		    authorized, num_files, wants_nobanner);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   997
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   998
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
   999
+	/* chk for 'nolabels' in request */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1000
+	if (ippFindAttribute(ipp, "labels", IPP_TAG_ZERO) != NULL) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1001
+		wants_nolabels = B_TRUE;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1002
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1003
+		authorized = chkauthattr(PRINT_UNLABELED_AUTH, username);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1004
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1005
+		/*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1006
+		 * In case of normal print request
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1007
+		 * fail_reason is based on authorized.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1008
+		 */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1009
+		if (!denial_request) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1010
+			if (authorized) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1011
+				fail_reason = 0;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1012
+			} else {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1013
+				fail_reason = ADT_FAIL_VALUE_AUTH;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1014
+			}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1015
+		}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1016
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1017
+		cups_audit_print_request_sub(
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1018
+		    ADT_print_request_unlabeled, ah, printer->name,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1019
+		    request_ID, job_id, job_id_remote, job_state,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1020
+		    job_state_value, hostname, document_list,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1021
+		    job_name, slabel, fail_reason,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1022
+		    authorized, num_files, wants_nobanner);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1023
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1024
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1025
+	if (!wants_nolabels && !wants_nobanner) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1026
+		/*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1027
+		 * In case of normal print request
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1028
+		 * fail_reason is based on authorized.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1029
+		 */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1030
+		if (!denial_request) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1031
+			fail_reason = 0;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1032
+		}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1033
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1034
+		cups_audit_print_request_sub(
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1035
+		    ADT_print_request, ah, printer->name,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1036
+		    request_ID, job_id, job_id_remote, job_state,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1037
+		    job_state_value, hostname, document_list,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1038
+		    job_name, slabel, fail_reason,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1039
+		    1, num_files, wants_nobanner);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1040
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1041
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1042
+	(void) adt_end_session(ah);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1043
+}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1044
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1045
+/*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1046
+ * Routine for auditing print requests which have been validated.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1047
+ * This means user has all of the required authorizations, the
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1048
+ * ability to print to the designated printer and the printer is
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1049
+ * within the user's label range.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1050
+ *
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1051
+ * cupsd_job_[s]t int id			Job ID
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1052
+ *		ipp_jstate_t state_value	Cached job-state
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1053
+ *		char *slabel			Sensitivity Label
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1054
+ *		adt_session_data *ah		Audit session handle
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1055
+ *		char *username			Printing user
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1056
+ *		int num_files			Number of files in job
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1057
+ *		ipp_t *attrs			Job attributes
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1058
+ *			place to get attributes of job such as
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1059
+ *			document-names, job-name, job-originating-host-name,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1060
+ *			job-id-remote, job-sheets, labels
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1061
+ *		cupsd_printer_t *printer	Printer this job is assigned to
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1062
+ *			char *name	Printer name
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1063
+ */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1064
+void
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1065
+cups_audit_print_request(cupsd_job_t *job, ipp_jstate_t job_state)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1066
+{
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1067
+	char	request_ID[REQ_MAX_NAME];
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1068
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1069
+	snprintf(request_ID, sizeof (request_ID), "%s-%d",
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1070
+	    job->printer->name, job->id);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1071
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1072
+	cups_audit_print_request_common(job->ah, request_ID,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1073
+	    job->id, job_state, job->state_value, job->attrs,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1074
+	    job->printer, job->slabel, job->username, NULL, 0,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1075
+	    job->num_files, B_FALSE);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1076
+}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1077
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1078
+/*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1079
+ * Routine for auditing print request which have been denied due
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1080
+ * to lack of authorization or the printer access list is configured
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1081
+ * to deny access to the user.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1082
+ * 'fail_reason' will be either EPERM or EACCES based on DAC or MAC
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1083
+ * failure resp.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1084
+ *
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1085
+ * cupsd_client_[s]t
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1086
+ *	adt_session_data_t	*ah	Audit session handle
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1087
+ *	ipp_t	*request	IPP request information
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1088
+ *		appears equivalent to job->attrs above.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1089
+ *	char	*slabel		Sesnitivity Label
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1090
+ *	char	*username	Username from Authorization
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1091
+ *	http_t	http		HTTP client connection
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1092
+ *	char    *hostname	name of connected host
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1093
+ *
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1094
+ */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1095
+void
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1096
+cups_audit_print_request_denial(cupsd_client_t *con, cupsd_job_t *job,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1097
+    cupsd_printer_t *printer, ipp_jstate_t job_state, int fail_reason)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1098
+{
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1099
+	char request_ID[REQ_MAX_NAME];
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1100
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1101
+	/*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1102
+	 * If connection is not NULL, audit based on connection and
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1103
+	 * not job.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1104
+	 */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1105
+	if (con != NULL) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1106
+		sprintf(request_ID, "%s-none", printer->name);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1107
+		cups_audit_print_request_common(con->ah, request_ID,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1108
+		    -1, -1, -1, con->request, printer, con->slabel,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1109
+		    con->username, con->http.hostname, fail_reason, 0, B_TRUE);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1110
+	} else {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1111
+		sprintf(request_ID, "%s-%d", job->printer->name, job->id);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1112
+		cups_audit_print_request_common(job->ah, request_ID,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1113
+		    job->id, job_state, job->state_value, job->attrs,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1114
+		    printer, job->slabel, job->username, NULL, fail_reason,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1115
+		    job->num_files, B_TRUE);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1116
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1117
+}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1118
--- scheduler/Makefile	Wed Jan  2 23:21:35 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1119
+++ scheduler/Makefile	Wed Jan  2 21:46:49 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1120
@@ -16,6 +16,7 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1121
 include ../Makedefs
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1122
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1123
 CUPSDOBJS =	\
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1124
+		audit.o \
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1125
 		auth.o \
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1126
 		banners.o \
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1127
 		cert.o \
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1128
--- backend/ipp.c	Thu Jan 14 14:40:19 2010
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1129
+++ backend/ipp.c	Wed Jan  2 21:46:02 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1130
@@ -893,6 +893,15 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1131
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1132
         	 NULL, uri);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1133
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1134
+#if defined(HAVE_TSOL)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1135
+    if (is_system_labeled() != 0) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1136
+      /* Keep a track of the remote job-id */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1137
+      if (argv[1][0])
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1138
+	ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1139
+		     "job-id-remote", NULL, argv[1]);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1140
+    }
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1141
+#endif /* HAVE_TSOL */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1142
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1143
     fprintf(stderr, "DEBUG: printer-uri = \"%s\"\n", uri);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1144
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1145
     if (argv[2][0])
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1146
--- cups/util.c	Thu Jan  3 00:07:27 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1147
+++ cups/util.c	Thu Jan  3 02:00:02 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1148
@@ -220,8 +220,11 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1149
 		*response;		/* Create-Job response */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1150
   ipp_attribute_t *attr;		/* job-id attribute */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1151
   int		job_id = 0;		/* job-id value */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1152
+#if defined(HAVE_TSOL)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1153
+  const char	*filelist;		/* list of input files */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1154
+  const char	uid[11], gid[11];	/* user id and group id */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1155
+#endif /* HAVE_TSOL */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1156
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1157
-
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1158
   DEBUG_printf(("cupsCreateJob(http=%p, name=\"%s\", title=\"%s\", "
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1159
                 "num_options=%d, options=%p)",
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1160
                 http, name, title, num_options, options));
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1161
@@ -257,6 +260,28 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1162
   if (title)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1163
     ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", NULL,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1164
                  title);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1165
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1166
+#if defined(HAVE_TSOL)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1167
+  if (is_system_labeled() != 0) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1168
+    if ((filelist = cupsGetOption("filelist", num_options, options)) != NULL)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1169
+      ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "document-names",
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1170
+                   NULL, filelist);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1171
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1172
+     /* Add userID and groupID of the user who submitted the request */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1173
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1174
+     /*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1175
+      * When uid and gid are added to the attributes using ippAddInteger,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1176
+      * ippFindAttribute from the scheduler is not able to read the attribute,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1177
+      * so using ippAddString to add uid and gid.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1178
+      */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1179
+    snprintf(uid, sizeof(uid), "%d", getuid());
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1180
+    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "userID", NULL, uid);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1181
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1182
+    snprintf(gid, sizeof(gid), "%d", getgid());
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1183
+    ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "groupID", NULL, gid);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1184
+  }
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1185
+#endif /* HAVE_TSOL */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1186
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1187
   cupsEncodeOptions(request, num_options, options);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1188
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1189
  /*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1190
@@ -1462,8 +1487,12 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1191
   _cups_globals_t *cg = _cupsGlobals();	/* Global data */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1192
   ipp_status_t	cancel_status;		/* Status code to preserve */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1193
   char		*cancel_message;	/* Error message to preserve */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1194
+#if defined(HAVE_TSOL)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1195
+  int		listlen = 0;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1196
+  char		*filelist;		/* file list */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1197
+  char		resolved_path[PATH_MAX];
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1198
+#endif /* HAVE_TSOL */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1199
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1200
-
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1201
   DEBUG_printf(("cupsPrintFiles2(http=%p, name=\"%s\", num_files=%d, "
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1202
                 "files=%p, title=\"%s\", num_options=%d, options=%p)",
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1203
                 http, name, num_files, files, title, num_options, options));
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1204
@@ -1479,6 +1508,56 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1205
     return (0);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1206
   }
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1207
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1208
+#if defined(HAVE_TSOL)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1209
+  if (is_system_labeled() != 0) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1210
+    /*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1211
+     * Read the list of files and add to options.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1212
+     * In options it will be stored like 'filelist=f1,f2,f3'
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1213
+     */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1214
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1215
+    /*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1216
+     * Maximum number of files to be printed should not be
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1217
+     * more than 1000.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1218
+     */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1219
+    if (num_files > 1000)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1220
+        num_files = 1000;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1221
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1222
+    for(i=0; i<num_files; i++) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1223
+      if (realpath(files[i], resolved_path) != NULL) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1224
+        listlen = listlen + strlen(resolved_path);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1225
+      } else
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1226
+        listlen = listlen + strlen(files[i]);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1227
+    }
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1228
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1229
+    /*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1230
+     * Add num_files to listlen to make room for ','
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1231
+     * and NULL terminated string.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1232
+     */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1233
+    listlen = listlen + num_files;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1234
+    filelist = malloc(listlen);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1235
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1236
+    if (filelist != NULL) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1237
+      if (realpath(files[0], resolved_path) != NULL)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1238
+          strlcpy(filelist, resolved_path, listlen);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1239
+      else
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1240
+          strlcpy(filelist, files[0], listlen);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1241
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1242
+      for (i=1; i<num_files; i++)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1243
+      {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1244
+          strlcat(filelist, ",", listlen);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1245
+          if (realpath(files[i], resolved_path) != NULL)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1246
+            strlcat(filelist, resolved_path, listlen);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1247
+          else
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1248
+            strlcat(filelist, files[i], listlen);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1249
+      }
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1250
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1251
+      num_options = cupsAddOption("filelist", filelist, num_options, &options);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1252
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1253
+      free(filelist);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1254
+    }
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1255
+  }
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1256
+#endif /* HAVE_TSOL */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1257
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1258
  /*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1259
   * Create the print job...
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
  1260
   */