Samba Client Libraries 4.15.3-0 break WebDAV external storage access

Hello ,

Steps to reproduce

  1. In ​External Storage , Map a windows share (Windows 2016) to a shared directory with SMB “Personal (unique file IDs)” and “Log-in credentials, save in session”
  2. Map user Webdav directory in Windows 10 with Windows native webdav client
  3. Use samba client libraries 4.15.3-0
  4. Try to paste or create a file to the windows share directory (step1) in webdav drive

Expected behavior

The file must be created normally.

Actual behavior

Windows report that can’t read the file and thus cant be created , in log errors about the renaming part file to final file failed appears.

With downgrading the samba client libraries to 4.14.5-2 everything works again.

Server configuration

Operating system: CentOS Stream release 8

Web server: Server version: Apache/2.4.37 (centos)

Database: mysql Ver 15.1 Distrib 10.3.28-MariaDB, for Linux (x86_64) using readline 5.1

PHP version: 7.4.27

ownCloud version: 10.8.0.4

Updated from an older ownCloud or fresh install: updated

Where did you install ownCloud from: web

Signing status (ownCloud 9.0 and above): No errors have been found.

Login as admin user into your ownCloud and access 
http://example.com/index.php/settings/integrity/failed 
paste the results into https://gist.github.com/ and puth the link here.

The content of config/config.php: https://gist.github.com/jtsagar/4c31d455095c1659d4419b719cf2c3e5

Log in to the web-UI with an administrator account and click on
'admin' -> 'Generate Config Report' -> 'Download ownCloud config report'
This report includes the config.php settings, the list of activated apps
and other details in a well sanitized form.

or 

If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system
from within your ownCloud installation folder

*ATTENTION:* Do not post your config.php file in public as is. Please use one of the above
methods whenever possible. Both, the generated reports from the web-ui and from occ config:list
consistently remove sensitive data. You still may want to review the report before sending.
If done manually then it is critical for your own privacy to dilligently
remove *all* host names, passwords, usernames, salts and other credentials before posting.
You should assume that attackers find such information and will use them against your systems.

List of activated apps:

If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your ownCloud installation folder.

Are you using external storage, if yes which one: SMB

Are you using encryption: NO

Are you using an external user-backend, if yes which one: LDAP

LDAP configuration (delete this part if not used)

With access to your command line run e.g.:
sudo -u www-data php occ ldap:show-config
from within your ownCloud installation folder

Without access to your command line download the data/owncloud.db to your local
computer or access your SQL server remotely and run the select query:
SELECT * FROM `oc_appconfig` WHERE `appid` = 'user_ldap';


Eventually replace sensitive data as the name/IP-address of your LDAP server or groups.

Client configuration

Browser: Native WebDAV Client Windows 10

Operating system: Windows 10

Logs

Web server error log

Insert your webserver log here

ownCloud log (data/owncloud.log)

{"reqId":"Ydwt35luEVrPTrfWo-QGywAAAMU","level":3,"time":"2022-01-10T15:00:15+02:00","remoteAddr":"***REMOVED SENSITIVE VALUE***","user":"***REMOVED SENSITIVE VALUE***","app":"webdav","method":"PUT","url":"\/owncloud\/remote.php\/dav\/files\/***REMOVED SENSITIVE VALUE***\/02.Personal%20Data%20(H)\/OLY.txt","message":"renaming part file to final file failed"}
{"reqId":"Ydwt35luEVrPTrfWo-QGywAAAMU","level":4,"time":"2022-01-10T15:00:15+02:00","remoteAddr":"***REMOVED SENSITIVE VALUE***","user":"***REMOVED SENSITIVE VALUE***","app":"webdav","method":"PUT","url":"\/owncloud\/remote.php\/dav\/files\/***REMOVED SENSITIVE VALUE***\/02.Personal%20Data%20(H)\/OLY.txt","message":"Exception: HTTP\/1.1 500 Could not rename part file to final file: {\"Exception\":\"Sabre\\\\DAV\\\\Exception\",\"Message\":\"Could not rename part file to final file\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(1137): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\File->put()\\n#1 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(492): Sabre\\\\DAV\\\\Server->updateFile()\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/event\\\/lib\\\/WildcardEmitterTrait.php(89): Sabre\\\\DAV\\\\CorePlugin->httpPut()\\n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(472): Sabre\\\\DAV\\\\Server->emit()\\n#4 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(253): Sabre\\\\DAV\\\\Server->invokeMethod()\\n#5 \\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Server.php(334): Sabre\\\\DAV\\\\Server->start()\\n#6 \\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/appinfo\\\/v2\\\/remote.php(31): OCA\\\\DAV\\\\Server->exec()\\n#7 \\\/var\\\/www\\\/owncloud\\\/remote.php(165): require_once('\\\/var\\\/www\\\/ownclo...')\\n#8 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/File.php\",\"Line\":274}"}

Browser log

Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log 
c) ...
1 Like

It seems there is a problem renaming files with 4.15 in your environment. Please, try to isolate the issue:

  • Check that you can rename (an perform any basic operation) via smbclient against that server. ownCloud shouldn’t be involved. If it gives you errors, there might be a bug in the library
  • Try to connect to other SMB servers. There might be some incompatibility between the 4.15 library and your target server
  • Try to access through ownCloud but not from Windows. Windows, might be performing some operations that could be causing the issue.
1 Like

I found some time to further debug this issue, it seems that the blame is on the usual suspect, Windows.

Tested with smbclient (linux client), operates normal with the 4.15 libraries
Tested with WinSCP (windows client) , operates normal with 4.15 libraries
Tested with Windows WebDAV client , blocks the copy but rename works normally with 4.15 libraries (with 4.14 everything works normally)

After some additions in /owncloud/owncloud-www/apps/dav/lib/Connector/Sabre/File.php i concluded that in Line 265 : $renameOkay = $storage->moveFromStorage($partStorage, $internalPartPath, $internalPath); fails with empty result but the next line $fileExists = $storage->file_exists($internalPath); is ok with result true (1)

I will try setting ‘part_file_in_storage’ => false, just to see the result , but it is not viable for my installation as i use antivirus

I will keep searching…

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.