Bug 12195 - Not listing printers when name is greater than 15 characters and printcap is /etc/printcap
Not listing printers when name is greater than 15 characters and printcap is ...
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Printing
All All
: P5 normal
: ---
Assigned To: Jeremy Allison
Samba QA Contact
Depends on:
  Show dependency treegraph
Reported: 2016-08-30 19:04 UTC by Luiz Angelo Daros de Luca
Modified: 2016-08-30 19:31 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Luiz Angelo Daros de Luca 2016-08-30 19:04:59 UTC

It seems that samba does not like to load a printer from /etc/printcap when its name is greater than 15 characters.

 printcap name = /etc/printcap

The code seems to do just that:

 109                         if (strlen(p) <= MAXPRINTERLEN && *name == '\0' && !has_punctuation) {
 110                                 strlcpy(name, p, sizeof(name));
 111                                 continue;
 112                         }
 114                         if (!strchr_m(comment, ' ') &&
 115                             strlen(p) > strlen(comment)) {
 116                                 strlcpy(comment, p, sizeof(comment));
 117                                 continue;
 118                         }

However, MAXPRINTERLEN at 15 is not the current reality. It should, at most, warn with something like "WARNING: You have some printer names that are longer than 15 characters. These may not be accessible to some older clients."

Could this check be simply removed?

Using "printcap name = cups" does not have this limitation.
Comment 1 Jeremy Allison 2016-08-30 19:31:45 UTC
Yep, MAXPRINTERLEN is only used there so it will cause no harm to just delete it. Thanks for bringing it up !