Bug 15969 - Virusfilter cannot connect to clamav unix socket (Protocol not supported error)
Summary: Virusfilter cannot connect to clamav unix socket (Protocol not supported error)
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: VFS Modules (show other bugs)
Version: 4.23.4
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-01-07 15:41 UTC by Savvas Karagiannidis
Modified: 2026-01-07 15:41 UTC (History)
0 users

See Also:


Attachments
Patch to fix virusfilter with clamav unix socket (419 bytes, patch)
2026-01-07 15:41 UTC, Savvas Karagiannidis
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Savvas Karagiannidis 2026-01-07 15:41:11 UTC
Created attachment 18793 [details]
Patch to fix virusfilter with clamav unix socket

Tried to use the latest version 4.23.4 and found out that the vfs virusfilter was not working properly.

The error that was logged was the following:

virusfilter_clamav_scan_init: clamd: Connecting to socket failed: /var/run/clamd/clamd.socket: Protocol not supported

where /var/run/clamd/clamd.socket is the path to the socket where clamd is listening for connections.

I tried to debug the problem and I traced the problem to this exact change:

https://github.com/samba-team/samba/commit/6934c7ae402ee7ef593b613022f0330303766287#diff-271c747e500fb0a06d2b8aaefc76308ed1189abcf8821dcb158c89ce8af0af02R543

The above change was made to add a protocol parameter to some socket functions, and that commit sets the protocol parameter explicitly to IPPROTO_TCP

Unfortunately open_socket_out is called from virusfilter_io_connectpath and attempts to connect to a UNIX socket. So, when attempting to connect to a UNIX socket and the protocol is explicitly set to IPPROTO_TCP, the socket call fails with error EPROTONOSUPPORT.

That specific protocol parameter should be left 0 (use default protocol), in order to work properly

I attach a small patch for version 4.23.4 that fixes the issue.