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 ...
Status: RESOLVED FIXED
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
URL:
Keywords:
Depends on:
Blocks:
 
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:


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

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
Hello,

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                         }
 113 
 114                         if (!strchr_m(comment, ' ') &&
 115                             strlen(p) > strlen(comment)) {
 116                                 strlcpy(comment, p, sizeof(comment));
 117                                 continue;
 118                         }
https://git.samba.org/?p=samba.git;a=blob;f=source3/printing/print_standard.c;h=b5f1056b2e6f1a6e8bbe55d43676e01b1d0811ea;hb=b27c976e2e958998bb17f9b443de3962276bbd4e#l109

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.

Thanks!