Skip to content

libvncclient: add client-aware logging helpers#721

Open
marcofortina wants to merge 3 commits into
LibVNC:masterfrom
marcofortina:feature/client-aware-libvncclient-logging
Open

libvncclient: add client-aware logging helpers#721
marcofortina wants to merge 3 commits into
LibVNC:masterfrom
marcofortina:feature/client-aware-libvncclient-logging

Conversation

@marcofortina
Copy link
Copy Markdown
Contributor

@marcofortina marcofortina commented May 17, 2026

Summary

Adds a non-breaking LibVNCClient logging path that can carry the rfbClient *
context to applications that want client-aware log output.

Preflight

Changes

  • Keep the legacy global rfbClientLog and rfbClientErr callbacks unchanged.
  • Add optional client-aware callbacks:
    • rfbClientLogWithClient
    • rfbClientErrWithClient
  • Add helper entry points:
    • rfbClientLogEx(rfbClient *client, ...)
    • rfbClientErrEx(rfbClient *client, ...)
  • If no client-aware callback is installed, the helpers fall back to the legacy callbacks.
  • Convert LibVNCClient call sites that already have an rfbClient * in scope to use the new helpers, including:
    • core connection/session logging in rfbclient.c
    • socket read/write logging paths
    • SASL authentication logging
    • TLS/OpenSSL and TLS/GnuTLS client paths
    • Tight, TRLE, Ultra, Zlib and ZRLE decoder paths
    • framebuffer/viewer helper paths with client context
  • Keep legacy logging only for helpers that do not have an rfbClient * context, such as listen/socket utility helpers, OpenSSL global initialization helpers, and the public PrintPixelFormat() compatibility entry point.
  • Add a regression test that covers both client-aware callbacks and legacy fallback behavior.

Validation

  • git diff --check
  • CMake build with tests enabled and optional desktop/TLS dependencies disabled
  • CMake build with OpenSSL enabled
  • CMake build with SASL enabled
  • CMake build with GnuTLS + Libgcrypt enabled, matching the failing CI profile
  • ctest --test-dir build-675-patch --output-on-failure
  • ctest --test-dir build-675-openssl --output-on-failure
  • ctest --test-dir build-675-sasl --output-on-failure
  • cmake -DWITH_OPENSSL=OFF -DWITH_GNUTLS=ON -DWITH_GCRYPT=ON -DWITH_LIBVNCSERVER=OFF ..
  • Final grep audit confirmed that remaining legacy rfbClientLog / rfbClientErr call sites are limited to helpers without rfbClient * context plus examples/tests.

Result:

  • default/no-TLS: 100% tests passed, 0 tests failed out of 5
  • OpenSSL: 100% tests passed, 0 tests failed out of 5
  • SASL: 100% tests passed, 0 tests failed out of 5
  • GnuTLS + Libgcrypt client-only CI profile: build passes

Notes

This intentionally avoids changing the existing rfbClientLogProc ABI/API. It gives applications a new opt-in path for client-aware logging while preserving the legacy global callbacks for existing users.

Closes #675.

Comment thread src/libvncclient/ultra.c Fixed
Comment thread src/libvncclient/zrle.c Fixed
@marcofortina marcofortina force-pushed the feature/client-aware-libvncclient-logging branch from d501ff0 to c40b111 Compare May 17, 2026 06:23
Comment thread src/libvncclient/rfbclient.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Identify client from rfbClientLog and rfbClientErr

4 participants