Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

Comments

@michaelrsweet
Copy link
Collaborator

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

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

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

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

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

@michaelrsweet
Copy link
Collaborator Author

"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 :
    

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

No branches or pull requests

1 participant