author | Rich Burridge <rich.burridge@oracle.com> |
Fri, 06 Feb 2015 12:30:31 -0800 | |
changeset 3744 | a74b6fa1af7a |
parent 1097 | 6ab0c0792118 |
permissions | -rw-r--r-- |
1097
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
3 |
@@ -42,6 +42,7 @@ |
6ab0c0792118
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) |
6ab0c0792118
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) |
6ab0c0792118
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) |
6ab0c0792118
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) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
8 |
|
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
9 |
INSTALL_LANGUAGES="" |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
10 |
UNINSTALL_LANGUAGES="" |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
13 |
@@ -0,0 +1,35 @@ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
14 |
+dnl |
6ab0c0792118
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). |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
16 |
+dnl |
6ab0c0792118
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. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
18 |
+dnl |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
22 |
+dnl |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
27 |
+dnl |
6ab0c0792118
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 |
6ab0c0792118
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, |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
31 |
+dnl |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
32 |
+ |
6ab0c0792118
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]) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
34 |
+ |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
36 |
+ case "$uname" in |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
37 |
+ SunOS) |
6ab0c0792118
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, |
6ab0c0792118
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) |
6ab0c0792118
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) |
6ab0c0792118
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) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
42 |
+ AC_DEFINE(HAVE_ADT)]) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
43 |
+ ;; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
44 |
+ *) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
45 |
+ # All others |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
46 |
+ ;; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
47 |
+ esac |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
48 |
+fi |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
51 |
@@ -672,6 +672,11 @@ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
52 |
#undef HAVE_TSOL |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
53 |
|
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
54 |
/* |
6ab0c0792118
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 ? |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
56 |
+ */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
57 |
+#undef HAVE_ADT |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
58 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
59 |
+/* |
6ab0c0792118
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? |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
61 |
*/ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
62 |
#undef HAVE_SELINUX |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
65 |
@@ -125,7 +125,7 @@ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
66 |
BANNERTOPS = @BANNERTOPS@ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
67 |
CFLAGS = @CPPFLAGS@ @CFLAGS@ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
68 |
COMMONLIBS = @LIBS@ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
69 |
-CUPSDLIBS = @CUPSDLIBS@ @LABELING_LIBS@ |
6ab0c0792118
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@ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
71 |
CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
72 |
CXXLIBS = @CXXLIBS@ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
73 |
DBUS_NOTIFIER = @DBUS_NOTIFIER@ |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
76 |
@@ -17,6 +17,9 @@ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
77 |
# include <Security/Authorization.h> |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
78 |
#endif /* HAVE_AUTHORIZATION_H */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
79 |
|
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
80 |
+#ifdef HAVE_ADT |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
81 |
+#include <bsm/adt.h> |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
82 |
+#endif /* HAVE_ADT */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
83 |
|
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
84 |
/* |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
85 |
* HTTP client structure... |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
86 |
@@ -64,8 +67,13 @@ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
87 |
#ifdef HAVE_AUTHORIZATION_H |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
88 |
AuthorizationRef authref; /* Authorization ref */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
89 |
#endif /* HAVE_AUTHORIZATION_H */ |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
91 |
+#ifdef HAVE_TSOL |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
93 |
labeled environments */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
94 |
+#endif /* HAVE_TSOL */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
95 |
+#ifdef HAVE_ADT |
6ab0c0792118
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 */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
97 |
+#endif /* HAVE_ADT */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
98 |
}; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
99 |
|
6ab0c0792118
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) |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
103 |
@@ -13,6 +13,10 @@ |
6ab0c0792118
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/". |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
105 |
*/ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
106 |
|
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
107 |
+#ifdef HAVE_ADT |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
108 |
+#include <bsm/adt.h> |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
109 |
+#endif /* HAVE_ADT */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
110 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
111 |
/* |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
112 |
* Constants... |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
113 |
*/ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
114 |
@@ -83,8 +87,13 @@ |
6ab0c0792118
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 */ |
6ab0c0792118
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 */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
117 |
#endif /* HAVE_GSSAPI */ |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
119 |
+#ifdef HAVE_TSOL |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
121 |
labeled environments */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
122 |
+#endif /* HAVE_TSOL */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
123 |
+#ifdef HAVE_ADT |
6ab0c0792118
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 */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
125 |
+#endif /* HAVE_ADT */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
126 |
}; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
127 |
|
6ab0c0792118
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 ****/ |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
131 |
@@ -1425,12 +1425,20 @@ |
6ab0c0792118
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 */ |
6ab0c0792118
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 */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
134 |
|
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
135 |
- |
6ab0c0792118
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))", |
6ab0c0792118
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, |
6ab0c0792118
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", |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
139 |
filetype ? filetype->type : "none"); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
140 |
|
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
141 |
+#if defined(HAVE_TSOL) |
6ab0c0792118
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 */ |
6ab0c0792118
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) { |
6ab0c0792118
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" |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
145 |
+ " for connection"); |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
147 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
148 |
+#endif /* HAVE_TSOL */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
149 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
150 |
/* |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
152 |
* printing on the printer. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
153 |
@@ -1437,6 +1445,11 @@ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
154 |
*/ |
6ab0c0792118
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) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
156 |
{ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
157 |
+#if defined(HAVE_TSOL) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
158 |
+ /* Audit the print request */ |
6ab0c0792118
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) |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
161 |
+#endif /* HAVE_TSOL */ |
6ab0c0792118
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.")); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
163 |
return (NULL); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
164 |
} |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
165 |
@@ -1450,6 +1463,12 @@ |
6ab0c0792118
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") && |
6ab0c0792118
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)) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
168 |
{ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
169 |
+#if defined(HAVE_TSOL) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
170 |
+ /* Audit the print request */ |
6ab0c0792118
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) |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
173 |
+#endif /* HAVE_TSOL */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
174 |
+ |
6ab0c0792118
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, |
6ab0c0792118
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!")); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
177 |
return (NULL); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
178 |
@@ -1463,6 +1482,11 @@ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
179 |
|
6ab0c0792118
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) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
181 |
{ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
182 |
+#if defined(HAVE_TSOL) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
183 |
+ /* Audit the print request */ |
6ab0c0792118
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) |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
186 |
+#endif /* HAVE_TSOL */ |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
188 |
return (NULL); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
189 |
} |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
190 |
@@ -1714,6 +1738,21 @@ |
6ab0c0792118
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)); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
192 |
} |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
193 |
|
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
194 |
+#if defined(HAVE_TSOL) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
195 |
+ /* |
6ab0c0792118
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. |
6ab0c0792118
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. |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
203 |
+ */ |
6ab0c0792118
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) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
205 |
+ job->ah = con->ah; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
206 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
207 |
+#endif /* HAVE_TSOL */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
208 |
+ |
6ab0c0792118
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 | |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
210 |
CUPS_PRINTER_REMOTE); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
211 |
job->attrs = con->request; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
212 |
@@ -1851,6 +1890,7 @@ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
213 |
*/ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
214 |
|
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
216 |
+ |
6ab0c0792118
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, |
6ab0c0792118
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); |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
220 |
@@ -4081,6 +4121,11 @@ |
6ab0c0792118
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, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
222 |
NULL)) != HTTP_OK) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
223 |
{ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
224 |
+#if defined(HAVE_TSOL) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
225 |
+ /* Audit the print request */ |
6ab0c0792118
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) |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
228 |
+#endif /* HAVE_TSOL */ |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
230 |
return; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
231 |
} |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
234 |
@@ -75,6 +75,9 @@ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
235 |
#include <cups/backend.h> |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
236 |
#include <cups/dir.h> |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
237 |
|
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
238 |
+#if defined(HAVE_TSOL) |
6ab0c0792118
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> |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
240 |
+#endif /* HAVE_TSOL */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
241 |
|
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
242 |
/* |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
244 |
@@ -2712,6 +2715,9 @@ |
6ab0c0792118
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 */ |
6ab0c0792118
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 */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
247 |
|
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
248 |
+#if defined(HAVE_TSOL) |
6ab0c0792118
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 */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
250 |
+#endif /* HAVE_TSOL */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
251 |
|
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
253 |
|
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
254 |
@@ -2986,6 +2992,13 @@ |
6ab0c0792118
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."; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
256 |
} |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
257 |
} |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
258 |
+#if defined(HAVE_TSOL) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
259 |
+ /* Audit the print request. */ |
6ab0c0792118
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) { |
6ab0c0792118
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)"); |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
263 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
264 |
+#endif /* HAVE_TSOL */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
265 |
|
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
266 |
/* |
6ab0c0792118
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. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
268 |
@@ -4037,6 +4050,12 @@ |
6ab0c0792118
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"); |
6ab0c0792118
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, |
6ab0c0792118
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"); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
272 |
+#if defined(HAVE_TSOL) |
6ab0c0792118
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) |
6ab0c0792118
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, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
275 |
+ job->state_value, EACCES); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
276 |
+#endif /*HAVE_TSOL */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
277 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
278 |
cupsdCheckJobs(); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
279 |
return; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
280 |
} |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
281 |
@@ -4586,7 +4605,6 @@ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
282 |
/* |
6ab0c0792118
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... |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
284 |
*/ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
285 |
- |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
286 |
finalize_job(job, 1); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
287 |
|
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
288 |
/* |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
291 |
@@ -348,8 +348,11 @@ |
6ab0c0792118
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 */ |
6ab0c0792118
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 */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
294 |
int id; /* Job ID */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
295 |
+#if defined(HAVE_TSOL) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
296 |
+ char *hostname; |
6ab0c0792118
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 */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
298 |
+#endif /* HAVE_TSOL */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
299 |
|
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
300 |
- |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
301 |
/* |
6ab0c0792118
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... |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
303 |
*/ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
304 |
@@ -373,6 +376,29 @@ |
6ab0c0792118
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", |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
306 |
NULL, docname); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
307 |
|
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
308 |
+#if defined(HAVE_TSOL) |
6ab0c0792118
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) { |
6ab0c0792118
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 */ |
6ab0c0792118
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, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
312 |
+ options)) != NULL) |
6ab0c0792118
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, |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
315 |
+ |
6ab0c0792118
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 */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
317 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
318 |
+ /* |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
322 |
+ */ |
6ab0c0792118
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()); |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
325 |
+ |
6ab0c0792118
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()); |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
328 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
329 |
+#endif /* HAVE_TSOL */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
330 |
+ |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
332 |
|
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
333 |
/* |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
336 |
@@ -0,0 +1,781 @@ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
337 |
+/* |
6ab0c0792118
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. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
339 |
+ */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
340 |
+/* |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
344 |
+ * |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
349 |
+ * |
6ab0c0792118
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 |
6ab0c0792118
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, |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
353 |
+ */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
354 |
+#include <syslog.h> |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
355 |
+#include "cupsd.h" |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
356 |
+#include <bsm/adt.h> |
6ab0c0792118
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> |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
358 |
+#include <auth_attr.h> |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
359 |
+ |
6ab0c0792118
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" |
6ab0c0792118
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" |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
362 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
363 |
+/* |
6ab0c0792118
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: |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
365 |
+ * <printer-name>-<job-id> |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
367 |
+ */ |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
369 |
+ |
6ab0c0792118
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; |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
372 |
+ |
6ab0c0792118
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); |
6ab0c0792118
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, |
6ab0c0792118
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); |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
377 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
378 |
+/* |
6ab0c0792118
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. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
380 |
+ */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
381 |
+void |
6ab0c0792118
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) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
383 |
+{ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
384 |
+ |
6ab0c0792118
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) { |
6ab0c0792118
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(): " |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
388 |
+ con->ah = NULL; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
389 |
+ return; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
390 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
391 |
+ |
6ab0c0792118
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) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
393 |
+ /* Local Request */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
394 |
+ ucred_t *cred = NULL; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
395 |
+ |
6ab0c0792118
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) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
397 |
+ cupsdLogMessage(CUPSD_LOG_EMERG, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
398 |
+ "cups_audit_start_session(): " |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
399 |
+ "getpeerucred(): %d", errno); |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
401 |
+ con->ah = NULL; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
402 |
+ return; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
403 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
404 |
+ |
6ab0c0792118
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) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
406 |
+ cupsdLogMessage(CUPSD_LOG_EMERG, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
407 |
+ "cups_audit_start_session(): " |
6ab0c0792118
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); |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
410 |
+ con->ah = NULL; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
411 |
+ return; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
412 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
413 |
+ } else { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
414 |
+ /* Remote Request */ |
6ab0c0792118
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; |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
417 |
+ |
6ab0c0792118
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", |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
419 |
+ IPP_TAG_NAME)) != NULL) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
420 |
+ cupsdLogMessage(CUPSD_LOG_DEBUG, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
421 |
+ "cups_audit_start_session():" |
6ab0c0792118
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); |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
424 |
+ } else { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
425 |
+ cupsdLogMessage(CUPSD_LOG_DEBUG, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
426 |
+ "cups_audit_start_session():" |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
427 |
+ "userID = NULL"); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
428 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
429 |
+ |
6ab0c0792118
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", |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
431 |
+ IPP_TAG_NAME)) != NULL) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
432 |
+ cupsdLogMessage(CUPSD_LOG_DEBUG, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
433 |
+ "cups_audit_start_session():" |
6ab0c0792118
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); |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
436 |
+ } else { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
437 |
+ cupsdLogMessage(CUPSD_LOG_DEBUG, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
438 |
+ "cups_audit_start_session():" |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
439 |
+ "grpID = NULL"); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
440 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
441 |
+ |
6ab0c0792118
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) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
443 |
+ cupsdLogMessage(CUPSD_LOG_ERROR, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
444 |
+ "cups_audit_start_session(): " |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
446 |
+ } |
6ab0c0792118
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, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
448 |
+ ADT_NEW) != 0) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
449 |
+ cupsdLogMessage(CUPSD_LOG_EMERG, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
450 |
+ "cups_audit_start_session(): " |
6ab0c0792118
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); |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
453 |
+ con->ah = NULL; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
454 |
+ free(termid); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
455 |
+ return; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
456 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
457 |
+ free(termid); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
458 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
459 |
+} |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
460 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
461 |
+/* |
6ab0c0792118
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 |
6ab0c0792118
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: |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
472 |
+ * |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
474 |
+ * event = audit event structure |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
475 |
+ * printer = printer name |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
476 |
+ * slabel = Sensitivity Label |
6ab0c0792118
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> |
6ab0c0792118
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> |
6ab0c0792118
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 |
6ab0c0792118
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; |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
483 |
+ * ai = struct addrinfo; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
484 |
+ * status = audit request status; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
485 |
+ * ADT_FAILURE, ADT_SUCCESS |
6ab0c0792118
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; |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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: |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
499 |
+ * remote = true: remote request |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
500 |
+ * false: local request |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
501 |
+ */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
502 |
+static void |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
508 |
+{ |
6ab0c0792118
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]; |
6ab0c0792118
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]; |
6ab0c0792118
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]; |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
513 |
+ struct stat attributes; |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
515 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
516 |
+ /* |
6ab0c0792118
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 |
6ab0c0792118
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/ |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
520 |
+ * via standard input. |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
528 |
+ */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
529 |
+ if (remote) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
530 |
+ /* |
6ab0c0792118
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: |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
534 |
+ */ |
6ab0c0792118
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", |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
537 |
+ /* |
6ab0c0792118
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, |
6ab0c0792118
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: |
6ab0c0792118
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 | |
6ab0c0792118
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>' |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
542 |
+ */ |
6ab0c0792118
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) { |
6ab0c0792118
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), |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
545 |
+ "Local JOB_ID: %s |" |
6ab0c0792118
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", |
6ab0c0792118
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); |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
549 |
+ } else { |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
551 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
552 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
553 |
+ } else { |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
555 |
+ if (job_id != -1) { |
6ab0c0792118
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) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
557 |
+ snprintf(tmpfile, sizeof (tmpfile), |
6ab0c0792118
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, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
559 |
+ job_id, i + 1); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
560 |
+ } else { |
6ab0c0792118
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)); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
562 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
563 |
+ } else { |
6ab0c0792118
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)); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
565 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
566 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
567 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
568 |
+ file = tmpfile; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
569 |
+ |
6ab0c0792118
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) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
571 |
+ cupsdLogMessage(CUPSD_LOG_ERROR, |
6ab0c0792118
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():" |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
573 |
+ "stat(): %d", errno); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
574 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
575 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
576 |
+ /* |
6ab0c0792118
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. |
6ab0c0792118
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. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
579 |
+ */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
580 |
+ if (remote && (filelist != NULL)) { |
6ab0c0792118
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)); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
582 |
+ strcat(tfile, tmpfile); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
583 |
+ strcat(tfile, " | Remote file: "); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
584 |
+ strcat(tfile, filelist); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
585 |
+ file = tfile; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
586 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
587 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
588 |
+ /* extract label from slabel */ |
6ab0c0792118
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, |
6ab0c0792118
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) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
591 |
+ cupsdLogMessage(CUPSD_LOG_DEBUG2, |
6ab0c0792118
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():" |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
593 |
+ "file_label extracted"); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
594 |
+ } else { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
595 |
+ cupsdLogMessage(CUPSD_LOG_ERROR, |
6ab0c0792118
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():" |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
597 |
+ "file_label not extracted"); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
598 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
599 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
600 |
+ /* Populate audit event structure */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
601 |
+ switch (event_ID) { |
6ab0c0792118
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: |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
603 |
+ if (remote) { |
6ab0c0792118
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) { |
6ab0c0792118
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. |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
607 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
608 |
+ (void) memcpy(event-> |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
609 |
+ adt_print_request_unlabeled. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
610 |
+ remote_host_ipaddress, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
611 |
+ &((struct sockaddr_in *)ai-> |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
612 |
+ ai_addr)->sin_addr, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
613 |
+ sizeof (struct in_addr)); |
6ab0c0792118
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) { |
6ab0c0792118
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. |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
617 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
618 |
+ (void) memcpy(event-> |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
619 |
+ adt_print_request_unlabeled. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
620 |
+ remote_host_ipaddress, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
621 |
+ &((struct sockaddr_in6 *)ai-> |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
622 |
+ ai_addr)->sin6_addr, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
623 |
+ sizeof (struct in6_addr)); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
624 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
625 |
+ } |
6ab0c0792118
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; |
6ab0c0792118
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; |
6ab0c0792118
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; |
6ab0c0792118
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; |
6ab0c0792118
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; |
6ab0c0792118
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 = |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
632 |
+ PRINT_UNLABELED_AUTH; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
633 |
+ break; |
6ab0c0792118
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: |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
635 |
+ if (remote) { |
6ab0c0792118
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) { |
6ab0c0792118
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. |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
639 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
640 |
+ (void) memcpy(event-> |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
641 |
+ adt_print_request_nobanner. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
642 |
+ remote_host_ipaddress, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
643 |
+ &((struct sockaddr_in *)ai-> |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
644 |
+ ai_addr)->sin_addr, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
645 |
+ sizeof (struct in_addr)); |
6ab0c0792118
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) { |
6ab0c0792118
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. |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
649 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
650 |
+ (void) memcpy(event-> |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
651 |
+ adt_print_request_nobanner. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
652 |
+ remote_host_ipaddress, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
653 |
+ &((struct sockaddr_in6 *)ai-> |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
654 |
+ ai_addr)->sin6_addr, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
655 |
+ sizeof (struct in6_addr)); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
656 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
657 |
+ } |
6ab0c0792118
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; |
6ab0c0792118
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; |
6ab0c0792118
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; |
6ab0c0792118
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; |
6ab0c0792118
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; |
6ab0c0792118
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 = |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
664 |
+ PRINT_NOBANNER_AUTH; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
665 |
+ break; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
666 |
+ case ADT_print_request: |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
667 |
+ if (remote) { |
6ab0c0792118
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) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
669 |
+ event->adt_print_request. |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
671 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
672 |
+ (void) memcpy(event-> |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
673 |
+ adt_print_request. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
674 |
+ remote_host_ipaddress, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
675 |
+ &((struct sockaddr_in *)ai-> |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
676 |
+ ai_addr)->sin_addr, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
677 |
+ sizeof (struct in_addr)); |
6ab0c0792118
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) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
679 |
+ event->adt_print_request. |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
681 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
682 |
+ (void) memcpy(event-> |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
683 |
+ adt_print_request. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
684 |
+ remote_host_ipaddress, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
685 |
+ &((struct sockaddr_in6 *)ai-> |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
686 |
+ ai_addr)->sin6_addr, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
687 |
+ sizeof (struct in6_addr)); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
688 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
689 |
+ } |
6ab0c0792118
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; |
6ab0c0792118
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; |
6ab0c0792118
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; |
6ab0c0792118
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; |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
695 |
+ break; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
696 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
697 |
+ |
6ab0c0792118
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) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
699 |
+ cupsdLogMessage(CUPSD_LOG_EMERG, |
6ab0c0792118
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():" |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
702 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
703 |
+} |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
704 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
705 |
+/* |
6ab0c0792118
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. |
6ab0c0792118
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() |
6ab0c0792118
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 |
6ab0c0792118
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(). |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
710 |
+ * |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
712 |
+ * ADT_print_request_unlabeled |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
713 |
+ * ADT_print_request_nobanner |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
714 |
+ * ADT_print_request |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
715 |
+ * ah = Audit session handle |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
716 |
+ * printer = printer name |
6ab0c0792118
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> |
6ab0c0792118
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. |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
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> |
6ab0c0792118
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 |
6ab0c0792118
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: |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
733 |
+ * current job state |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
742 |
+ * slabel = Sensitivity Label |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
750 |
+ */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
751 |
+static void |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
757 |
+{ |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
759 |
+ char *dlist, *filelist; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
760 |
+ int status, return_val; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
761 |
+ struct addrinfo *ai = NULL; |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
763 |
+ |
6ab0c0792118
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) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
765 |
+ cupsdLogMessage(CUPSD_LOG_EMERG, |
6ab0c0792118
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():" |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
768 |
+ return; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
769 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
770 |
+ |
6ab0c0792118
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)) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
772 |
+ status = ADT_FAILURE; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
773 |
+ return_val = fail_reason; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
774 |
+ } else { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
775 |
+ if (authorized != 1) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
776 |
+ status = ADT_FAILURE; |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
778 |
+ } else { |
6ab0c0792118
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) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
780 |
+ status = ADT_SUCCESS; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
781 |
+ return_val = ADT_SUCCESS; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
782 |
+ } else { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
783 |
+ status = ADT_FAILURE; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
784 |
+ if ((fail_reason == 0) && |
6ab0c0792118
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)) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
786 |
+ return_val = |
6ab0c0792118
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; |
6ab0c0792118
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) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
789 |
+ return_val = |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
791 |
+ } else { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
792 |
+ return_val = fail_reason; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
793 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
794 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
795 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
796 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
797 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
798 |
+ if (hostname != NULL) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
799 |
+ int err; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
800 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
801 |
+ cupsdLogMessage(CUPSD_LOG_DEBUG, |
6ab0c0792118
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():" |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
803 |
+ "host = %s", hostname); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
804 |
+ if ((err = getaddrinfo(hostname, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
805 |
+ NULL, NULL, &ai)) != 0) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
806 |
+ cupsdLogMessage(CUPSD_LOG_ERROR, |
6ab0c0792118
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():" |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
808 |
+ "getaddrinfo(%s) failed[%s]", |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
809 |
+ hostname, gai_strerror(err)); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
810 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
811 |
+ } |
6ab0c0792118
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) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
813 |
+ remote = B_TRUE; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
814 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
815 |
+ } else { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
816 |
+ cupsdLogMessage(CUPSD_LOG_DEBUG, |
6ab0c0792118
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():" |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
818 |
+ "host is NULL"); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
819 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
820 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
821 |
+ if (document_list == NULL) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
822 |
+ dlist = job_name; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
823 |
+ } else { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
824 |
+ dlist = document_list; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
825 |
+ cupsdLogMessage(CUPSD_LOG_DEBUG2, |
6ab0c0792118
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():" |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
828 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
829 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
830 |
+ /* |
6ab0c0792118
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... |
6ab0c0792118
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. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
833 |
+ */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
834 |
+ if (dlist != NULL) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
835 |
+ filelist = strtok(dlist, ","); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
836 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
837 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
838 |
+ if (remote) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
839 |
+ /* Remote Request */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
840 |
+ int i = 1; |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
842 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
843 |
+ /* |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
847 |
+ * the server. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
848 |
+ */ |
6ab0c0792118
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) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
850 |
+ i = 0; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
851 |
+ max_files = num_files; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
852 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
853 |
+ |
6ab0c0792118
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++) { |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
858 |
+ i, job_id, remote); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
859 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
860 |
+ if (filelist != NULL) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
861 |
+ filelist = strtok(NULL, ","); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
862 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
863 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
864 |
+ } else { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
865 |
+ /* Local Request */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
866 |
+ while (filelist != NULL) { |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
870 |
+ 0, job_id, remote); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
871 |
+ filelist = strtok(NULL, ","); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
872 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
873 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
874 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
875 |
+ if (ai != NULL) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
876 |
+ freeaddrinfo(ai); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
877 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
878 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
879 |
+ adt_free_event(event); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
880 |
+} |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
881 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
882 |
+/* |
6ab0c0792118
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. |
6ab0c0792118
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() |
6ab0c0792118
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 |
6ab0c0792118
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(). |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
887 |
+ * |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
888 |
+ * ah = Audit session handle |
6ab0c0792118
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>; |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
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. |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
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: |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
903 |
+ * current job state |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
910 |
+ * printer = cupsd_printer_t |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
911 |
+ * slabel = Sensitivity Label |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
912 |
+ * username = Username from Authorization |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
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() |
6ab0c0792118
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() |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
919 |
+ */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
920 |
+static void |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
926 |
+{ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
927 |
+ int authorized = 0; |
6ab0c0792118
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; |
6ab0c0792118
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; |
6ab0c0792118
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; |
6ab0c0792118
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; |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
933 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
934 |
+ /* |
6ab0c0792118
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', |
6ab0c0792118
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' |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
937 |
+ * from request. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
938 |
+ */ |
6ab0c0792118
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", |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
940 |
+ IPP_TAG_NAME)) != NULL) { |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
942 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
943 |
+ |
6ab0c0792118
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) { |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
946 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
947 |
+ |
6ab0c0792118
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 */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
949 |
+ if (hname == NULL) { |
6ab0c0792118
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", |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
951 |
+ IPP_TAG_NAME)) != NULL) { |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
953 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
954 |
+ } else { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
955 |
+ hostname = hname; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
956 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
957 |
+ |
6ab0c0792118
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", |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
959 |
+ IPP_TAG_NAME)) != NULL) { |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
961 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
962 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
963 |
+ /* |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
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' |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
967 |
+ * means same. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
968 |
+ */ |
6ab0c0792118
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", |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
970 |
+ IPP_TAG_ZERO)) != NULL) { |
6ab0c0792118
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) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
972 |
+ wants_nobanner = B_TRUE; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
973 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
974 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
975 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
976 |
+ if (wants_nobanner) { |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
978 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
979 |
+ /* |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
982 |
+ */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
983 |
+ if (!denial_request) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
984 |
+ if (authorized) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
985 |
+ fail_reason = 0; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
986 |
+ } else { |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
988 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
989 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
990 |
+ |
6ab0c0792118
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( |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
997 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
998 |
+ |
6ab0c0792118
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 */ |
6ab0c0792118
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) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1001 |
+ wants_nolabels = B_TRUE; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1002 |
+ |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1004 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1005 |
+ /* |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1008 |
+ */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1009 |
+ if (!denial_request) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1010 |
+ if (authorized) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1011 |
+ fail_reason = 0; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1012 |
+ } else { |
6ab0c0792118
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; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1014 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1015 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1016 |
+ |
6ab0c0792118
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( |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1023 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1024 |
+ |
6ab0c0792118
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) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1026 |
+ /* |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1029 |
+ */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1030 |
+ if (!denial_request) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1031 |
+ fail_reason = 0; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1032 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1033 |
+ |
6ab0c0792118
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( |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1040 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1041 |
+ |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1043 |
+} |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1044 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1045 |
+/* |
6ab0c0792118
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. |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1050 |
+ * |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1053 |
+ * char *slabel Sensitivity Label |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1055 |
+ * char *username Printing user |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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, |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1062 |
+ * char *name Printer name |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1063 |
+ */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1064 |
+void |
6ab0c0792118
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) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1066 |
+{ |
6ab0c0792118
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]; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1068 |
+ |
6ab0c0792118
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", |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1071 |
+ |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1076 |
+} |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1077 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1078 |
+/* |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1083 |
+ * failure resp. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1084 |
+ * |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1085 |
+ * cupsd_client_[s]t |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1089 |
+ * char *slabel Sesnitivity Label |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1093 |
+ * |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1094 |
+ */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1095 |
+void |
6ab0c0792118
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, |
6ab0c0792118
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) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1098 |
+{ |
6ab0c0792118
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]; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1100 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1101 |
+ /* |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1103 |
+ * not job. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1104 |
+ */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1105 |
+ if (con != NULL) { |
6ab0c0792118
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); |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1110 |
+ } else { |
6ab0c0792118
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); |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1116 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1117 |
+} |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1120 |
@@ -16,6 +16,7 @@ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1121 |
include ../Makedefs |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1122 |
|
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1123 |
CUPSDOBJS = \ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1124 |
+ audit.o \ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1125 |
auth.o \ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1126 |
banners.o \ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1127 |
cert.o \ |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1130 |
@@ -893,6 +893,15 @@ |
6ab0c0792118
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", |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1132 |
NULL, uri); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1133 |
|
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1134 |
+#if defined(HAVE_TSOL) |
6ab0c0792118
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) { |
6ab0c0792118
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 */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1137 |
+ if (argv[1][0]) |
6ab0c0792118
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, |
6ab0c0792118
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]); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1140 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1141 |
+#endif /* HAVE_TSOL */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1142 |
+ |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1144 |
|
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1145 |
if (argv[2][0]) |
6ab0c0792118
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 |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1148 |
@@ -220,8 +220,11 @@ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1149 |
*response; /* Create-Job response */ |
6ab0c0792118
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 */ |
6ab0c0792118
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 */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1152 |
+#if defined(HAVE_TSOL) |
6ab0c0792118
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 */ |
6ab0c0792118
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 */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1155 |
+#endif /* HAVE_TSOL */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1156 |
|
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1157 |
- |
6ab0c0792118
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\", " |
6ab0c0792118
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)", |
6ab0c0792118
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)); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1161 |
@@ -257,6 +260,28 @@ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1162 |
if (title) |
6ab0c0792118
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, |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1164 |
title); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1165 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1166 |
+#if defined(HAVE_TSOL) |
6ab0c0792118
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) { |
6ab0c0792118
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) |
6ab0c0792118
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", |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1170 |
+ NULL, filelist); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1171 |
+ |
6ab0c0792118
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 */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1173 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1174 |
+ /* |
6ab0c0792118
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, |
6ab0c0792118
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, |
6ab0c0792118
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. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1178 |
+ */ |
6ab0c0792118
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()); |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1181 |
+ |
6ab0c0792118
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()); |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1184 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1185 |
+#endif /* HAVE_TSOL */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1186 |
+ |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1188 |
|
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1189 |
/* |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1190 |
@@ -1462,8 +1487,12 @@ |
6ab0c0792118
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 */ |
6ab0c0792118
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 */ |
6ab0c0792118
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 */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1194 |
+#if defined(HAVE_TSOL) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1195 |
+ int listlen = 0; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1196 |
+ char *filelist; /* file list */ |
6ab0c0792118
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]; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1198 |
+#endif /* HAVE_TSOL */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1199 |
|
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1200 |
- |
6ab0c0792118
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, " |
6ab0c0792118
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)", |
6ab0c0792118
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)); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1204 |
@@ -1479,6 +1508,56 @@ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1205 |
return (0); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1206 |
} |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1207 |
|
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1208 |
+#if defined(HAVE_TSOL) |
6ab0c0792118
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) { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1210 |
+ /* |
6ab0c0792118
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. |
6ab0c0792118
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' |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1213 |
+ */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1214 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1215 |
+ /* |
6ab0c0792118
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 |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1217 |
+ * more than 1000. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1218 |
+ */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1219 |
+ if (num_files > 1000) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1220 |
+ num_files = 1000; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1221 |
+ |
6ab0c0792118
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++) { |
6ab0c0792118
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) { |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1225 |
+ } else |
6ab0c0792118
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]); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1227 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1228 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1229 |
+ /* |
6ab0c0792118
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 ',' |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1231 |
+ * and NULL terminated string. |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1232 |
+ */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1233 |
+ listlen = listlen + num_files; |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1234 |
+ filelist = malloc(listlen); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1235 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1236 |
+ if (filelist != NULL) { |
6ab0c0792118
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) |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1239 |
+ else |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1241 |
+ |
6ab0c0792118
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++) |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1243 |
+ { |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1244 |
+ strlcat(filelist, ",", listlen); |
6ab0c0792118
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) |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1247 |
+ else |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1249 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1250 |
+ |
6ab0c0792118
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); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1252 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1253 |
+ free(filelist); |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1254 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1255 |
+ } |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1256 |
+#endif /* HAVE_TSOL */ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1257 |
+ |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1258 |
/* |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1259 |
* Create the print job... |
6ab0c0792118
15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff
changeset
|
1260 |
*/ |