Bug 12195 - Not listing printers when name is greater than 15 characters and printcap is /etc/printcap
Summary: Not listing printers when name is greater than 15 characters and printcap is ...
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Printing (show other bugs)
Version: 4.2.4
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
Depends on:
Reported: 2016-08-30 19:04 UTC by Luiz Angelo Daros de Luca
Modified: 2016-11-16 07:25 UTC (History)
3 users (show)

See Also:

patch for 4.5 (3.67 KB, patch)
2016-11-11 08:42 UTC, Andreas Schneider
jra: review+
patch for 4.4 (3.67 KB, patch)
2016-11-11 08:43 UTC, Andreas Schneider
jra: review+

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 !
Comment 2 Andreas Schneider 2016-11-11 08:42:55 UTC
Created attachment 12650 [details]
patch for 4.5
Comment 3 Andreas Schneider 2016-11-11 08:43:22 UTC
Created attachment 12651 [details]
patch for 4.4
Comment 4 Jeremy Allison 2016-11-11 19:28:12 UTC
Re-assigning to Karolin for inclusion in 4.5.next, 4.4.next.
Comment 5 Karolin Seeger 2016-11-14 11:28:52 UTC
(In reply to Jeremy Allison from comment #4)
Pushed to autobuild-v4-{4,5}-test.
Comment 6 Karolin Seeger 2016-11-16 07:25:14 UTC
(In reply to Karolin Seeger from comment #5)
Pushed to both branches.
Closing out bug report.