The SMB server in my HP Photosmart 2610 all-in-one printer does not accept operation "Write and X", therefore I patched source/client/client.c so smbclient tries a "Write" (0x0b) operation if "Write and X" (0x2f) fails. It is a normal bug, because this printer accepts its printing works directly via TCP on port 9100. I append the diff of the patch. Thanks, Ramon Casares diff -u client/original.client.c client/client.c --- client/original.client.c 2006-05-13 10:47:58.000000000 +0200 +++ client/client.c 2006-05-13 11:06:25.000000000 +0200 @@ -1237,9 +1237,13 @@ ret = cli_write(targetcli, fnum, 0, buf, nread + start, n); if (n != ret) { - d_printf("Error writing file: %s\n", cli_errstr(cli)); - rc = 1; - break; + /* before giving-up, lets try another way - RMCG */ + ret = cli_smbwrite(targetcli, fnum, buf, nread + start, n); + if (n != ret) { + d_printf("Error writing file: %s\n", cli_errstr(cli)); + rc = 1; + break; + } } nread += n;
Created attachment 1898 [details] diff -u client/original.client.c client/client.c
My patch only works with files under 8k. $ cmp eco.pdf Downloads/eco.pdf eco.pdf Downloads/eco.pdf differ: byte 8209, line 76 $ cmp TETEXDOC.pdf Downloads/TETEXDOC.pdf TETEXDOC.pdf Downloads/TETEXDOC.pdf differ: byte 8209, line 50 So the first error is always in byte 8209 (?). Then I tried a 8136 bytes long file, and no errors were found. I don't know why, but a $ grep -r "cli_smbwrite(" source shows that Samba only uses function "cli_smbwrite", which is the one that sends "Write" operations instead of "Write and X", in: source/include/proto.h: the header file source/libsmb/clireadwrite.c: where the function is defined source/torture/torture.c: where it is tested So, it is defined, declared, and tested, but not used! Perhaps it is just a relic of ancient times and not really mantained. On the other hand, the SMB server in the printer has some other peculiarities, so it is possibly only a partial implementation, enough to work with a specially tunned HP client, but not really open to the world. So, I will close the bug. Sorry for the time you wasted reading this.