Blame SOURCES/cups-str4609.patch

dc9527
diff -up cups-1.6.3/cgi-bin/ipp-var.c.str4609 cups-1.6.3/cgi-bin/ipp-var.c
dc9527
--- cups-1.6.3/cgi-bin/ipp-var.c.str4609	2013-06-07 03:12:52.000000000 +0200
dc9527
+++ cups-1.6.3/cgi-bin/ipp-var.c	2015-06-10 11:44:39.584600734 +0200
dc9527
@@ -1230,21 +1230,7 @@ cgiSetIPPObjectVars(
dc9527
 	      * Rewrite URIs...
dc9527
 	      */
dc9527
 
dc9527
-              if (!strcmp(name, "member_uris"))
dc9527
-	      {
dc9527
-		char	url[1024];	/* URL for class member... */
dc9527
-
dc9527
-
dc9527
-		cgiRewriteURL(attr->values[i].string.text, url,
dc9527
-		              sizeof(url), NULL);
dc9527
-
dc9527
-                snprintf(valptr, sizeof(value) - (valptr - value),
dc9527
-		         "%s", url,
dc9527
-			 strrchr(attr->values[i].string.text, '/') + 1);
dc9527
-	      }
dc9527
-	      else
dc9527
-		cgiRewriteURL(attr->values[i].string.text, valptr,
dc9527
-		              sizeof(value) - (valptr - value), NULL);
dc9527
+	      cgiRewriteURL(attr->values[i].string.text, valptr, sizeof(value) - (valptr - value), NULL);
dc9527
               break;
dc9527
             }
dc9527
 
dc9527
diff -up cups-1.6.3/cgi-bin/template.c.str4609 cups-1.6.3/cgi-bin/template.c
dc9527
--- cups-1.6.3/cgi-bin/template.c.str4609	2013-06-07 03:12:52.000000000 +0200
dc9527
+++ cups-1.6.3/cgi-bin/template.c	2015-06-10 11:44:39.584600734 +0200
dc9527
@@ -659,39 +659,7 @@ cgi_puts(const char *s,			/* I - String
dc9527
   while (*s)
dc9527
   {
dc9527
     if (*s == '<')
dc9527
-    {
dc9527
-     /*
dc9527
-      * Pass  and , otherwise quote it...
dc9527
-      */
dc9527
-
dc9527
-      if (!_cups_strncasecmp(s, "
dc9527
-      {
dc9527
-        fputs("
dc9527
-	s += 9;
dc9527
-
dc9527
-	while (*s && *s != '\"')
dc9527
-	{
dc9527
-          if (*s == '&')
dc9527
-            fputs("&", out);
dc9527
-	  else
dc9527
-	    putc(*s, out);
dc9527
-
dc9527
-	  s ++;
dc9527
-	}
dc9527
-
dc9527
-        if (*s)
dc9527
-	  s ++;
dc9527
-
dc9527
-	fputs("\">", out);
dc9527
-      }
dc9527
-      else if (!_cups_strncasecmp(s, "", 4))
dc9527
-      {
dc9527
-        fputs("", out);
dc9527
-	s += 3;
dc9527
-      }
dc9527
-      else
dc9527
-        fputs("<", out);
dc9527
-    }
dc9527
+      fputs("<", out);
dc9527
     else if (*s == '>')
dc9527
       fputs(">", out);
dc9527
     else if (*s == '\"')
dc9527
diff -up cups-1.6.3/scheduler/ipp.c.str4609 cups-1.6.3/scheduler/ipp.c
dc9527
--- cups-1.6.3/scheduler/ipp.c.str4609	2015-06-10 11:44:39.577600753 +0200
dc9527
+++ cups-1.6.3/scheduler/ipp.c	2015-06-10 11:44:39.585600731 +0200
dc9527
@@ -482,8 +482,7 @@ cupsdProcessIPPRequest(
dc9527
 	    * Remote unauthenticated user masquerading as local root...
dc9527
 	    */
dc9527
 
dc9527
-	    _cupsStrFree(username->values[0].string.text);
dc9527
-	    username->values[0].string.text = _cupsStrAlloc(RemoteRoot);
dc9527
+            ippSetString(con->request, &username, 0, RemoteRoot);
dc9527
 	  }
dc9527
 	}
dc9527
 
dc9527
@@ -1665,7 +1664,7 @@ add_job(cupsd_client_t  *con,		/* I - Cl
dc9527
     cupsdSetString(&job->username, con->username);
dc9527
 
dc9527
     if (attr)
dc9527
-      cupsdSetString(&attr->values[0].string.text, con->username);
dc9527
+      ippSetString(job->attrs, &attr, 0, con->username);
dc9527
   }
dc9527
   else if (attr)
dc9527
   {
dc9527
@@ -1683,9 +1682,8 @@ add_job(cupsd_client_t  *con,		/* I - Cl
dc9527
                  "job-originating-user-name", NULL, job->username);
dc9527
   else
dc9527
   {
dc9527
-    attr->group_tag = IPP_TAG_JOB;
dc9527
-    _cupsStrFree(attr->name);
dc9527
-    attr->name = _cupsStrAlloc("job-originating-user-name");
dc9527
+    ippSetGroupTag(job->attrs, &attr, IPP_TAG_JOB);
dc9527
+    ippSetName(job->attrs, &attr, "job-originating-user-name");
dc9527
   }
dc9527
 
dc9527
   if (con->username[0] || auth_info)
dc9527
@@ -1716,48 +1714,11 @@ add_job(cupsd_client_t  *con,		/* I - Cl
dc9527
       * Also, we can only have 1 value and it must be a name value.
dc9527
       */
dc9527
 
dc9527
-      switch (attr->value_tag)
dc9527
-      {
dc9527
-        case IPP_TAG_STRING :
dc9527
-	case IPP_TAG_TEXTLANG :
dc9527
-	case IPP_TAG_NAMELANG :
dc9527
-	case IPP_TAG_TEXT :
dc9527
-	case IPP_TAG_NAME :
dc9527
-	case IPP_TAG_KEYWORD :
dc9527
-	case IPP_TAG_URI :
dc9527
-	case IPP_TAG_URISCHEME :
dc9527
-	case IPP_TAG_CHARSET :
dc9527
-	case IPP_TAG_LANGUAGE :
dc9527
-	case IPP_TAG_MIMETYPE :
dc9527
-	   /*
dc9527
-	    * Free old strings...
dc9527
-	    */
dc9527
-
dc9527
-	    for (i = 0; i < attr->num_values; i ++)
dc9527
-	    {
dc9527
-	      _cupsStrFree(attr->values[i].string.text);
dc9527
-	      attr->values[i].string.text = NULL;
dc9527
-	      if (attr->values[i].string.language)
dc9527
-	      {
dc9527
-		_cupsStrFree(attr->values[i].string.language);
dc9527
-		attr->values[i].string.language = NULL;
dc9527
-	      }
dc9527
-            }
dc9527
-
dc9527
-	default :
dc9527
-            break;
dc9527
-      }
dc9527
-
dc9527
-     /*
dc9527
-      * Use the default connection hostname instead...
dc9527
-      */
dc9527
-
dc9527
-      attr->value_tag             = IPP_TAG_NAME;
dc9527
-      attr->num_values            = 1;
dc9527
-      attr->values[0].string.text = _cupsStrAlloc(con->http.hostname);
dc9527
+      ippDeleteAttribute(job->attrs, attr);
dc9527
+      ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME, "job-originating-host-name", NULL, con->http.hostname);
dc9527
     }
dc9527
-
dc9527
-    attr->group_tag = IPP_TAG_JOB;
dc9527
+    else
dc9527
+      ippSetGroupTag(job->attrs, &attr, IPP_TAG_JOB);
dc9527
   }
dc9527
   else
dc9527
   {
dc9527
@@ -1854,8 +1815,8 @@ add_job(cupsd_client_t  *con,		/* I - Cl
dc9527
 
dc9527
       attr = ippAddStrings(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME, "job-sheets",
dc9527
                            2, NULL, NULL);
dc9527
-      attr->values[0].string.text = _cupsStrRetain(printer->job_sheets[0]);
dc9527
-      attr->values[1].string.text = _cupsStrRetain(printer->job_sheets[1]);
dc9527
+      ippSetString(job->attrs, &attr, 0, printer->job_sheets[0]);
dc9527
+      ippSetString(job->attrs, &attr, 1, printer->job_sheets[1]);
dc9527
     }
dc9527
 
dc9527
     job->job_sheets = attr;
dc9527
@@ -1881,7 +1842,7 @@ add_job(cupsd_client_t  *con,		/* I - Cl
dc9527
           * Force the leading banner to have the classification on it...
dc9527
 	  */
dc9527
 
dc9527
-          cupsdSetString(&attr->values[0].string.text, Classification);
dc9527
+          ippSetString(job->attrs, &attr, 0, Classification);
dc9527
 
dc9527
 	  cupsdLogJob(job, CUPSD_LOG_NOTICE, "CLASSIFICATION FORCED "
dc9527
 	                		     "job-sheets=\"%s,none\", "
dc9527
@@ -1898,7 +1859,7 @@ add_job(cupsd_client_t  *con,		/* I - Cl
dc9527
 	  * Can't put two different security markings on the same document!
dc9527
 	  */
dc9527
 
dc9527
-          cupsdSetString(&attr->values[1].string.text, attr->values[0].string.text);
dc9527
+          ippSetString(job->attrs, &attr, 1, attr->values[0].string.text);
dc9527
 
dc9527
 	  cupsdLogJob(job, CUPSD_LOG_NOTICE, "CLASSIFICATION FORCED "
dc9527
 	                		     "job-sheets=\"%s,%s\", "
dc9527
@@ -1938,18 +1899,18 @@ add_job(cupsd_client_t  *con,		/* I - Cl
dc9527
         if (attr->num_values > 1 &&
dc9527
 	    !strcmp(attr->values[0].string.text, attr->values[1].string.text))
dc9527
 	{
dc9527
-          cupsdSetString(&(attr->values[0].string.text), Classification);
dc9527
-          cupsdSetString(&(attr->values[1].string.text), Classification);
dc9527
+          ippSetString(job->attrs, &attr, 0, Classification);
dc9527
+          ippSetString(job->attrs, &attr, 1, Classification);
dc9527
 	}
dc9527
         else
dc9527
 	{
dc9527
           if (attr->num_values == 1 ||
dc9527
 	      strcmp(attr->values[0].string.text, "none"))
dc9527
-            cupsdSetString(&(attr->values[0].string.text), Classification);
dc9527
+            ippSetString(job->attrs, &attr, 0, Classification);
dc9527
 
dc9527
           if (attr->num_values > 1 &&
dc9527
 	      strcmp(attr->values[1].string.text, "none"))
dc9527
-            cupsdSetString(&(attr->values[1].string.text), Classification);
dc9527
+	    ippSetString(job->attrs, &attr, 1, Classification);
dc9527
         }
dc9527
 
dc9527
         if (attr->num_values > 1)
dc9527
@@ -3185,8 +3146,8 @@ authenticate_job(cupsd_client_t  *con,	/
dc9527
 
dc9527
   if (attr)
dc9527
   {
dc9527
-    attr->value_tag = IPP_TAG_KEYWORD;
dc9527
-    cupsdSetString(&(attr->values[0].string.text), "no-hold");
dc9527
+    ippSetValueTag(job->attrs, &attr, IPP_TAG_KEYWORD);
dc9527
+    ippSetString(job->attrs, &attr, 0, "no-hold");
dc9527
   }
dc9527
 
dc9527
  /*
dc9527
@@ -8413,11 +8374,7 @@ print_job(cupsd_client_t  *con,		/* I -
dc9527
              filetype->type);
dc9527
 
dc9527
     if (format)
dc9527
-    {
dc9527
-      _cupsStrFree(format->values[0].string.text);
dc9527
-
dc9527
-      format->values[0].string.text = _cupsStrAlloc(mimetype);
dc9527
-    }
dc9527
+      ippSetString(con->request, &format, 0, mimetype);
dc9527
     else
dc9527
       ippAddString(con->request, IPP_TAG_JOB, IPP_TAG_MIMETYPE,
dc9527
 	           "document-format", NULL, mimetype);
dc9527
@@ -8952,10 +8909,8 @@ release_job(cupsd_client_t  *con,	/* I -
dc9527
 
dc9527
   if (attr)
dc9527
   {
dc9527
-    _cupsStrFree(attr->values[0].string.text);
dc9527
-
dc9527
-    attr->value_tag = IPP_TAG_KEYWORD;
dc9527
-    attr->values[0].string.text = _cupsStrAlloc("no-hold");
dc9527
+    ippSetValueTag(job->attrs, &attr, IPP_TAG_KEYWORD);
dc9527
+    ippSetString(job->attrs, &attr, 0, "no-hold");
dc9527
 
dc9527
     cupsdAddEvent(CUPSD_EVENT_JOB_CONFIG_CHANGED, cupsdFindDest(job->dest), job,
dc9527
                   "Job job-hold-until value changed by user.");
dc9527
@@ -9648,11 +9603,7 @@ send_document(cupsd_client_t  *con,	/* I
dc9527
 
dc9527
     if ((jformat = ippFindAttribute(job->attrs, "document-format",
dc9527
                                     IPP_TAG_MIMETYPE)) != NULL)
dc9527
-    {
dc9527
-      _cupsStrFree(jformat->values[0].string.text);
dc9527
-
dc9527
-      jformat->values[0].string.text = _cupsStrAlloc(mimetype);
dc9527
-    }
dc9527
+      ippSetString(job->attrs, &jformat, 0, mimetype);
dc9527
     else
dc9527
       ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_MIMETYPE,
dc9527
 	           "document-format", NULL, mimetype);
dc9527
diff -up cups-1.6.3/scheduler/job.c.str4609 cups-1.6.3/scheduler/job.c
dc9527
--- cups-1.6.3/scheduler/job.c.str4609	2015-06-10 11:44:39.495600976 +0200
dc9527
+++ cups-1.6.3/scheduler/job.c	2015-06-10 11:44:39.586600728 +0200
dc9527
@@ -430,7 +430,7 @@ cupsdCheckJobs(void)
dc9527
 
dc9527
           if ((attr = ippFindAttribute(job->attrs, "job-actual-printer-uri",
dc9527
 	                               IPP_TAG_URI)) != NULL)
dc9527
-            cupsdSetString(&attr->values[0].string.text, printer->uri);
dc9527
+            ippSetString(job->attrs, &attr, 0, printer->uri);
dc9527
 	  else
dc9527
 	    ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_URI,
dc9527
 	                 "job-actual-printer-uri", NULL, printer->uri);
dc9527
@@ -2138,7 +2138,7 @@ cupsdMoveJob(cupsd_job_t     *job,	/* I
dc9527
 
dc9527
   if ((attr = ippFindAttribute(job->attrs, "job-printer-uri",
dc9527
                                IPP_TAG_URI)) != NULL)
dc9527
-    cupsdSetString(&(attr->values[0].string.text), p->uri);
dc9527
+    ippSetString(job->attrs, &attr, 0, p->uri);
dc9527
 
dc9527
   cupsdAddEvent(CUPSD_EVENT_JOB_STOPPED, p, job,
dc9527
                 "Job #%d moved from %s to %s.", job->id, olddest,
dc9527
@@ -2329,7 +2329,7 @@ cupsdSetJobHoldUntil(cupsd_job_t *job,	/
dc9527
       attr = ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_NAME);
dc9527
 
dc9527
     if (attr)
dc9527
-      cupsdSetString(&(attr->values[0].string.text), when);
dc9527
+      ippSetString(job->attrs, &attr, 0, when);
dc9527
     else
dc9527
       attr = ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_KEYWORD,
dc9527
                           "job-hold-until", NULL, when);
dc9527
@@ -2583,8 +2583,8 @@ cupsdSetJobState(
dc9527
 
dc9527
 	if (attr)
dc9527
 	{
dc9527
-	  attr->value_tag = IPP_TAG_KEYWORD;
dc9527
-	  cupsdSetString(&(attr->values[0].string.text), "no-hold");
dc9527
+	  ippSetValueTag(job->attrs, &attr, IPP_TAG_KEYWORD);
dc9527
+	  ippSetString(job->attrs, &attr, 0, "no-hold");
dc9527
 	}
dc9527
 
dc9527
     default :
dc9527
@@ -4531,7 +4531,7 @@ start_job(cupsd_job_t     *job,		/* I -
dc9527
                                             "job-printer-state-message",
dc9527
                                             IPP_TAG_TEXT);
dc9527
   if (job->printer_message)
dc9527
-    cupsdSetString(&(job->printer_message->values[0].string.text), "");
dc9527
+    ippSetString(job->attrs, &job->printer_message, 0, "");
dc9527
 
dc9527
   ippSetString(job->attrs, &job->reasons, 0, "job-printing");
dc9527
   cupsdSetJobState(job, IPP_JOB_PROCESSING, CUPSD_JOB_DEFAULT, NULL);
dc9527
@@ -5109,15 +5109,14 @@ update_job_attrs(cupsd_job_t *job,	/* I
dc9527
   if (job->state_value != IPP_JOB_PROCESSING &&
dc9527
       job->status_level == CUPSD_LOG_INFO)
dc9527
   {
dc9527
-    cupsdSetString(&(job->printer_message->values[0].string.text), "");
dc9527
+    ippSetString(job->attrs, &job->printer_message, 0, "");
dc9527
 
dc9527
     job->dirty = 1;
dc9527
     cupsdMarkDirty(CUPSD_DIRTY_JOBS);
dc9527
   }
dc9527
   else if (job->printer->state_message[0] && do_message)
dc9527
   {
dc9527
-    cupsdSetString(&(job->printer_message->values[0].string.text),
dc9527
-		   job->printer->state_message);
dc9527
+    ippSetString(job->attrs, &job->printer_message, 0, job->printer->state_message);
dc9527
 
dc9527
     job->dirty = 1;
dc9527
     cupsdMarkDirty(CUPSD_DIRTY_JOBS);