summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2006-04-22 20:52:54 +0000
committerGerald Carter <jerry@samba.org>2006-04-22 20:52:54 +0000
commit71cf4393e33dce24f30db18d9ff1df6113434476 (patch)
treea89442c8648f52c83e9726f5dbd52d76e59b7180 /source
parentf18aace9e04563926d99f5195558d287e7a6f7cf (diff)
downloadsamba-71cf4393e33dce24f30db18d9ff1df6113434476.tar.gz
r15164: grab a few more changes from SAMBA_3_0
Diffstat (limited to 'source')
-rw-r--r--source/include/client.h4
-rw-r--r--source/libsmb/cliconnect.c22
-rw-r--r--source/libsmb/clireadwrite.c6
-rw-r--r--source/nsswitch/winbind_nss_aix.c14
4 files changed, 33 insertions, 13 deletions
diff --git a/source/include/client.h b/source/include/client.h
index 30e0fae8744..c6d7b162fcd 100644
--- a/source/include/client.h
+++ b/source/include/client.h
@@ -27,7 +27,8 @@
overlap on the wire. This size gives us a nice read/write size, which
will be a multiple of the page size on almost any system */
#define CLI_BUFFER_SIZE (0xFFFF)
-#define CLI_MAX_LARGE_READX_SIZE (127*1024)
+#define CLI_SAMBA_MAX_LARGE_READX_SIZE (127*1024) /* Works for Samba servers */
+#define CLI_WINDOWS_MAX_LARGE_READX_SIZE ((64*1024)-2) /* Windows servers are broken.... */
/*
* These definitions depend on smb.h
@@ -143,6 +144,7 @@ struct cli_state {
unsigned int bufsize;
int initialised;
int win95;
+ BOOL is_samba;
uint32 capabilities;
BOOL dfsroot;
diff --git a/source/libsmb/cliconnect.c b/source/libsmb/cliconnect.c
index 48885f19d84..6b5de6d1439 100644
--- a/source/libsmb/cliconnect.c
+++ b/source/libsmb/cliconnect.c
@@ -199,6 +199,10 @@ static BOOL cli_session_setup_guest(struct cli_state *cli)
p += clistr_pull(cli, cli->server_type, p, sizeof(fstring), -1, STR_TERMINATE);
p += clistr_pull(cli, cli->server_domain, p, sizeof(fstring), -1, STR_TERMINATE);
+ if (strstr(cli->server_type, "Samba")) {
+ cli->is_samba = True;
+ }
+
fstrcpy(cli->user_name, "");
return True;
@@ -263,6 +267,10 @@ static BOOL cli_session_setup_plaintext(struct cli_state *cli, const char *user,
p += clistr_pull(cli, cli->server_domain, p, sizeof(fstring), -1, STR_TERMINATE);
fstrcpy(cli->user_name, user);
+ if (strstr(cli->server_type, "Samba")) {
+ cli->is_samba = True;
+ }
+
return True;
}
@@ -408,6 +416,10 @@ static BOOL cli_session_setup_nt1(struct cli_state *cli, const char *user,
p += clistr_pull(cli, cli->server_type, p, sizeof(fstring), -1, STR_TERMINATE);
p += clistr_pull(cli, cli->server_domain, p, sizeof(fstring), -1, STR_TERMINATE);
+ if (strstr(cli->server_type, "Samba")) {
+ cli->is_samba = True;
+ }
+
fstrcpy(cli->user_name, user);
if (session_key.data) {
@@ -873,6 +885,10 @@ BOOL cli_session_setup(struct cli_state *cli,
}
}
+ if (strstr(cli->server_type, "Samba")) {
+ cli->is_samba = True;
+ }
+
return True;
}
@@ -1159,9 +1175,9 @@ BOOL cli_negprot(struct cli_state *cli)
if (cli->capabilities & (CAP_LARGE_READX|CAP_LARGE_WRITEX)) {
SAFE_FREE(cli->outbuf);
SAFE_FREE(cli->inbuf);
- cli->outbuf = (char *)SMB_MALLOC(CLI_MAX_LARGE_READX_SIZE+SAFETY_MARGIN);
- cli->inbuf = (char *)SMB_MALLOC(CLI_MAX_LARGE_READX_SIZE+SAFETY_MARGIN);
- cli->bufsize = CLI_MAX_LARGE_READX_SIZE;
+ cli->outbuf = (char *)SMB_MALLOC(CLI_SAMBA_MAX_LARGE_READX_SIZE+SAFETY_MARGIN);
+ cli->inbuf = (char *)SMB_MALLOC(CLI_SAMBA_MAX_LARGE_READX_SIZE+SAFETY_MARGIN);
+ cli->bufsize = CLI_SAMBA_MAX_LARGE_READX_SIZE;
}
} else if (cli->protocol >= PROTOCOL_LANMAN1) {
diff --git a/source/libsmb/clireadwrite.c b/source/libsmb/clireadwrite.c
index 650822bf8ed..883bc1260d6 100644
--- a/source/libsmb/clireadwrite.c
+++ b/source/libsmb/clireadwrite.c
@@ -76,7 +76,11 @@ ssize_t cli_read(struct cli_state *cli, int fnum, char *buf, off_t offset, size_
*/
if (cli->capabilities & CAP_LARGE_READX) {
- readsize = CLI_MAX_LARGE_READX_SIZE;
+ if (cli->is_samba) {
+ readsize = CLI_SAMBA_MAX_LARGE_READX_SIZE;
+ } else {
+ readsize = CLI_WINDOWS_MAX_LARGE_READX_SIZE;
+ }
} else {
readsize = (cli->max_xmit - (smb_size+32)) & ~1023;
}
diff --git a/source/nsswitch/winbind_nss_aix.c b/source/nsswitch/winbind_nss_aix.c
index b898e3c3af2..c5d98dad067 100644
--- a/source/nsswitch/winbind_nss_aix.c
+++ b/source/nsswitch/winbind_nss_aix.c
@@ -632,19 +632,17 @@ static int wb_aix_user_attrib(const char *key, char *attributes[],
results[i].attr_un.au_char = strdup(pwd->pw_passwd);
} else if (strcmp(attributes[i], S_HOME) == 0) {
results[i].attr_un.au_char = strdup(pwd->pw_dir);
- } else if (strcmp(attributes[0], S_SHELL) == 0) {
+ } else if (strcmp(attributes[i], S_SHELL) == 0) {
results[i].attr_un.au_char = strdup(pwd->pw_shell);
- } else if (strcmp(attributes[0], S_REGISTRY) == 0) {
+ } else if (strcmp(attributes[i], S_REGISTRY) == 0) {
results[i].attr_un.au_char = strdup("WINBIND");
- } else if (strcmp(attributes[0], S_GECOS) == 0) {
+ } else if (strcmp(attributes[i], S_GECOS) == 0) {
results[i].attr_un.au_char = strdup(pwd->pw_gecos);
- } else if (strcmp(attributes[0], S_PGRP) == 0) {
+ } else if (strcmp(attributes[i], S_PGRP) == 0) {
results[i] = pwd_to_group(pwd);
- } else if (strcmp(attributes[0], S_GECOS) == 0) {
- results[i].attr_un.au_char = strdup(pwd->pw_gecos);
- } else if (strcmp(attributes[0], S_GROUPSIDS) == 0) {
+ } else if (strcmp(attributes[i], S_GROUPS) == 0) {
results[i] = pwd_to_groupsids(pwd);
- } else if (strcmp(attributes[0], "SID") == 0) {
+ } else if (strcmp(attributes[i], "SID") == 0) {
results[i] = pwd_to_sid(pwd);
} else {
logit("Unknown user attribute '%s'\n", attributes[i]);