CUPS unescapes quotes in print options, but does not escape them again #839

Closed
michaelrsweet opened this Issue Aug 5, 2004 · 3 comments

Comments

Projects
None yet
1 participant
Collaborator

michaelrsweet commented Aug 5, 2004

Version: 1.1.21rc1
CUPS.org User: qtb.oce

When I print with the CUPS lpr client, the print options are parsed from the commandline with cupsParseOptions(). Then the job is sent to the CUPS server, and when it arrives at a CUPS filter, the quotes from the print options are still unescaped, so parsing with cupsParseOptions() in a CUPS filter will fail this time;

for example, I run lpr like this:

lpr printfile.ps -o subject='guns n' roses'

finally it arrives at my CUPS filter like this:

printfilter [argv1] [argv2] [argv3] [argv4] subject='guns n' roses'

I'm using Debian with a 2.4.20 linux kernel, CUPS 1.1.21rc1, and GCC 3.3.4

Collaborator

michaelrsweet commented Aug 11, 2004

CUPS.org User: mike

Please let me know how the attached patch works for you.

Collaborator

michaelrsweet commented Aug 11, 2004

CUPS.org User: mike

Fixed in CVS - the anonymous CVS repository will be updated at midnight EST.

Collaborator

michaelrsweet commented Aug 28, 2004

"str839.patch":

Index: job.c

RCS file: /development/cvs/cups/scheduler/job.c,v
retrieving revision 1.227
diff -u -r1.227 job.c
--- job.c 29 Jun 2004 03:27:35 -0000 1.227
+++ job.c 11 Aug 2004 14:55:52 -0000
@@ -1175,7 +1175,8 @@
int num_filters; /* Number of filters for job /
mime_filter_t *filters; /
Filters for job /
char method[255], /
Method for output */

  •   _optptr;        /_ Pointer to options */
    
  •   _optptr,        /_ Pointer to options */
    
  •   _valptr;        /_ Pointer in value string _/
    
    ipp_attribute_t *attr; /_ Current attribute /
    int pid; /
    Process ID of new filter process /
    int banner_page; /
    1 if banner page, 0 otherwise */
    @@ -1582,18 +1583,14 @@
    case IPP_TAG_KEYWORD :
    case IPP_TAG_CHARSET :
    case IPP_TAG_LANGUAGE :
  •     if (strchr(attr->values[i].string.text, ' ') != NULL ||
    
  •     strchr(attr->values[i].string.text, '\t') != NULL ||
    
  •     strchr(attr->values[i].string.text, '\n') != NULL)
    
  •     for (valptr = attr->values[i].string.text, ' '); *valptr;)
      {
    
  •   strlcat(optptr, "\'", optlength - (optptr - options));
    
  •   strlcat(optptr, attr->values[i].string.text,
    
  •           optlength - (optptr - options));
    
  •   strlcat(optptr, "\'", optlength - (optptr - options));
    
  •       if (strchr(" \t\n\\'\"", *valptr))
    
  •     *optptr++ = '\';
    
  •   *optptr++ = *valptr++;
      }
    
  •     else
    
  •   strlcat(optptr, attr->values[i].string.text,
    
  •           optlength - (optptr - options));
    
  •     *optptr = '\0';
      break;
    
       default :
    

michaelrsweet added this to the Stable milestone Mar 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment