Unable to use smbclient with BackupPC to backup windows computers. Worked up to Samba 4.12.10 and isn't working on 4.21.3. Steps to reproduce: 1) Have a windows 10 computer with a c-drive shared. 2) From a server with smbclient 4.21.3, run the following command: touch /tmp/current-time smbclient \\\\testpc\\c\$ -U administrator-E -d1 -c tarmode\ full -TcN /tmp/current-time - / The listing will eventually fail with a return code of 1. Running the same test from a server with smbclient 4.12.10, the command finishes with statistics and a return code of 0 (success). Backuppc gets the error and is unable to complete a backup. Sample output: newer server backup of a win10 machine (broken) server1% touch /tmp/current-time server1% smbclient \\\\testpc\\c\$ -U administrator-E -d1 -c tarmode\ full -TcN /tmp/current-time - / <tons deleted> ... 6 037651 5ustar00000000 000000 ./testuser/AppData/Roaming/Mozilla/Firefox/Profilesk3s3qyvg.default/storage/private/uuid+++f3205b4a-e7c4-4014-9927-f73d3ad24818/cache/morgue/129/000755 000000 000000 00000000000 14751170325 036746 5ustar00000000 000000 ./testuser/AppData/Roaming/Mozilla/Firefox/Profilesk3s3qyvg.default/storage/private/uuid+++f3205b4a-e7c4-4014-9927-f73d3ad24818/cache/morgue/46/000755 000000 000000 00000000000 14751170325 036664 5ustar00000000 000000 ./testuser/AppData/Roaming/Mozilla/Firefox/ProfilesChrome/User Data/Default/Storage/ext/nmmhkkegccagdldgiimedpiccmgmieda/def/Code Cache/js/index-dir/000755 000000 000000 00000000000 13546142765 036326 5ustar00000000 000000 ./testuser/AppData/Local/Googletar:815 do_list failed on (NT_STATUS_ACCESS_DENIED) Chrome/User Data/Default/Storage/ext/nmmhkkegccagdldgiimedpiccmgmieda/def/Code Cache/wasm/index-dir/000755 000000 000000 00000000000 14005043356 036644 5ustar00000000 000000 ./testuser/AppData/Local/GoogleEdge/User Data/Default/Storage/ext/ihmafllikibpmigkcoadcmckbfhibefp/def/Code Cache/js/index-dir/000755 000000 000000 00000000000 14721513122 036500 5ustar00000000 000000 ./testuser/AppData/Local/MicrosoftEdge/User Data/Default/Storage/ext/ihmafllikibpmigkcoadcmckbfhibefp/def/Code Cache/wasm/index-dir/000755 000000 000000 00000000000 14721513076 037043 5ustar00000000 000000 ./testuser/AppData/Local/MicrosoftDefault/Storage/ext/ihmafllikibpmigkcoadcmckbfhibefp/def/Shared Dictionary/cache/index-dir/000755 000000 000000 00000000000 14721513076 040575 5ustar00000000 000000 ./testuser/AppData/Local/Microsoft/Edge/User DataAppData/Local/Microsoft/Windows/INetCache/Virtualized/C/Users/testuser/AppData/Local/Microsoft/Windows/000755 000000 000000 00000000000 13717227376 033023 5ustar00000000 000000 ./testuserMicrosoft/Windows/INetCache/Virtualized/C/Users/testuser/AppData/Local/Microsoft/Windows/INetCache/000755 000000 000000 00000000000 13717227376 034606 5ustar00000000 000000 ./testuser/AppData/LocalMicrosoft/Windows/INetCache/Virtualized/C/Users/testuser/AppData/Local/Microsoft/Windows/INetCookies/000755 000000 000000 00000000000 13717227376 035177 5ustar00000000 000000 ./testuser/AppData/Local/ server1% echo $? 1 server1% smbclient -V Version 4.21.3 ====================================== working server backup of a win10 machine (works) server2% touch /tmp/current-time server2% smbclient \\\\testpc\\c\$ -U administrator -E -d1 -c tarmode\ full -TcN /tmp/current-time - / <tons deleted> ... NT_STATUS_ACCESS_DENIED listing \testuser\Recent\* NT_STATUS_ACCESS_DENIED listing \testuser\SendTo\* NT_STATUS_ACCESS_DENIED listing \testuser\Start Menu\* NT_STATUS_ACCESS_DENIED listing \testuser\Templates\* tar: dumped 56 files and 8558 directories Total bytes written: 29719579 (0.6 MiB/s) ./testuser/PrintHood/000755 000000 000000 00000000000 13666076670 012273 5ustar00000000 000000 ./testuser/Recent/00075 5 000000 000000 00000000000 13666076670 011605 5ustar00000000 000000 ./testuser/Saved Games/000755 000000 000000 0 0000000000 13223255447 012432 5ustar00000000 000000 ./testuser/Searches/000755 000000 000000 00000000000 132232562 53 012104 5ustar00000000 000000 ./testuser/SendTo/000755 000000 000000 00000000000 13666076670 011561 5ustar000000 00 000000 ./testuser/Start Menu/000755 000000 000000 00000000000 13666076670 012347 5ustar00000000 000000 ./testuser/T emplates/000755 000000 000000 00000000000 13666076670 012323 5ustar00000000 000000 ./testuser/Videos/000755 000000 000000 00000000000 13666077431 011612 5ustar00000000 000000 server2% echo $? 0 server2% smbclient -V Version 4.12.10
In debugging this, smbclient will error out in two places. source3/client/clitar.h ------------------ Line 814: if (!NT_STATUS_IS_OK(status)) { DBG(0, ("do_list failed on %s (%s)\n", path, nt_errstr(status))); err = 1; goto out; } ----------------- do_list is NULL at this check. It appears that the listing of directories in the smblcient tar command isn't finding any directories for some reason. A similar thing happens at line 716: ------------------- if (!NT_STATUS_IS_OK(status)) { DBG(0, ("do_list fail %s\n", nt_errstr(status))); err = 1; goto out_close; } ------------------- Removing these two checks for !NT_STATUS_IS_OK results in the smbclient command returning a status 0 and the resulting tar backup file is useful. The previous "status" line shows that "do_list" is null: status = do_list(mask, TAR_DO_LIST_ATTR, get_file_callback, true, true); ========================= Updated steps to reproduce (to filter out a bunch of junk) Broken (4.21.4) $ smbclient //testpc/users -U root -E -d 1 -c tarmode\ full -Tcr - / > out.tar (removed information messages about directories) ... tar:815 do_list failed on (NT_STATUS_ACCESS_DENIED) This is supposed to print the "do_list", but it is null, hence why it doesn't say anything after "failed on ". It's blank. exit code is 1 -------------- Works (4.12.10) $ smbclient //testpc/users -U root -E -d 1 -c tarmode\ full -Tcr - / > out.tar (removed information messages about directories) ... tar: dumped 89918 files and 11152 directories Total bytes written: 13072140357 (25.6 MiB/s) exit code is 0 --------------- Edited source3/client/clitar.c. Removed the two checks for !NT_STATUS_IS_OK at line 814 AND line 716 and recompiled. It now "works", but note that the "Directories" counter is 0. $ smbclient //testpc/users -U root -E -d 1 -c tarmode\ full -Tcr - / > out.tar (removed information messages about directories) ... tar: dumped 89875 files and 0 directories Total bytes written: 13070590036 (28.0 MiB/s) exit code is 0 Created tar file is usable. I'm not a programmer, only trying to show where I believe the error is happening.