[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#711848: cups-client: lp and lpr print the document on a wrong printer



On 2013-06-10 15:48:18 +0200, Vincent Lefevre wrote:
> If I output some messages in the cupsGetNamedDest() function
> of cups/dest.c as shown below:
> 
>  /*
>   * Get the printer's attributes...
>   */
> 
>   fprintf (stderr, "cupsGetNamedDest: %s\n", name ? name : "");
> 
>   if (!_cupsGetDests(http, op, name, &dest, 0, 0))
>   {
>     if (op == CUPS_GET_DEFAULT || (name && !set_as_default))
>       return (NULL);
> 
>     if (dest)
>       fprintf (stderr, "(1) dest->name: %s\n", dest->name ? dest->name : "");
> 
>    /*
>     * The default printer from environment variables or from a
>     * configuration file does not exist.  Find out the real default.
>     */
> 
>     if (!_cupsGetDests(http, CUPS_GET_DEFAULT, NULL, &dest, 0, 0))
>       return (NULL);
> 
>     if (dest)
>       fprintf (stderr, "(2) dest->name: %s\n", dest->name ? dest->name : "");
>   }
> 
> "lpr" (with no options) gives me:
> 
> cupsGetNamedDest: lipucb-mono-1
> (2) dest->name: lip-multi-1
> 
> The problem is here.

If I understand correctly, there may be actually 2 problems:

1. _cupsGetDests(http, op, name, &dest, 0, 0) failed while it
shouldn't.

2. In case of failure due to specified[*] but inexistent printer,
another printer is tried. This is a *wrong* behavior. The correct
behavior is to report an error in such a case. Otherwise, for
instance, if a document is sent to a private printer but something
goes wrong like here, it may end up on a public printer!

[*] by either a lpoptions config file or an environment variable.
The -P lpr option is handled directly in lpr, and cupsGetNamedDest
is not involved if this option is used; that's why everything is
fine with it.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


Reply to: