[Samba] smbsrv_reply_printwrite not returning a response causing the print job to be truncated to 124 bytes

Jeremy Allison jra at samba.org
Thu Apr 29 16:32:00 UTC 2021


On Thu, Apr 29, 2021 at 12:42:50PM +0200, Mateusz Mikołajczyk via samba wrote:
>I haven't received last email but I can see your text appearing on the web
>archive of the mailing list - I hope I'm replying in a correct way :)
>
>I'm using the binaries from debian buster - the exact version
>is 4.9.5+dfsg-5+deb10u1+rpi1 but I've also compiled latest stable release:
>4.14.3. from what I could tell on github, last changes to this function
>were made ~15 years ago
>
>I've seen this issue has appeared already on the mailing list and I wrote
>to the authors of the tickets and one of them responded that the last
>version of samba that was working (that he checked) with this printing
>protocol was 3.0.3. I have then looked inside the 3.0.3 source and the
>function that implements this there is called reply_printwrite and at the
>very beginning of the function I can see those two zeroes (one of them is
>presumably 16 bit):
>
>int outsize = set_message(outbuf,0,0,True);

Looks like reply_printwrite() is missing setting the reply buffer.

Can you try adding the following patch ?

$ git diff
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index dcda32e8cc1..f7b0fe72f13 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -7059,6 +7059,8 @@ void reply_printwrite(struct smb_request *req)

         DEBUG(3, ("printwrite %s num=%d\n", fsp_fnum_dbg(fsp), numtowrite));

+       reply_outbuf(req, 0, 0);
+
         END_PROFILE(SMBsplwr);
         return;
  }

I'm guessing this will fix it. If so it should be an easy
patch to get upstream.



More information about the samba mailing list