1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
samba-mirror/source3
Jones Syue 8f4c1c67b4 vfs_aio_pthread: fix segfault if samba-tool ntacl get
If configured as AD DC and aio_pthread appended into 'vfs objects'[1],
run these commands would get segfault:
1. sudo samba-tool ntacl get .
2. sudo net vfs getntacl sysvol .
gdb said it goes through aio_pthread_openat_fn() @ vfs_aio_pthread.c[2],
and the fsp->conn->sconn->client is null (0x0).

'sconn->client' memory is allocated when a new connection is accpeted:
smbd_accept_connection > smbd_process > smbXsrv_client_create
While running local commands looks like it would not go through
smbXsrv_client_create so the 'client' is null, segfault might happen.
We should not dereference 'client->server_multi_channel_enabled',
if 'client' is null.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15441

[1] smb.conf example, samba-4.18.5, ubuntu 22.04.2
[global]
        dns forwarder = 127.0.0.53
        netbios name = U22-JONES-88X1
        realm = U22-JONES-88X1.X88X1.JONES
        server role = active directory domain controller
        workgroup = X88X1
        idmap_ldb:use rfc2307 = yes
        vfs objects = dfs_samba4 acl_xattr aio_pthread

[sysvol]
        path = /var/lib/samba/sysvol
        read only = No

[netlogon]
        path = /var/lib/samba/sysvol/u22-jones-88x1.x88x1.jones/scripts
        read only = No

[2] gdb
(gdb) run /usr/local/samba/bin/samba-tool ntacl get .
Starting program: /usr/local/Python3/bin/python3 /usr/local/samba/bin/samba-tool ntacl get .
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007fffd0eb809e in aio_pthread_openat_fn (handle=0x8d5cc0, dirfsp=0x8c3070, smb_fname=0x18ab4f0, fsp=0x1af3550, flags=196608, mode=0)
    at ../../source3/modules/vfs_aio_pthread.c:467
warning: Source file is more recent than executable.
467             if (fsp->conn->sconn->client->server_multi_channel_enabled) {
(gdb) bt
    at ../../source3/modules/vfs_aio_pthread.c:467
    at ../../source3/smbd/pysmbd.c:320
---Type <return> to continue, or q <return> to quit---
(gdb) f
    at ../../source3/modules/vfs_aio_pthread.c:467
467             if (fsp->conn->sconn->client->server_multi_channel_enabled) {
(gdb) p fsp->conn->sconn->client
$1 = (struct smbXsrv_client *) 0x0
(gdb)

Signed-off-by: Jones Syue <jonessyue@qnap.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2023-08-02 11:16:40 +00:00
..
auth s3:auth: Use new debug macros for logging 2023-07-05 06:34:32 +00:00
build
client s4:client: Fix code spelling 2023-07-05 06:34:32 +00:00
exports
groupdb
include s3:include: Fix code spelling 2023-07-13 05:41:36 +00:00
intl
lib s3:lib: Fix code spelling 2023-07-13 05:41:36 +00:00
libads s3:libads: Fix code spelling 2023-07-13 05:41:36 +00:00
libgpo/gpext
libnet s3-net: no secrets access required when processing a ODJ provisioning 2023-07-05 09:23:22 +00:00
librpc librpc:crypto: SAFE_FREE() -> krb5_free_enctypes() 2023-07-28 10:48:32 +00:00
libsmb libsmb: increase a debug level when site-aware DC lookup failed 2023-07-21 16:19:35 +00:00
locale spelling: connnect encrytion exisit expection explicit invalide missmatch paramater paramter partion privilige relase reponse seperate unkown verson authencication progagated 2022-06-10 18:12:33 +00:00
locking s3:locking: Fix code spelling 2023-07-17 11:46:29 +00:00
modules vfs_aio_pthread: fix segfault if samba-tool ntacl get 2023-08-02 11:16:40 +00:00
nmbd s3:nmbd: Fix code spelling 2023-07-17 12:41:21 +00:00
param s3:param: Fix code spelling 2023-07-19 09:58:37 +00:00
passdb dsdb: Use samdb_system_container_dn() in pdb_samba_dsdb_*() 2023-07-31 07:20:21 +00:00
printing s3:printing: Rename variably to dummy to make codespell happy 2023-07-19 09:58:37 +00:00
profile profiling: Factor out functions to read smbprofile.tdb 2023-06-16 16:14:30 +00:00
registry s3:registry: Fix code spelling 2023-07-19 09:58:37 +00:00
rpc_client mdscli: correct handling of in-progress searches 2023-07-24 16:15:16 +00:00
rpc_server mdssvc: fix returning file modification date for older Mac releases 2023-07-26 23:42:44 +00:00
rpcclient CVE-2023-34968: mdssvc: introduce an allocating wrapper to sl_pack() 2023-07-21 12:05:35 +00:00
script sefltest: Add new regression test dfs with widelinks = yes 2023-07-28 23:50:32 +00:00
selftest sefltest: Add new regression test dfs with widelinks = yes 2023-07-28 23:50:32 +00:00
services s3:services: Disable rcinit-based service control code 2021-12-10 14:02:30 +00:00
smbd smbd: move tevent_req_post() out of smbd_smb2_create_after_exec() 2023-07-28 10:48:32 +00:00
torture s3: torture: Add test to show an SMB1 DFS path of "\\x//\\/" crashes smbd. 2023-07-27 09:59:29 +00:00
utils s4:ldap_server: reload tls certificates on smbcontrol reload-certs 2023-07-25 20:04:29 +00:00
web
winbindd s3:winbindd: Fix double close(fd) 2023-07-25 12:08:49 +00:00
.clang_complete
.dmallocrc
.indent.pro
Doxyfile
mainpage.dox
smbadduser.in
wscript s3:waf: Fix code spelling 2023-07-19 09:58:37 +00:00
wscript_build profiling: Factor out functions to read smbprofile.tdb 2023-06-16 16:14:30 +00:00
wscript_configure_system_ncurses