Bug 15170 - smbtree seg fault if using -N option.
Summary: smbtree seg fault if using -N option.
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Tools (show other bugs)
Version: 4.16.5
Hardware: x86 Linux
: P5 regression with 1 vote (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-13 16:01 UTC by David
Modified: 2023-10-06 17:21 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David 2022-09-13 16:01:25 UTC
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)
Comment 1 David 2022-09-13 18:12:44 UTC
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.
Comment 2 David 2022-09-13 18:17:52 UTC
I guess I can't edit - on that strlcpy it's actually using the rep_strlcpy version as shown in the backtrace.
Comment 3 Dmitry Telegin 2023-10-06 17:21:56 UTC
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.