RFC 1179 lpr issue blocks queue (and patch for 1.1.23)

Damien Wiles dwiles at ucc.ac.uk
Mon Dec 12 06:17:20 PST 2005


If I get time (unlikely) I will try again with 1.2. However here's what I know.

The previously supplied diff seems to work fine for backends/lpd 1.1.23-r1 on gentoo which I guess is the same as 1.1.23 main. Apple is still using 1.1.* afaik. Would a unified diff for 1.2 yield an apple update for 1.1?, somehow I doubt it.

When I tried 1.2 (r4865) last week lpd seemed broken (as mentioned in my first post). All jobs came through as '.15username' instead of 'username'. this weeks 1.2 (r4876) looks similarly broken, i.e. "H.31%s\n" is wrong, so it puts H.31 before the whole of whatever is in s, instead of H and the first 31 characters of s (H%.31s), all this section is broken the same way.

Here's my best guess at a patch for backends/lpd from 1.2 (4876), see my previous post for the 1.1.23 patch (which was done with plain diff (and works fine with patch)).

--- lpd.c       2005-11-12 21:46:52.000000000 +0000
+++ lpd.c-fixed 2005-12-12 14:01:15.000000000 +0000
@@ -775,16 +775,16 @@
     httpGetHostname(localhost, sizeof(localhost));

     snprintf(control, sizeof(control),
-             "H.31%s\n"                /* RFC 1179, Section 7.2 - host name <= 31 chars */
-            "P.31%s\n"         /* RFC 1179, Section 7.2 - user name <= 31 chars */
-            "J.99%s\n",        /* RFC 1179, Section 7.2 - job name <= 99 chars */
+             "H%.31s\n"                /* RFC 1179, Section 7.2 - host name <= 31 chars */
+            "P%.31s\n"         /* RFC 1179, Section 7.2 - user name <= 31 chars */
+            "J%.99s\n",        /* RFC 1179, Section 7.2 - job name <= 99 chars */
             localhost, user, title);
     cptr = control + strlen(control);

     if (banner)
     {
       snprintf(cptr, sizeof(control) - (cptr - control),
-               "C.31%s\n"      /* RFC 1179, Section 7.2 - class name <= 31 chars */
+               "C%.31s\n"      /* RFC 1179, Section 7.2 - class name <= 31 chars */
               "L%s\n",
                localhost, user);
       cptr   += strlen(cptr);
@@ -799,7 +799,7 @@
     }

     snprintf(cptr, sizeof(control) - (cptr - control),
-             "UdfA%03d%.15s\nN%s\n",
+             "UdfA%03d%.15s\nN%.131s\n", /* RFC 1179, Section 7.2 - sourcefile name <= 131 chars */
              (int)getpid() % 1000, localhost, title);

     fprintf(stderr, "DEBUG: Control file is:\n%s", control);






More information about the cups mailing list