components/cups/patches/21-16182458,16201093.patch
author Rich Burridge <rich.burridge@oracle.com>
Fri, 06 Feb 2015 12:30:31 -0800
changeset 3744 a74b6fa1af7a
parent 1150 b6dd488e8bb7
permissions -rw-r--r--
20455804 TWISTED should have some master test results to compare against 20471207 doc/testing.txt should advise removing build output from the master results

--- scheduler/audit.c	Tue Feb  5 07:54:29 2013
+++ scheduler/audit.c	Tue Feb  5 07:53:56 2013
@@ -171,7 +171,6 @@
     int job_id, boolean_t remote)
 {
 	char		tmpfile[IPP_MAX_NAME];
-	char		tfile[IPP_MAX_NAME];
 	char		r_job_ID[IPP_MAX_NAME];
 	char		*file, *f_job_ID = NULL;
 	struct stat	attributes;
@@ -239,14 +238,9 @@
 
 	/*
 	 * In case of remote request, filelist contains client document-name.
-	 * Append the same to filename before writing to the audit record.
 	 */
 	if (remote && (filelist != NULL)) {
-		strlcpy(tfile, "Local file: ", sizeof (tmpfile));
-		strcat(tfile, tmpfile);
-		strcat(tfile, " | Remote file: ");
-		strcat(tfile, filelist);
-		file = tfile;
+		file = filelist;
 	}
 
 	/* extract label from slabel */
@@ -424,6 +418,7 @@
 	int			status, return_val;
 	struct addrinfo		*ai = NULL;
 	boolean_t		remote = B_FALSE;
+	boolean_t		freedlist = B_FALSE;
 
 	if ((event = adt_alloc_event(ah, event_ID)) == NULL) {
 		cupsdLogMessage(CUPSD_LOG_EMERG,
@@ -485,10 +480,24 @@
 	if (document_list == NULL) {
 		dlist = job_name;
 	} else {
-		dlist = document_list;
+		dlist = strdup(document_list);
+		freedlist = B_TRUE;
+	}
+
+	if (dlist != NULL) {
 		cupsdLogMessage(CUPSD_LOG_DEBUG2,
+			    "cups_audit_print_request_sub():"
+			    "document-names is %s ", dlist);
+	} else {
+		cupsdLogMessage(CUPSD_LOG_ERROR,
 		    "cups_audit_print_request_sub():"
-		    "document-names is %s ", dlist);
+		    "document list is NULL");
+
+		if (ai != NULL)
+			freeaddrinfo(ai);
+
+	        adt_free_event(event);
+		return;
 	}
 
 	/*
@@ -495,9 +504,7 @@
 	 * document-names=f1,f2,f3...
 	 * extract the files from it.
 	 */
-	if (dlist != NULL) {
-		filelist = strtok(dlist, ",");
-	}
+	filelist = strtok(dlist, ",");
 
 	if (remote) {
 		/* Remote Request */
@@ -540,6 +547,9 @@
 		freeaddrinfo(ai);
 	}
 
+	if (freedlist)
+		free(dlist);
+
 	adt_free_event(event);
 }