rpms/cups/F-7 cups-lspp.patch,1.21,1.22 cups.spec,1.342,1.343

Tim Waugh (twaugh) fedora-extras-commits at redhat.com
Tue Jul 31 12:27:42 UTC 2007


Author: twaugh

Update of /cvs/pkgs/rpms/cups/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv25591

Modified Files:
	cups-lspp.patch cups.spec 
Log Message:
* Tue Jul 31 2007 Tim Waugh <twaugh at redhat.com> 1:1.2.12-3
- Better buildroot tag.
- Moved LSPP access check and security attributes check in add_job() to
  before allocation of the job structure (bug #231522).


cups-lspp.patch:

Index: cups-lspp.patch
===================================================================
RCS file: /cvs/pkgs/rpms/cups/F-7/cups-lspp.patch,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- cups-lspp.patch	29 Mar 2007 10:30:29 -0000	1.21
+++ cups-lspp.patch	31 Jul 2007 12:27:39 -0000	1.22
@@ -1,25 +1,30 @@
---- cups-1.2.8/Makedefs.in.lspp	2007-03-02 14:06:43.000000000 +0000
-+++ cups-1.2.8/Makedefs.in	2007-03-02 14:06:46.000000000 +0000
-@@ -136,7 +136,7 @@
- 			@LDFLAGS@ @RELROFLAG@ @PIEFLAGS@ $(OPTIM)
- LINKCUPS	=	@LINKCUPS@ $(SSLLIBS)
- LINKCUPSIMAGE	=	@LINKCUPSIMAGE@
--LIBS		=	$(LINKCUPS) $(COMMONLIBS)
-+LIBS		=	$(LINKCUPS) $(COMMONLIBS) @LIBAUDIT@ @LIBSELINUX@
- OPTIM		=	@OPTIM@
- OPTIONS		=
- PAMLIBS		=	@PAMLIBS@
-@@ -239,7 +239,7 @@
- # Rules...
- #
+--- cups-1.2.12/cups/cups.h.lspp	2007-06-04 16:38:28.000000000 +0100
++++ cups-1.2.12/cups/cups.h	2007-07-31 12:30:25.000000000 +0100
+@@ -24,6 +24,9 @@
+  *   This file is subject to the Apple OS-Developed Software exception.
+  */
  
--.SILENT:
++/* Copyright (C) 2005 Trusted Computer Solutions, Inc. */
++/* (c) Copyright 2005-2006 Hewlett-Packard Development Company, L.P. */
 +
- .SUFFIXES:	.1 .1.gz .1m .1m.gz .5 .5.gz .7 .7.gz .8 .8.gz .a .c .cxx .h .man .o .32.o .64.o .gz
+ #ifndef _CUPS_CUPS_H_
+ #  define _CUPS_CUPS_H_
  
- .c.o:
---- /dev/null	2007-03-02 08:56:41.811642143 +0000
-+++ cups-1.2.8/config-scripts/cups-lspp.m4	2007-03-02 14:06:43.000000000 +0000
+@@ -75,6 +78,12 @@
+ #  define CUPS_DATE_ANY		-1
+ 
+ 
++# ifdef WITH_LSPP
++# define MLS_CONFIG "mls"
++# define TE_CONFIG "te"
++# define SELINUX_CONFIG "SELinux"
++# define UNKNOWN_SL "UNKNOWN SL"
++# endif /* WITH_LSPP */
+ /*
+  * Types and structures...
+  */
+--- /dev/null	2007-07-31 09:03:12.827706703 +0100
++++ cups-1.2.12/config-scripts/cups-lspp.m4	2007-07-31 12:30:25.000000000 +0100
 @@ -0,0 +1,36 @@
 +dnl
 +dnl   LSPP code for the Common UNIX Printing System (CUPS).
@@ -57,8 +62,8 @@
 +            ;;
 +    esac
 +fi
---- cups-1.2.8/data/mls	2007-03-02 14:06:43.000000000 +0000
-+++ cups-1.2.4-secheck/data/mls	2007-03-07 10:33:09.000000000 -0500
+--- /dev/null	2007-07-31 09:03:12.827706703 +0100
++++ cups-1.2.12/data/mls	2007-07-31 12:30:25.000000000 +0100
 @@ -0,0 +1,261 @@
 +%!PS-Adobe-3.0
 +%%BoundingBox: 0 0 612 792
@@ -321,8 +326,8 @@
 +% End of "$Id$".
 +%
 +%%EOF
---- cups-1.2.8/data/selinux	2007-03-02 14:06:43.000000000 +0000
-+++ cups-1.2.4-secheck/data/selinux	2007-03-07 10:33:09.000000000 -0500
+--- /dev/null	2007-07-31 09:03:12.827706703 +0100
++++ cups-1.2.12/data/selinux	2007-07-31 12:30:25.000000000 +0100
 @@ -0,0 +1,261 @@
 +%!PS-Adobe-3.0
 +%%BoundingBox: 0 0 612 792
@@ -585,8 +590,8 @@
 +% End of "$Id$".
 +%
 +%%EOF
---- cups-1.2.8/data/Makefile.lspp	2006-03-19 03:23:34.000000000 +0000
-+++ cups-1.2.8/data/Makefile	2007-03-02 14:06:43.000000000 +0000
+--- cups-1.2.12/data/Makefile.lspp	2006-03-19 03:23:34.000000000 +0000
++++ cups-1.2.12/data/Makefile	2007-07-31 12:30:25.000000000 +0100
 @@ -34,7 +34,10 @@
  		secret \
  		standard \
@@ -599,8 +604,8 @@
  
  CHARMAPS =	\
  		euc-cn.txt \
---- cups-1.2.8/data/te	2007-03-02 14:06:43.000000000 +0000
-+++ cups-1.2.4-secheck/data/te	2007-03-07 10:33:09.000000000 -0500
+--- /dev/null	2007-07-31 09:03:12.827706703 +0100
++++ cups-1.2.12/data/te	2007-07-31 12:30:25.000000000 +0100
 @@ -0,0 +1,261 @@
 +%!PS-Adobe-3.0
 +%%BoundingBox: 0 0 612 792
@@ -863,60 +868,178 @@
 +% End of "$Id$".
 +%
 +%%EOF
---- cups-1.2.8/config.h.in.lspp	2007-02-06 16:04:25.000000000 +0000
-+++ cups-1.2.8/config.h.in	2007-03-02 14:06:43.000000000 +0000
-@@ -468,6 +468,13 @@
- #undef HAVE_APPLETALK_AT_PROTO_H
+--- cups-1.2.12/filter/common.c.lspp	2006-10-02 17:26:04.000000000 +0100
++++ cups-1.2.12/filter/common.c	2007-07-31 12:30:25.000000000 +0100
+@@ -39,6 +39,12 @@
+  * Include necessary headers...
+  */
  
++#include "config.h"
++#ifdef WITH_LSPP
++#define _GNU_SOURCE
++#include <string.h>
++#endif /* WITH_LSPP */
++
+ #include "common.h"
+ #include <locale.h>
  
-+/*
-+ * Are we trying to meet LSPP requirements?
-+ */
+@@ -321,6 +327,18 @@
+ {
+   const char	*classification;	/* CLASSIFICATION environment variable */
+   const char	*ptr;			/* Temporary string pointer */
++#ifdef WITH_LSPP
++  int           i,                      /* counter */
++                n,                      /* counter */
++                lines,                  /* number of lines needed */
++                line_len,               /* index into tmp_label */
++                label_len,              /* length of the label in characters */
++                label_index,            /* index into the label */
++                longest,                /* length of the longest line */
++                longest_line,           /* index to the longest line */
++                max_width;              /* maximum width in characters */
++  char          **wrapped_label;        /* label with line breaks */
++#endif /* WITH_LSPP */
+ 
+ 
+  /*
+@@ -343,6 +361,124 @@
+     return;
+   }
+ 
++#ifdef WITH_LSPP
++  if (strncmp(classification, "LSPP:", 5) == 0 && label == NULL)
++  {
++   /*
++    * Based on the 12pt fixed width font below determine the max_width
++    */
++    max_width = width / 8;
++    longest_line = 0;
++    longest = 0;
++    classification += 5; // Skip the "LSPP:"
++    label_len = strlen(classification);
 +
-+#undef WITH_LSPP
++    if (label_len > max_width)
++    {
++      lines = 1 + (int)(label_len / max_width);
++      line_len = (int)(label_len / lines);
++      wrapped_label = malloc(sizeof(wrapped_label) * lines);
++      label_index = i = n = 0;
++      while (classification[label_index])
++      {
++        if ((label_index + line_len) > label_len)
++          break;
++        switch (classification[label_index + line_len + i])
++        {
++          case ':':
++          case ',':
++          case '-':
++            i++;
++            wrapped_label[n++] = strndup(&classification[label_index], (line_len + i));
++            label_index += line_len + i;
++            i = 0;
++            break;
++          default:
++            i++;
++            break;
++        }
++        if ((i + line_len) == max_width)
++        {
++          wrapped_label[n++] = strndup(&(classification[label_index]), (line_len + i));
++          label_index = label_index + line_len + i;
++          i = 0;
++        }
++      }
++      wrapped_label[n] = strndup(&classification[label_index], label_len - label_index);
++    }
++    else
++    {
++      lines = 1;
++      wrapped_label = malloc(sizeof(wrapped_label));
++      wrapped_label[0] = (char*)classification;
++    }
 +
++    for (n = 0; n < lines; n++ )
++    {
++      printf("userdict/ESPp%c(", ('a' + n));
++      for (ptr = wrapped_label[n], i = 0; *ptr; ptr ++, i++)
++        if (*ptr < 32 || *ptr > 126)
++          printf("\\%03o", *ptr);
++        else
++        {
++          if (*ptr == '(' || *ptr == ')' || *ptr == '\\')
++            putchar('\\');
 +
- #endif /* !_CUPS_CONFIG_H_ */
- 
- /*
---- cups-1.2.8/configure.in.lspp	2006-12-06 20:10:16.000000000 +0000
-+++ cups-1.2.8/configure.in	2007-03-02 14:06:43.000000000 +0000
-@@ -48,6 +48,8 @@
- sinclude(config-scripts/cups-pdf.m4)
- sinclude(config-scripts/cups-scripting.m4)
- 
-+sinclude(config-scripts/cups-lspp.m4)
++          printf("%c", *ptr);
++        }
++      if (i > longest)
++      {
++        longest = i;
++        longest_line = n;
++      }
++      printf(")put\n");
++    }
 +
- INSTALL_LANGUAGES=""
- UNINSTALL_LANGUAGES=""
- LANGFILES=""
---- cups-1.2.8/cups/cups.h.lspp	2007-01-10 16:23:06.000000000 +0000
-+++ cups-1.2.8/cups/cups.h	2007-03-02 14:06:43.000000000 +0000
-@@ -24,6 +24,9 @@
-  *   This file is subject to the Apple OS-Developed Software exception.
-  */
- 
-+/* Copyright (C) 2005 Trusted Computer Solutions, Inc. */
-+/* (c) Copyright 2005-2006 Hewlett-Packard Development Company, L.P. */
++   /*
++    * For LSPP use a fixed width font so that line wrapping can be calculated
++    */
 +
- #ifndef _CUPS_CUPS_H_
- #  define _CUPS_CUPS_H_
- 
-@@ -75,6 +78,12 @@
- #  define CUPS_DATE_ANY		-1
++    puts("userdict/ESPlf /Nimbus-Mono findfont 12 scalefont put");
++
++   /*
++    * Finally, the procedure to write the labels on the page...
++    */
++
++    printf("userdict/ESPwl{\n"
++           "  ESPlf setfont\n");
++    printf("  ESPp%c stringwidth pop dup 12 add exch -0.5 mul %.0f add\n ",
++           'a' + longest_line, width * 0.5f);
++    for (n = 1; n < lines; n++)
++      printf(" dup");
++    printf("\n  1 setgray\n");
++    printf("  dup 6 sub %.0f %d index %.0f ESPrf\n",
++           (bottom - 2.0), (2 + lines), 6.0 + (16.0 * lines));
++    printf("  dup 6 sub %.0f %d index %.0f ESPrf\n",
++           (top - 6.0 - (16.0 * lines)), (2 + lines), 4.0 + (16.0 * lines));
++    printf("  0 setgray\n");
++    printf("  dup 6 sub %.0f %d index %.0f ESPrs\n",
++           (bottom - 2.0), (2 + lines), 6.0 + (16.0 * lines));
++    printf("  dup 6 sub %.0f %d index %.0f ESPrs\n",
++           (top - 6.0 - (16.0 * lines)), (2 + lines), 4.0 + (16.0 * lines));
++    for (n = 0; n < lines; n ++)
++    {
++      printf("  dup %.0f moveto ESPp%c show\n",
++             bottom + 6.0 + ((lines - (n+1)) * 16.0), 'a' + n);
++      printf("  %.0f moveto ESPp%c show\n", top + 2.0 - ((n + 1) * 16.0), 'a' + n);
++    }
++    printf("  pop\n"
++           "}bind put\n");
++
++   /*
++    * Do some clean up at the end of the LSPP special case
++    */
++    free(wrapped_label);
++
++  }
++  else
++  {
++#endif /* !WITH_LSPP */
++  
+  /*
+   * Set the classification + page label string...
+   */
+@@ -423,7 +559,10 @@
+   printf("  %.0f moveto ESPpl show\n", top - 14.0);
+   puts("pop");
+   puts("}bind put");
++  }
++#ifdef WITH_LSPP
+ }
++#endif /* WITH_LSPP */
  
  
-+# ifdef WITH_LSPP
-+# define MLS_CONFIG "mls"
-+# define TE_CONFIG "te"
-+# define SELINUX_CONFIG "SELinux"
-+# define UNKNOWN_SL "UNKNOWN SL"
-+# endif /* WITH_LSPP */
  /*
-  * Types and structures...
-  */
---- cups-1.2.8/scheduler/client.h.lspp	2007-01-22 22:04:43.000000000 +0000
-+++ cups-1.2.8/scheduler/client.h	2007-03-02 14:06:43.000000000 +0000
+--- cups-1.2.12/scheduler/client.h.lspp	2007-01-22 22:04:43.000000000 +0000
++++ cups-1.2.12/scheduler/client.h	2007-07-31 12:30:25.000000000 +0100
 @@ -22,6 +22,13 @@
   *         WWW: http://www.cups.org
   */
@@ -952,8 +1075,8 @@
  
  
  /*
---- cups-1.2.8/scheduler/conf.c	2007-03-02 14:06:43.000000000 +0000
-+++ cups-1.2.4-secheck/scheduler/conf.c	2007-03-07 11:22:58.000000000 -0500
+--- cups-1.2.12/scheduler/conf.c.lspp	2007-07-31 12:30:25.000000000 +0100
++++ cups-1.2.12/scheduler/conf.c	2007-07-31 12:30:25.000000000 +0100
 @@ -35,6 +35,7 @@
   *   read_configuration()     - Read a configuration file.
   *   read_location()          - Read a <Location path> definition.
@@ -1044,7 +1167,7 @@
  
   /*
    * Update the MaxClientsPerHost value, as needed...
-@@ -3295,6 +3337,18 @@
+@@ -3296,6 +3338,18 @@
    return (0);
  }
  
@@ -1063,8 +1186,8 @@
  
  /*
   * End of "$Id$".
---- cups-1.2.8/scheduler/client.c.lspp	2007-02-07 20:54:37.000000000 +0000
-+++ cups-1.2.8/scheduler/client.c	2007-03-02 14:06:43.000000000 +0000
+--- cups-1.2.12/scheduler/client.c.lspp	2007-04-12 21:46:20.000000000 +0100
++++ cups-1.2.12/scheduler/client.c	2007-07-31 12:30:25.000000000 +0100
 @@ -44,12 +44,17 @@
   *   make_certificate()      - Make a self-signed SSL/TLS certificate.
   *   pipe_command()          - Pipe the output of a command to the remote client.
@@ -1283,9 +1406,9 @@
  /*
   * 'pipe_command()' - Pipe the output of a command to the remote client.
   */
---- cups-1.2.8/scheduler/main.c.lspp	2007-03-02 14:06:43.000000000 +0000
-+++ cups-1.2.8/scheduler/main.c	2007-03-02 14:06:43.000000000 +0000
-@@ -49,6 +49,8 @@
+--- cups-1.2.12/scheduler/main.c.lspp	2007-07-31 12:30:25.000000000 +0100
++++ cups-1.2.12/scheduler/main.c	2007-07-31 12:30:26.000000000 +0100
+@@ -44,6 +44,8 @@
   *   usage()                   - Show scheduler usage.
   */
  
@@ -1294,7 +1417,7 @@
  /*
   * Include necessary headers...
   */
-@@ -71,6 +73,9 @@
+@@ -77,6 +79,9 @@
  #  include <notify.h>
  #endif /* HAVE_NOTIFY_H */
  
@@ -1304,7 +1427,7 @@
  
  /*
   * Local functions...
-@@ -156,6 +161,9 @@
+@@ -153,6 +158,9 @@
    int			launchd_idle_exit;
  					/* Idle exit on select timeout? */
  #endif	/* HAVE_LAUNCHD */
@@ -1314,7 +1437,7 @@
  
  
   /*
-@@ -366,6 +374,25 @@
+@@ -363,6 +371,25 @@
  #endif /* DEBUG */
    }
  
@@ -1340,7 +1463,7 @@
   /*
    * Set the timezone info...
    */
-@@ -1154,6 +1181,11 @@
+@@ -1125,6 +1152,11 @@
    free(input);
    free(output);
  
@@ -1352,8 +1475,8 @@
    return (!stop_scheduler);
  }
  
---- cups-1.2.8/scheduler/conf.h	2007-03-02 14:06:43.000000000 +0000
-+++ cups-1.2.4-secheck/scheduler/conf.h	2007-03-07 11:22:58.000000000 -0500
+--- cups-1.2.12/scheduler/conf.h.lspp	2007-07-31 12:30:25.000000000 +0100
++++ cups-1.2.12/scheduler/conf.h	2007-07-31 12:30:26.000000000 +0100
 @@ -191,6 +191,12 @@
  					/* Server key file */
  #  endif /* HAVE_LIBSSL || HAVE_GNUTLS */
@@ -1377,8 +1500,8 @@
  
  /*
   * End of "$Id$".
---- cups-1.2.8/scheduler/ipp.c.lspp	2007-03-02 14:06:43.000000000 +0000
-+++ cups-1.2.8/scheduler/ipp.c	2007-03-02 14:06:57.000000000 +0000
+--- cups-1.2.12/scheduler/ipp.c.lspp	2007-07-31 12:30:25.000000000 +0100
++++ cups-1.2.12/scheduler/ipp.c	2007-07-31 12:35:18.000000000 +0100
 @@ -41,6 +41,7 @@
   *   cancel_all_jobs()           - Cancel all print jobs.
   *   cancel_job()                - Cancel a print job.
@@ -1444,9 +1567,9 @@
  
  
    cupsdLogMessage(CUPSD_LOG_DEBUG2, "add_job(%p[%d], %s)", con,
-@@ -1335,6 +1365,127 @@
-     return (NULL);
-   }
+@@ -1333,6 +1363,104 @@
+     ippAddString(con->request, IPP_TAG_JOB, IPP_TAG_NAME, "job-name", NULL,
+                  title = "Untitled");
  
 +#ifdef WITH_LSPP
 +  if (is_lspp_config())
@@ -1457,21 +1580,6 @@
 +      send_ipp_status(con, IPP_INTERNAL_ERROR, _("Missing required secuirty attributes."));
 +      return (NULL);
 +    }
-+    else
-+    {
-+     /*
-+      * duplicate the security context and auid of the connection into the job structure
-+      */
-+      job->scon = strdup(con->scon);
-+      job->auid = con->auid;
-+
-+     /* 
-+      * add the security context to the request so that on a restart the security
-+      * attributes will be able to be restored
-+      */
-+      ippAddString(con->request, IPP_TAG_JOB, IPP_TAG_NAME, "security-context", 
-+                   NULL, job->scon);
-+    }
 +
 +   /*
 +    * Perform an access check so that if the user gets feedback at enqueue time
@@ -1546,8 +1654,8 @@
 +        if (AuditLog != -1)
 +        {
 +          audit_message = NULL;
-+          cupsdSetStringf(&audit_message, "job=%d auid=%u acct=%s obj=%s refused"
-+                          " unable to access printer=%s", job->id, con->auid,
++          cupsdSetStringf(&audit_message, "job=? auid=%u acct=%s obj=%s refused"
++                          " unable to access printer=%s", con->auid,
 +                          con->username, con->scon, printer->name);
 +          audit_log_user_message(AuditLog, AUDIT_USER_LABELED_EXPORT, audit_message,
 +                                 ServerName, NULL, NULL, 0);
@@ -1559,6 +1667,31 @@
 +      }
 +    }
 +  }
++#endif /* WITH_LSPP */
++
+   if ((job = cupsdAddJob(priority, printer->name)) == NULL)
+   {
+     send_ipp_status(con, IPP_INTERNAL_ERROR,
+@@ -1340,6 +1468,32 @@
+     return (NULL);
+   }
+ 
++#ifdef WITH_LSPP
++  if (is_lspp_config())
++  {
++   /*
++    * duplicate the security context and auid of the connection into the job structure
++    */
++    job->scon = strdup(con->scon);
++    job->auid = con->auid;
++
++   /* 
++    * add the security context to the request so that on a restart the security
++    * attributes will be able to be restored
++    */
++    ippAddString(con->request, IPP_TAG_JOB, IPP_TAG_NAME, "security-context", 
++		 NULL, job->scon);
++  }
 +  else
 +  {
 +   /*
@@ -1572,7 +1705,7 @@
    job->dtype   = dtype;
    job->attrs   = con->request;
    con->request = ippNewRequest(job->attrs->request.op.operation_id);
-@@ -1530,6 +1681,29 @@
+@@ -1535,6 +1689,29 @@
        attr->values[0].string.text = _cupsStrAlloc(printer->job_sheets[0]);
        attr->values[1].string.text = _cupsStrAlloc(printer->job_sheets[1]);
      }
@@ -1602,7 +1735,7 @@
  
      job->job_sheets = attr;
  
-@@ -1560,6 +1734,9 @@
+@@ -1565,6 +1742,9 @@
  	                		    "job-sheets=\"%s,none\", "
  					    "job-originating-user-name=\"%s\"",
  	        	 job->id, Classification, job->username);
@@ -1612,7 +1745,7 @@
  	}
  	else if (attr->num_values == 2 &&
  	         strcmp(attr->values[0].string.text,
-@@ -1578,6 +1755,9 @@
+@@ -1583,6 +1763,9 @@
  					    "job-originating-user-name=\"%s\"",
  	        	 job->id, attr->values[0].string.text,
  			 attr->values[1].string.text, job->username);
@@ -1622,7 +1755,7 @@
  	}
  	else if (strcmp(attr->values[0].string.text, Classification) &&
  	         strcmp(attr->values[0].string.text, "none") &&
-@@ -1598,6 +1778,9 @@
+@@ -1603,6 +1786,9 @@
  			    "job-originating-user-name=\"%s\"",
  	        	    job->id, attr->values[0].string.text,
  			    attr->values[1].string.text, job->username);
@@ -1632,7 +1765,7 @@
          }
        }
        else if (strcmp(attr->values[0].string.text, Classification) &&
-@@ -1638,9 +1821,52 @@
+@@ -1643,9 +1829,52 @@
  	                  "job-sheets=\"%s\", "
  			  "job-originating-user-name=\"%s\"",
  	        	 job->id, Classification, job->username);
@@ -1685,7 +1818,7 @@
     /*
      * See if we need to add the starting sheet...
      */
-@@ -3142,6 +3368,103 @@
+@@ -3147,6 +3376,103 @@
  }
  
  
@@ -1789,7 +1922,7 @@
  /*
   * 'check_quotas()' - Check quotas for a printer and user.
   */
-@@ -3490,6 +3813,15 @@
+@@ -3495,6 +3821,15 @@
    char		attrname[255],		/* Name of attribute */
  		*s;			/* Pointer into name */
    ipp_attribute_t *attr;		/* Attribute */
@@ -1805,7 +1938,7 @@
  
  
    cupsdLogMessage(CUPSD_LOG_DEBUG2, "copy_banner(%p[%d], %p[%d], %s)",
-@@ -3523,6 +3855,77 @@
+@@ -3528,6 +3863,77 @@
  
    fchmod(cupsFileNumber(out), 0640);
    fchown(cupsFileNumber(out), RunUser, Group);
@@ -1883,7 +2016,7 @@
  
   /*
    * Try the localized banner file under the subdirectory...
-@@ -3617,6 +4020,24 @@
+@@ -3622,6 +4028,24 @@
        else
          s = attrname;
  
@@ -1908,7 +2041,7 @@
        if (!strcmp(s, "printer-name"))
        {
          cupsFilePuts(out, job->dest);
-@@ -5295,6 +5716,22 @@
+@@ -5300,6 +5724,22 @@
      return;
    }
  
@@ -1931,7 +2064,7 @@
   /*
    * Copy attributes...
    */
-@@ -5492,6 +5929,11 @@
+@@ -5497,6 +5937,11 @@
      if (count > 0)
        ippAddSeparator(con->response);
  
@@ -1943,7 +2076,7 @@
      count ++;
  
      cupsdLogMessage(CUPSD_LOG_DEBUG2, "get_jobs: count = %d", count);
-@@ -7880,12 +8322,22 @@
+@@ -7888,12 +8333,22 @@
      * See if we need to add the ending sheet...
      */
  
@@ -1966,7 +2099,7 @@
       /*
        * Yes...
        */
-@@ -9158,6 +9610,11 @@
+@@ -9166,6 +9621,11 @@
  
    strlcpy(username, get_username(con), userlen);
  
@@ -1978,8 +2111,8 @@
   /*
    * Check the username against the owner...
    */
---- cups-1.2.8/scheduler/job.c	2007-03-02 14:06:43.000000000 +0000
-+++ cups-1.2.4-secheck/scheduler/job.c	2007-03-07 11:22:58.000000000 -0500
+--- cups-1.2.12/scheduler/job.c.lspp	2007-07-31 12:30:25.000000000 +0100
++++ cups-1.2.12/scheduler/job.c	2007-07-31 12:30:26.000000000 +0100
 @@ -68,6 +68,9 @@
   *   unload_job()               - Unload a job from memory.
   */
@@ -2245,8 +2378,8 @@
   /*
    * Building the options string is harder than it needs to be, but
    * for the moment we need to pass strings for command-line args and
-@@ -2840,6 +3056,18 @@
-          banner_page)
+@@ -2846,6 +3062,18 @@
+ 	  banner_page)
          continue;
  
 +#ifdef WITH_LSPP
@@ -2264,7 +2397,7 @@
       /*
        * Otherwise add them to the list...
        */
-@@ -3055,6 +3283,67 @@
+@@ -3061,6 +3289,67 @@
      envp[envc ++] = final_content_type;
    }
  
@@ -2332,8 +2465,8 @@
    if (Classification && !banner_page)
    {
      if ((attr = ippFindAttribute(job->attrs, "job-sheets",
---- cups-1.2.8/scheduler/printers.c.lspp	2007-03-02 14:06:43.000000000 +0000
-+++ cups-1.2.8/scheduler/printers.c	2007-03-02 14:06:43.000000000 +0000
+--- cups-1.2.12/scheduler/printers.c.lspp	2007-07-31 12:30:25.000000000 +0100
++++ cups-1.2.12/scheduler/printers.c	2007-07-31 12:30:26.000000000 +0100
 @@ -57,6 +57,8 @@
   *                                 printing desktop tools.
   */
@@ -2354,7 +2487,7 @@
  
  /*
   * 'cupsdAddPrinter()' - Add a printer to the system.
-@@ -1472,6 +1478,13 @@
+@@ -1515,6 +1521,13 @@
  		  "two-sided-long-edge",
  		  "two-sided-short-edge"
  		};
@@ -2368,7 +2501,7 @@
  
  
    DEBUG_printf(("cupsdSetPrinterAttrs: entering name = %s, type = %x\n", p->name,
-@@ -1579,6 +1592,44 @@
+@@ -1622,6 +1635,44 @@
        attr->values[1].string.text = _cupsStrAlloc(Classification ?
  	                                   Classification : p->job_sheets[1]);
      }
@@ -2413,8 +2546,8 @@
    }
  
    printer_type = p->type;
---- cups-1.2.8/scheduler/job.h.lspp	2006-09-19 21:11:08.000000000 +0100
-+++ cups-1.2.8/scheduler/job.h	2007-03-02 14:06:43.000000000 +0000
+--- cups-1.2.12/scheduler/job.h.lspp	2006-09-19 21:11:08.000000000 +0100
++++ cups-1.2.12/scheduler/job.h	2007-07-31 12:30:26.000000000 +0100
 @@ -22,6 +22,13 @@
   *         WWW: http://www.cups.org
   */
@@ -2440,173 +2573,41 @@
  } cupsd_job_t;
  
  
---- cups-1.2.4-base/filter/common.c	2007-03-12 16:55:55.000000000 -0400
-+++ cups-1.2.4/filter/common.c	2007-03-12 16:53:14.000000000 -0400
-@@ -38,6 +38,12 @@
-  * Include necessary headers...
-  */
- 
-+#include "config.h"
-+#ifdef WITH_LSPP
-+#define _GNU_SOURCE
-+#include <string.h>
-+#endif /* WITH_LSPP */
-+
- #include "common.h"
- #include <locale.h>
- 
-@@ -319,6 +325,18 @@
- {
-   const char	*classification;	/* CLASSIFICATION environment variable */
-   const char	*ptr;			/* Temporary string pointer */
-+#ifdef WITH_LSPP
-+  int           i,                      /* counter */
-+                n,                      /* counter */
-+                lines,                  /* number of lines needed */
-+                line_len,               /* index into tmp_label */
-+                label_len,              /* length of the label in characters */
-+                label_index,            /* index into the label */
-+                longest,                /* length of the longest line */
-+                longest_line,           /* index to the longest line */
-+                max_width;              /* maximum width in characters */
-+  char          **wrapped_label;        /* label with line breaks */
-+#endif /* WITH_LSPP */
- 
+--- cups-1.2.12/Makedefs.in.lspp	2007-07-31 12:30:25.000000000 +0100
++++ cups-1.2.12/Makedefs.in	2007-07-31 12:30:26.000000000 +0100
+@@ -136,7 +136,7 @@
+ 			@LDFLAGS@ @RELROFLAG@ @PIEFLAGS@ $(OPTIM)
+ LINKCUPS	=	@LINKCUPS@ $(SSLLIBS)
+ LINKCUPSIMAGE	=	@LINKCUPSIMAGE@
+-LIBS		=	$(LINKCUPS) $(COMMONLIBS)
++LIBS		=	$(LINKCUPS) $(COMMONLIBS) @LIBAUDIT@ @LIBSELINUX@
+ OPTIM		=	@OPTIM@
+ OPTIONS		=
+ PAMLIBS		=	@PAMLIBS@
+--- cups-1.2.12/config.h.in.lspp	2007-02-06 16:04:25.000000000 +0000
++++ cups-1.2.12/config.h.in	2007-07-31 12:30:26.000000000 +0100
+@@ -468,6 +468,13 @@
+ #undef HAVE_APPLETALK_AT_PROTO_H
  
-  /*
-@@ -341,6 +359,124 @@
-     return;
-   }
  
-+#ifdef WITH_LSPP
-+  if (strncmp(classification, "LSPP:", 5) == 0 && label == NULL)
-+  {
-+   /*
-+    * Based on the 12pt fixed width font below determine the max_width
-+    */
-+    max_width = width / 8;
-+    longest_line = 0;
-+    longest = 0;
-+    classification += 5; // Skip the "LSPP:"
-+    label_len = strlen(classification);
-+
-+    if (label_len > max_width)
-+    {
-+      lines = 1 + (int)(label_len / max_width);
-+      line_len = (int)(label_len / lines);
-+      wrapped_label = malloc(sizeof(wrapped_label) * lines);
-+      label_index = i = n = 0;
-+      while (classification[label_index])
-+      {
-+        if ((label_index + line_len) > label_len)
-+          break;
-+        switch (classification[label_index + line_len + i])
-+        {
-+          case ':':
-+          case ',':
-+          case '-':
-+            i++;
-+            wrapped_label[n++] = strndup(&classification[label_index], (line_len + i));
-+            label_index += line_len + i;
-+            i = 0;
-+            break;
-+          default:
-+            i++;
-+            break;
-+        }
-+        if ((i + line_len) == max_width)
-+        {
-+          wrapped_label[n++] = strndup(&(classification[label_index]), (line_len + i));
-+          label_index = label_index + line_len + i;
-+          i = 0;
-+        }
-+      }
-+      wrapped_label[n] = strndup(&classification[label_index], label_len - label_index);
-+    }
-+    else
-+    {
-+      lines = 1;
-+      wrapped_label = malloc(sizeof(wrapped_label));
-+      wrapped_label[0] = (char*)classification;
-+    }
-+
-+    for (n = 0; n < lines; n++ )
-+    {
-+      printf("userdict/ESPp%c(", ('a' + n));
-+      for (ptr = wrapped_label[n], i = 0; *ptr; ptr ++, i++)
-+        if (*ptr < 32 || *ptr > 126)
-+          printf("\\%03o", *ptr);
-+        else
-+        {
-+          if (*ptr == '(' || *ptr == ')' || *ptr == '\\')
-+            putchar('\\');
-+
-+          printf("%c", *ptr);
-+        }
-+      if (i > longest)
-+      {
-+        longest = i;
-+        longest_line = n;
-+      }
-+      printf(")put\n");
-+    }
-+
-+   /*
-+    * For LSPP use a fixed width font so that line wrapping can be calculated
-+    */
-+
-+    puts("userdict/ESPlf /Nimbus-Mono findfont 12 scalefont put");
-+
-+   /*
-+    * Finally, the procedure to write the labels on the page...
-+    */
++/*
++ * Are we trying to meet LSPP requirements?
++ */
 +
-+    printf("userdict/ESPwl{\n"
-+           "  ESPlf setfont\n");
-+    printf("  ESPp%c stringwidth pop dup 12 add exch -0.5 mul %.0f add\n ",
-+           'a' + longest_line, width * 0.5f);
-+    for (n = 1; n < lines; n++)
-+      printf(" dup");
-+    printf("\n  1 setgray\n");
-+    printf("  dup 6 sub %.0f %d index %.0f ESPrf\n",
-+           (bottom - 2.0), (2 + lines), 6.0 + (16.0 * lines));
-+    printf("  dup 6 sub %.0f %d index %.0f ESPrf\n",
-+           (top - 6.0 - (16.0 * lines)), (2 + lines), 4.0 + (16.0 * lines));
-+    printf("  0 setgray\n");
-+    printf("  dup 6 sub %.0f %d index %.0f ESPrs\n",
-+           (bottom - 2.0), (2 + lines), 6.0 + (16.0 * lines));
-+    printf("  dup 6 sub %.0f %d index %.0f ESPrs\n",
-+           (top - 6.0 - (16.0 * lines)), (2 + lines), 4.0 + (16.0 * lines));
-+    for (n = 0; n < lines; n ++)
-+    {
-+      printf("  dup %.0f moveto ESPp%c show\n",
-+             bottom + 6.0 + ((lines - (n+1)) * 16.0), 'a' + n);
-+      printf("  %.0f moveto ESPp%c show\n", top + 2.0 - ((n + 1) * 16.0), 'a' + n);
-+    }
-+    printf("  pop\n"
-+           "}bind put\n");
++#undef WITH_LSPP
 +
-+   /*
-+    * Do some clean up at the end of the LSPP special case
-+    */
-+    free(wrapped_label);
 +
-+  }
-+  else
-+  {
-+#endif /* !WITH_LSPP */
-+  
-  /*
-   * Set the classification + page label string...
-   */
-@@ -421,7 +557,10 @@
-   printf("  %.0f moveto ESPpl show\n", top - 14.0);
-   puts("pop");
-   puts("}bind put");
-+  }
-+#ifdef WITH_LSPP
- }
-+#endif /* WITH_LSPP */
- 
+ #endif /* !_CUPS_CONFIG_H_ */
  
  /*
+--- cups-1.2.12/configure.in.lspp	2006-12-06 20:10:16.000000000 +0000
++++ cups-1.2.12/configure.in	2007-07-31 12:30:26.000000000 +0100
+@@ -48,6 +48,8 @@
+ sinclude(config-scripts/cups-pdf.m4)
+ sinclude(config-scripts/cups-scripting.m4)
+ 
++sinclude(config-scripts/cups-lspp.m4)
++
+ INSTALL_LANGUAGES=""
+ UNINSTALL_LANGUAGES=""
+ LANGFILES=""


Index: cups.spec
===================================================================
RCS file: /cvs/pkgs/rpms/cups/F-7/cups.spec,v
retrieving revision 1.342
retrieving revision 1.343
diff -u -r1.342 -r1.343
--- cups.spec	23 Jul 2007 12:10:23 -0000	1.342
+++ cups.spec	31 Jul 2007 12:27:39 -0000	1.343
@@ -6,7 +6,7 @@
 Summary: Common Unix Printing System
 Name: cups
 Version: 1.2.12
-Release: 2%{?dist}
+Release: 3%{?dist}
 License: GPL
 Group: System Environment/Daemons
 Source: ftp://ftp.easysw.com/pub/cups/%{version}/cups-%{version}-source.tar.bz2
@@ -49,7 +49,7 @@
 Patch100: cups-lspp.patch
 Epoch: 1
 Url: http://www.cups.org/
-BuildRoot: %{_tmppath}/%{name}-root
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 PreReq: /sbin/chkconfig /sbin/service
 Requires: %{name}-libs = %{epoch}:%{version}
 %if %use_alternatives
@@ -441,6 +441,11 @@
 %{cups_serverbin}/daemon/cups-lpd
 
 %changelog
+* Tue Jul 31 2007 Tim Waugh <twaugh at redhat.com> 1:1.2.12-3
+- Better buildroot tag.
+- Moved LSPP access check and security attributes check in add_job() to
+  before allocation of the job structure (bug #231522).
+
 * Mon Jul 23 2007 Tim Waugh <twaugh at redhat.com> 1:1.2.12-2
 - Use kernel support for USB paper-out detection, when available
   (bug #249213).




More information about the scm-commits mailing list