bug in api_DosPrintQGetInfo ?

Martin Koller kollix at aon.at
Sat Oct 20 09:00:01 UTC 2018


I'm a senior C++ developer, and
for a customer I need to do printing from a VmWare Windows 98 client to the hosts CUPS printers.

I encountered the problem that each time I do a simple "print test page" the printer in Win98
got disabled (offline), and in the Samba logs I found:
"SPOOLSS Buffer: *r->out.info but there's no r->in.buffer"

Digging into the source code, I found the reason:
The function api_DosPrintQGetInfo() calls rpccli_spoolss_enumjobs() passing
an "offered" value with 0, which in cli_spoolss.c leads to not passing a buffer
to dcerpc_spoolss_EnumJobs():
(offered > 0) ? &buffer : NULL,

What I tried is to just pass instead the value 1 for "offered", which nicely fixed the problem.

However since I have no clue about the samba internals, could someone give me a hint
what this "offered" value stands for and if the following patch would be correct in general, please ?

diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index dcc7f916d6e..6687379c8e5 100644
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -902,7 +902,7 @@ static bool api_DosPrintQGetInfo(struct smbd_server_connection *sconn,
                                               0, /* firstjob */
                                               0xff, /* numjobs */
                                               2, /* level */
-                                              0, /* offered */
+                                               1, /* offered */
                if (!W_ERROR_IS_OK(werr)) {

Best regards/Schöne Grüße

A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad?

()  ascii ribbon campaign - against html e-mail 
/\                        - against proprietary attachments

Geschenkideen, Accessoires, Seifen, Kulinarisches: www.lillehus.at

More information about the samba-technical mailing list