Commit a41b12bc authored by Natanael Copa's avatar Natanael Copa

main/samba: work around issue with NetApp

https://bugzilla.samba.org/show_bug.cgi?id=12776
parent f4e9419e
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=samba
pkgver=4.6.1
pkgrel=1
pkgrel=2
pkgdesc="Tools to access a server's filespace and printers via SMB"
url="http://www.samba.org"
arch="all"
......@@ -48,6 +48,7 @@ source="https://us1.samba.org/samba/ftp/stable/$pkgname-$pkgver.tar.gz
domain.patch
getpwent_r.patch
netdb-defines.patch
netapp.patch
$pkgname.initd
$pkgname.confd
......@@ -522,6 +523,7 @@ b43809d7ecbf3968f5154c2ded6ed47dae36921f1895ea98bcce50557eb2ad39b736345ffb421465
62d373dbaee75121a1d73f2c09cdca7239705808ff807b171d1d5a28fd4ffc66bdb52494b62786d7aaba8aeece5c08433b532ca96a28d712452fe9daac8d8d2e domain.patch
0d4fd9862191554dc9c724cec0b94fd19afbfd0c4ed619e4c620c075e849cb3f3d44db1e5f119d890da23a3dd0068d9873703f3d86c47b91310521f37356208b getpwent_r.patch
1854577d0e4457e27da367a6c7ec0fb5cfd63cefea0a39181c9d6e78cf8d3eb50878cdddeea3daeec955d00263151c2f86ea754ff4276ef98bc52c0276d9ffe8 netdb-defines.patch
202667cb0383414d9289cd67574f5e1140c9a0ff63bb82a746a59b2397a00db15654bfb30cb5ec1cd68a097899be0f849d9aab4c0d210152386c9e66c640f0c0 netapp.patch
6bee83aab500f27248b315d8a5f567940d7232269b021d801b3d51c20ed9e4aad513ee0117f356fb388014a63a145beacb55307ef9addbf7997987304b548fcf samba.initd
4faf581ecef3ec38319e3c4ab6d3995c51fd7ba83180dc5553a2ff4dfb92efadb43030c543292130c4ed0c281dc0972c6973d52d48062c5edb39bb1c4bbb6dd6 samba.confd
f88ebe59ca3a9e9b77dd5993c13ef3e73a838efb8ed858088b464a330132d662f33e25c27819e38835389dee23057a3951de11bae1eef55db8ff5e1ec6760053 samba.logrotate"
https://bugzilla.samba.org/show_bug.cgi?id=12776
diff --git a/source3/include/client.h b/source3/include/client.h
index db8260d..becdf77 100644
--- a/source3/include/client.h
+++ b/source3/include/client.h
@@ -61,6 +61,9 @@ struct cli_state {
char *server_os;
char *server_domain;
+ /* is server_os spinstream2? true/false/not-yet-checked(-1) */
+ int is_spinstream2;
+
char *share;
char *dev;
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index bc5c1b1..6d6b725 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -112,6 +112,7 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
if (!cli->server_os) {
goto error;
}
+ cli->is_spinstream2 = -1;
cli->server_type = talloc_strdup(cli, "");
if (!cli->server_type) {
goto error;
@@ -430,6 +431,24 @@ time_t cli_state_server_time(struct cli_state *cli)
return t;
}
+bool cli_state_server_is_spinstream2(struct cli_state *cli)
+{
+ int *ret = &cli->is_spinstream2;
+ if (*ret == -1) {
+ if (*cli->server_os == '\0') {
+ DEBUG(1, ("when checking if server is SpinStream2:"
+ " server_os field is empty (should have"
+ " been sent in Session Setup protocol"
+ " response), so ... presuming not"));
+ *ret = 0;
+ }
+ else {
+ *ret = strequal(cli->server_os, "SpinStream2") ? 1 : 0;
+ }
+ }
+ return *ret == 1;
+}
+
struct cli_echo_state {
bool is_smb2;
};
diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c
index 3987477..6371bc2 100644
--- a/source3/libsmb/clireadwrite.c
+++ b/source3/libsmb/clireadwrite.c
@@ -89,6 +89,13 @@ static size_t cli_write_max_bufsize(struct cli_state *cli,
useable_space = 0xFFFFFF - data_offset;
} else if (smb1cli_conn_capabilities(cli->conn) & CAP_LARGE_WRITEX) {
useable_space = 0x1FFFF - data_offset;
+ if (cli_state_server_is_spinstream2(cli))
+ /*
+ * SpinStream2 (NetApp OnTAP, up to 8.3.2, at least;
+ * XXX may need to be more discerning than this)
+ * can't handle writes > 64k
+ */
+ useable_space = MIN(useable_space, 64 * 1024);
} else {
return min_space;
}
diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h
index b453733..e334cc6 100644
--- a/source3/libsmb/proto.h
+++ b/source3/libsmb/proto.h
@@ -203,6 +203,7 @@ uint16_t cli_state_set_uid(struct cli_state *cli, uint16_t uid);
bool cli_set_case_sensitive(struct cli_state *cli, bool case_sensitive);
uint32_t cli_state_available_size(struct cli_state *cli, uint32_t ofs);
time_t cli_state_server_time(struct cli_state *cli);
+bool cli_state_server_is_spinstream2(struct cli_state *cli);
struct tevent_req *cli_echo_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
struct cli_state *cli, uint16_t num_echos,
DATA_BLOB data);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment