If i use the -N option with smbtree I get a segmentation fault: e.g. smbtree -S -N =============================================================== INTERNAL ERROR: Signal 11: Segmentation fault in pid 17661 (4.16.5) If you are running a recent Samba version, and if you think this problem is not yet fixed in the latest versions, please co nsider reporting this bug, see https://wiki.samba.org/index.php/Bug_Reporting =============================================================== PANIC (pid 17661): Signal 11: Segmentation fault in 4.16.5 BACKTRACE: 17 stack frames: #0 /usr/local/samba/lib/libsamba-util.so.0(log_stack_trace+0x31) [0xb7df6680] #1 /usr/local/samba/lib/libsamba-util.so.0(smb_panic_log+0x1ad) [0xb7df65f9] #2 /usr/local/samba/lib/libsamba-util.so.0(smb_panic+0x1d) [0xb7df661c] #3 /usr/local/samba/lib/libsamba-util.so.0(+0xb13a) [0xb7df613a] #4 /usr/local/samba/lib/libsamba-util.so.0(+0xb155) [0xb7df6155] #5 linux-gate.so.1(__kernel_sigreturn+0) [0xb7f85564] #6 /lib/i386-linux-gnu/libc.so.6(+0x904f6) [0xb7b1d4f6] #7 /usr/local/samba/lib/private/libreplace-samba4.so(rep_strlcpy+0x1d) [0xb7cae286] #8 ./smbtree(+0x2aed) [0x48baed] #9 /usr/local/samba/lib/libsmbclient.so.0(+0x16662) [0xb7e9b662] #10 /usr/local/samba/lib/libsmbclient.so.0(+0x16886) [0xb7e9b886] #11 /usr/local/samba/lib/libsmbclient.so.0(+0x16b6e) [0xb7e9bb6e] #12 /usr/local/samba/lib/libsmbclient.so.0(+0x17965) [0xb7e9c965] #13 /usr/local/samba/lib/libsmbclient.so.0(+0xcedf) [0xb7e91edf] #14 ./smbtree(main+0x546) [0x48c04c] #15 /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0x106) [0xb7aabe46] #16 ./smbtree(_start+0x31) [0x48b471] smb_panic(): calling panic action [/usr/share/samba/panic-action 17661] smb_panic(): action returned status 0 Can not dump core: corepath not set up --------------------------------------------------------------------------------------------------- I configure it to build using: #! /bin/bash -x DEB_HOST_MULTIARCH=i386_linux_gnu conf_args="\ --prefix=/usr/local/samba \ --sysconfdir=/etc/samba --with-smbpasswd-file=/etc/samba/smbpasswd \ --with-quota \ --with-gpgme \ --without-systemd \ --disable-cups \ --without-libarchive \ --without-ad-dc" ./configure $conf_args make make installl Building on Devuan Chimaera (Debian Bullseye)
This crash is caused by the callback in smbtree.c which tries to strlcpy a nil pointer. It appears other utilities also copied over the same callback code and they will crash as well.
I guess I can't edit - on that strlcpy it's actually using the rep_strlcpy version as shown in the backtrace.
I have successfully reproduced the error on the following Linux distributions: - CentOS Stream 9 (samba 4.18.6-100.el9), - stable Debian 12 bookworm (samba 4.17.10+dfsg-0+deb12u1, 4.17.11+dfsg-0+deb12u1), - unstable Debian Sid (samba 4.19.0+dfsg-1). Steps to reproduce on CentOS: 1. yum install samba samba-client 2. nano /etc/samba/smb.conf 3. I added the line "server min protocol = NT1" after [global]. 4. I saved the file and closed the editor. 5. testparm -s 6.1 If services are not running: systemctl enable --now smb nmb 6.2 otherwise: systemctl restart smb nmb 7. smbtree -N --option="client min protocol = NT1" Steps to reproduce on Debian: 1. apt install samba smbclient 2. nano /etc/samba/smb.conf 3. I added the line "server min protocol = NT1" after [global]. 4. I saved the file and closed the editor. 5. testparm -s 6. systemctl restart smbd nmbd 7. smbtree -N --option="client min protocol = NT1" The segmentation fault is reproduced consistently.
Created attachment 18502 [details] Patch Fix for smbtree N-option crush
Hello, I resolved this issue on my end by modifying the source code to replace the NULL reference (which caused the crash) with an empty string. The patch is attached above.
This bug was referenced in samba master: 18928f524c41f6584925fc0313f0e5405e9ceb3d