[cups.bugs] [LOW] STR #1945: cupsrc config file Servername host:port is not always used.

karl runge runge at karlrunge.com
Wed Aug 30 04:13:04 PDT 2006


[STR New]

Submitting Forum post as bug:

-------------------------------------------------------------------
Is STR #906 (cupsrc server:port) working?

Hi,

Is STR #906 fully implemented?  It doesn't seem to work for me in
many cases.  http://www.cups.org/str.php?L906

The STR #906 feature allows for ~/.cups/client.conf or ~/.cupsrc
specifications like this:

ServerName localhost:6631

An example use being one has (temporarily) set up an SSH tunnel, e.g.:

    ssh -R 6631:localhost:631 user at remote-machine

to print from applications running on remote-machine to the printer(s)
on his local machine (presumably where he is sitting).

This is convenient because one just edits ~/.cupsrc (perhaps
automatically in the ssh) and does not have to restart the applications
setting the env. variable IPP_PORT=6631.

A useful use of this would be for VNC or NX sessions to print where you
happen to be sitting.  Other handy uses can be thought up.

I am trying this out for cups 1.2.2 on a debian based system:

 cupsys-client           1.2.2-0ubuntu0.6.06
 libcupsys2              1.2.2-0ubuntu0.6.06

Using a ~/.cupsrc and ~/.cups/client.conf with
"ServerName localhost:6631"
and an ssh tunnel redirecting it to my local cups server one would
expect this to talk to my local cups server directly:

        lpstat -p -d

It doesn't, it still talks to the one on the remote machine it is
running on.  If I do these they do use the ssh tunnel correctly:

        env IPP_PORT=6631 lpstat -p -d
        lpstat -h localhost:6631 -p -d

But these don't work:

        env CUPS_SERVER=localhost:6631 lpstat -p -d
        lpstat -p -d -h localhost:6631

(note the 2nd one is just a permutation of the cmdline args of a working
one, lpq also seems to have the same problem).

lpr and lp do print to my local cups server printer properly.  These work:

        lpr -P myprinter test.txt
        lp  -d myprinter test.txt

(i.e. they use the ssh tunnel without needing to be told on cmdline).

That lpr/lp works is good, but the main idea is that 3rd party
applications using the cups API, e.g. gui apps, should work too.

Even if the apps simply wind up calling lpr things don't always work
because the app picks up the wrong list of printers (i.e. those from
localhost:631, not my local ssh redired one) to display in its GUI.

I find none of these apps: gedit, openoffice, firefox use the server:port
listed in ~/.cupsrc correctly.  They just use the cups server running on
their machine.  However, if I manually restart these apps on the command
line and supply IPP_PORT=6631 they do use the ssh tunnel to the cups
server correctly.

Looking at cupsServer() in ./cups/usersys.c I wonder if this:

 /*
  * First see if we have already set the server name...
  */

  if (!cg->server[0])
  {
      --- CUPS_SERVER and .cupsrc server:port processing down here ---
      ...
  }

is the problem.  That is, the codepath that many apps induce cause
cg->server to be set somehow, and so when the time comes we don't get
the server:port processing we want?

BTW, my intent is not to use the #906 feature just for my personal use,
but rather to depend on it for some software I would like to deploy.
If it were just for me I would probably just live with the manual
IPP_PORT=6631 steps where each app is restarted.  But my target users
won't want to or won't be able to do this.

Please let me know if I am missing something about this.

Thanks,

Karl

Link: http://www.cups.org/str.php?L1945
Version: 1.2.2





More information about the cups-devel mailing list