[cups.development] Printing to CUPS printer via LPR fromEmbedded System

Jon Peatfield J.S.Peatfield at damtp.cam.ac.uk
Mon Feb 16 17:41:27 PST 2009


On Mon, 16 Feb 2009, Ian wrote:

> Hi Jon,
>
> Thank you for your advice. Before I modify the cups-lpd.c file I have a quick question:
>
> Is it possible that cups-lpd doesn't have sufficient rights to a 
> temporary directory to store the incoming lpd control file? Is there a 
> particular spot that cups-lpd will try to create the control file?

The control file (or data file dependng on how far it is getting) are 
opened earlier in the same function and those appear to have the returns 
checked so I'd expect an error to be logged if they were failing:

....
       case 0x02 : /* Receive control file */
           if (strlen(name) < 2)
 	  {
 	    syslog(LOG_ERR, "Bad control file name \"%s\"", name);
 	    putchar(1);
 	    status = 1;
 	    break;
 	  }

           if (control[0])
 	  {
 	   /*
 	    * Append to the existing control file - the LPD spec is
 	    * not entirely clear, but at least the OS/2 LPD code sends
 	    * multiple control files per connection...
 	    */

 	    if ((fd = open(control, O_WRONLY)) < 0)
 	    {
 	      syslog(LOG_ERR,
 	             "Unable to append to temporary control file \"%s\" - %s",
         	     control, strerror(errno));
 	      putchar(1);
 	      status = 1;
 	      break;
 	    }
....

       case 0x03 : /* Receive data file */
           if (strlen(name) < 2)
 	  {
 	    syslog(LOG_ERR, "Bad data file name \"%s\"", name);
 	    putchar(1);
 	    status = 1;
 	    break;
 	  }

           if (num_data >= (int)(sizeof(data) / sizeof(data[0])))
 	  {
 	   /*
 	    * Too many data files...
 	    */

 	    syslog(LOG_ERR, "Too many data files (%d)", num_data);
 	    putchar(1);
 	    status = 1;
 	    break;
 	  }

 	  strlcpy(data[num_data], name, sizeof(data[0]));

           if ((fd = cupsTempFd(temp[num_data], sizeof(temp[0]))) < 0)
 	  {
 	    syslog(LOG_ERR, "Unable to open temporary data file \"%s\" - %s",
         	   temp[num_data], strerror(errno));
 	    putchar(1);
 	    status = 1;
 	    break;
 	  }
....

In any case you said that it worked from a different lpd client...

btw who wrote the lpd implementation which is failing to send to cups-lpd?

  -- Jon





More information about the cups mailing list