components/cups/patches/21-16182458,16201093.patch
author Sonam Gupta <sonam.x.gupta@oracle.com>
Wed, 13 Feb 2013 01:14:45 -0800
branchs11-update
changeset 2490 ee4391c71c07
permissions -rw-r--r--
15698471 cups should audit printing information in TX environments 14850597 TX printing is reported to print jobs even when request authorization fail. 16182423 Update error code for all the failed use of authorization records in CUPS 16182458 Print 3 files requesting nolabel and nobanner should produce 6 audit records 16201093 For remote print requests, the path token in AR from GZ needs modification
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2490
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
     1
--- scheduler/audit.c	Tue Feb  5 07:54:29 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
     2
+++ scheduler/audit.c	Tue Feb  5 07:53:56 2013
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
     3
@@ -171,7 +171,6 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
     4
     int job_id, boolean_t remote)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
     5
 {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
     6
 	char		tmpfile[IPP_MAX_NAME];
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
     7
-	char		tfile[IPP_MAX_NAME];
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
     8
 	char		r_job_ID[IPP_MAX_NAME];
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
     9
 	char		*file, *f_job_ID = NULL;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    10
 	struct stat	attributes;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    11
@@ -239,14 +238,9 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    12
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    13
 	/*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    14
 	 * In case of remote request, filelist contains client document-name.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    15
-	 * Append the same to filename before writing to the audit record.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    16
 	 */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    17
 	if (remote && (filelist != NULL)) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    18
-		strlcpy(tfile, "Local file: ", sizeof (tmpfile));
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    19
-		strcat(tfile, tmpfile);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    20
-		strcat(tfile, " | Remote file: ");
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    21
-		strcat(tfile, filelist);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    22
-		file = tfile;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    23
+		file = filelist;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    24
 	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    25
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    26
 	/* extract label from slabel */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    27
@@ -424,6 +418,7 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    28
 	int			status, return_val;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    29
 	struct addrinfo		*ai = NULL;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    30
 	boolean_t		remote = B_FALSE;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    31
+	boolean_t		freedlist = B_FALSE;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    32
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    33
 	if ((event = adt_alloc_event(ah, event_ID)) == NULL) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    34
 		cupsdLogMessage(CUPSD_LOG_EMERG,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    35
@@ -485,10 +480,24 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    36
 	if (document_list == NULL) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    37
 		dlist = job_name;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    38
 	} else {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    39
-		dlist = document_list;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    40
+		dlist = strdup(document_list);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    41
+		freedlist = B_TRUE;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    42
+	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    43
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    44
+	if (dlist != NULL) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    45
 		cupsdLogMessage(CUPSD_LOG_DEBUG2,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    46
+			    "cups_audit_print_request_sub():"
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    47
+			    "document-names is %s ", dlist);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    48
+	} else {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    49
+		cupsdLogMessage(CUPSD_LOG_ERROR,
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    50
 		    "cups_audit_print_request_sub():"
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    51
-		    "document-names is %s ", dlist);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    52
+		    "document list is NULL");
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    53
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    54
+		if (ai != NULL)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    55
+			freeaddrinfo(ai);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    56
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    57
+	        adt_free_event(event);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    58
+		return;
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    59
 	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    60
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    61
 	/*
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    62
@@ -495,9 +504,7 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    63
 	 * document-names=f1,f2,f3...
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    64
 	 * extract the files from it.
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    65
 	 */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    66
-	if (dlist != NULL) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    67
-		filelist = strtok(dlist, ",");
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    68
-	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    69
+	filelist = strtok(dlist, ",");
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    70
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    71
 	if (remote) {
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    72
 		/* Remote Request */
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    73
@@ -540,6 +547,9 @@
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    74
 		freeaddrinfo(ai);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    75
 	}
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    76
 
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    77
+	if (freedlist)
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    78
+		free(dlist);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    79
+
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    80
 	adt_free_event(event);
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    81
 }
ee4391c71c07 15698471 cups should audit printing information in TX environments
Sonam Gupta <sonam.x.gupta@oracle.com>
parents:
diff changeset
    82