Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Malformed state response from server #109

Open
MatthiasKuehneEllerhold opened this issue Nov 11, 2021 · 10 comments
Open

Malformed state response from server #109

MatthiasKuehneEllerhold opened this issue Nov 11, 2021 · 10 comments

Comments

@MatthiasKuehneEllerhold
Copy link
Contributor

Calling $share->stat('my/directory') returns this error:
"Malformed state response from server"

In fact $output is empty here! We're using the smbclient Backend, calling it manually returns correct data:

# smbclient -U USER -W workgroup \\\\server\\share
smb: \> allinfo "my/directory.not-exists"
NT_STATUS_OBJECT_NAME_NOT_FOUND getting alt name for \my/directory.not-exists

We're using the smbclient backend. Neither 4.9.5 (debian buster standard) nor 4.14.8 (van-belle repo) works. The server is an old Mac OS.

This problem only occurs on version 3.5.0 & 3.5.1! Version 3.4.1 is fine!

@MatthiasKuehneEllerhold
Copy link
Contributor Author

MatthiasKuehneEllerhold commented Jan 3, 2022

The same error now has occured with a debian server with Samba 4.14.11 auf! Downgrading to 3.4.1 works here too!

An additional error message was logged:

PHP Notice:  Undefined index: attributes in /var/www/vendor/icewind/smb/src/Wrapped/Parser.php on line 155

@jd1
Copy link

jd1 commented May 28, 2022

Same issue here. I'm using Nextcloud with external storage via SMB. Nextcloud uses icewind to access smbclient. I have smbclient 4.13.13 installed and there is no version 3.4.1 available on Ubuntu 20.04. So I can't downgrade it.

The Samba server is installed on FreeBSD and has version 4.13.17.

I can reproduce the issue if I try to to call stat() on a file which doesn't exist.
If the file exists, all information are already present can be fetched by the dir command:

SMB/src/Wrapped/Share.php

Lines 195 to 204 in 9132f32

if ($path !== "" && $path !== "/") {
$parent = dirname($path);
$dir = $this->dir($parent);
$file = array_values(array_filter($dir, function (IFileInfo $info) use ($path) {
return $info->getPath() === $path;
}));
if ($file) {
return $file[0];
}
}

But if the file doesn't exists, it can't be found in the directory and therefore allinfo is called:
$output = $this->execute('allinfo ' . $escapedPath);

The result of allinfo is an empy array. I think this is the root cause for the exception.

If I call allinfo with the smbclient, I get an error NT_STATUS_OBJECT_NAME_NOT_FOUND getting alt name for ...
I don't know why this error is not propagated into the php code.

@davidoe
Copy link

davidoe commented Jun 2, 2022

Same problem here, using Nextcloud 23.0.2 on Nextcloudpi

@Starkstromkonsument
Copy link

Same problem here, running Nextcloud 24.0.2 on Ubuntu Server 20.04 LTS with PHP 7.4.3

@peacepenguin
Copy link

Same issue, only affects a single folder that contains 488 files. All other folders are smaller, and work fine. Also individual files i can open, but if i select multiple then "Download" i get this error.

@joschkopf
Copy link

Same issue here. I tracked it down until I found that parseStat bails out, because the dir command returns as a final line e.g. "5860520960 blocks of size 1024. 2099970636 blocks available".
I commented out the code trying to get the information via "dir", but just use "allinfo" now, which seems to resolve the issue.

@MatthiasKuehneEllerhold
Copy link
Contributor Author

Same error with 3.5.4!

@NoFrust
Copy link

NoFrust commented Sep 16, 2022

I had the same problem using the latest docker image. Adding the following commands to the Dockerfile solved the issue for me:
RUN apt-get update && apt-get install -y smbclient libsmbclient-dev && rm -rf /var/lib/apt/lists/*
RUN pecl install smbclient
RUN docker-php-ext-enable smbclient

Before I installed the smbclient only. And with this I had the issue described above.
RUN apt-get update && apt-get install -y smbclient && rm -rf /var/lib/apt/lists/*

I got the hint from the following Dockerfile: https://github.com/nextcloud/docker/blob/master/.examples/dockerfiles/full/apache/Dockerfile

@MatthiasKuehneEllerhold
Copy link
Contributor Author

Ive now upgraded to PHP8.0 (from 7.4) and installed php8.0-smbclient (instead of using the the smbclient cli backend).
Version 3.5.4 now works correctly.
@NoFrust You're doing exactly that: libsmbclient instead of cli smbclient paired with a recent PHP version (presumably).

@LevAnni777
Copy link

LevAnni777 commented Jul 20, 2024

I had the same problem using the latest docker image. Adding the following commands to the Dockerfile solved the issue for me: RUN apt-get update && apt-get install -y smbclient libsmbclient-dev && rm -rf /var/lib/apt/lists/* RUN pecl install smbclient RUN docker-php-ext-enable smbclient

Before I installed the smbclient only. And with this I had the issue described above. RUN apt-get update && apt-get install -y smbclient && rm -rf /var/lib/apt/lists/*

I got the hint from the following Dockerfile: https://github.com/nextcloud/docker/blob/master/.examples/dockerfiles/full/apache/Dockerfile

I'm entering all these commands (except rm -rf /var/lib/apt/lists/*) and everything installs perfectly, I even see php extension installed by running php -m, but as soon as I restart my nextcloud instance the configuration returns everything back to its previous (native) installation through Truenas and I no longer see smbclient in the php extensions.

Any ideas?

can rm -rf /var/lib/apt/lists/* command somehow damage default installation method?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants