Bug 276194

Summary: net/x11vnc: fails with -auth argument
Product: Ports & Packages Reporter: gdinolt
Component: Individual Port(s)Assignee: Dirk Meyer <dinoex>
Status: Closed FIXED    
Severity: Affects Some People CC: dinoex, vvd
Priority: --- Keywords: patch
Version: LatestFlags: dinoex: maintainer-feedback+
Hardware: amd64   
OS: Any   
Attachments:
Description Flags
Patch file to fix -auth parsing in src/ssltools.h none

Description gdinolt 2024-01-08 05:28:49 UTC
Created attachment 247524 [details]
Patch file to fix -auth parsing in src/ssltools.h

x11vnc fails with -auth argument as follows in x11vnc.log:

06/01/2024 23:12:29 passing arg to libvncserver: -rfbauth
06/01/2024 23:12:29 passing arg to libvncserver: /usr/home/dinolt/.vnc/passwd
06/01/2024 23:12:29 x11vnc version: 0.9.16 lastmod: 2019-01-05  pid: 1525
[: -a: unexpected operator
[: -a: unexpected operator
06/01/2024 23:12:30 -auth guess: failed for display=':0'

This fails with both FreeBSD13.2 p8 (and previous) and FreeBSD14 Stable on AMD64.  I have not tried on other hardware or versions of the OS. 

The failure seems to be in the file src/ssltools.h in the parsing of the -auth arg where there is an extra space in the regular expression passed to the sed at line 1060.  I have attached a patch file to be included in the files directory that seems to fix the problem.
Comment 1 Vladimir Druzenko freebsd_committer freebsd_triage 2024-01-08 06:25:32 UTC
Can you show full command line?

For me with KDE5 this command line work fine:
/usr/local/bin/x11vnc -env FD_XDM=1 -auth /var/run/sddm/* -dontdisconnect -display :0 -noxfixes -noxdamage -forever -rfbport 5900 -shared -rfbauth /usr/local/x11vnc/passwd -oa /var/log/x11vnc.log
Comment 2 gdinolt 2024-01-08 07:13:12 UTC
I am running xfce4 

The following command line fails for me:

/usr/local/bin/x11vnc -env FD_XDM=1 -auth guess -reopen -rfbauth /usr/home/dinolt/.vnc/passwd -o /var/log/x11vnc.log -forever -bg

which I use in Xsetup_0 from xdm.
Comment 3 gdinolt 2024-01-08 07:32:51 UTC
After looking at it some more, it may be that the 

-auth guess 

is causing the problem. I think that in my case, since I am using "-auth guess" I am looking at the .Xauthority file for "authentication", not a file in /var/run/sddm/* .  That directory doesn't exist in my environment.
Comment 4 Vladimir Druzenko freebsd_committer freebsd_triage 2024-01-08 09:13:22 UTC
Check this: https://github.com/LibVNC/x11vnc/issues/239

IMHO, it's better to report such bugs in the upstream too.
Comment 5 Dirk Meyer freebsd_committer freebsd_triage 2024-01-08 09:54:15 UTC
I will look into this.
Comment 6 commit-hook freebsd_committer freebsd_triage 2024-01-08 09:57:01 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3f8e2df713baa079cddbfc5f73dc782fe0aa1859

commit 3f8e2df713baa079cddbfc5f73dc782fe0aa1859
Author:     Dirk Meyer <dinoex@FreeBSD.org>
AuthorDate: 2024-01-08 09:56:38 +0000
Commit:     Dirk Meyer <dinoex@FreeBSD.org>
CommitDate: 2024-01-08 09:56:38 +0000

    net/x11vnc: bugfix for -auth argument

    PR: 276194

 net/x11vnc/Makefile                     |  2 +-
 net/x11vnc/files/patch-ssltools.h (new) | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)