Jonas Ådahl ef47932
From 42815c7a5672edb16ab810378b7c34b3e8e74832 Mon Sep 17 00:00:00 2001
Jonas Ådahl ef47932
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
Jonas Ådahl ef47932
Date: Wed, 27 Nov 2019 16:58:29 +0100
Jonas Ådahl ef47932
Subject: [PATCH 3/3] auth: Add API to unregister built in security handlers
Jonas Ådahl ef47932
Jonas Ådahl ef47932
If I have a VNC server that first accepts password based authentication,
Jonas Ådahl ef47932
then switches to something not using password (e.g. a prompt on screen),
Jonas Ådahl ef47932
the security handler from the first would still be sent as, meaning
Jonas Ådahl ef47932
clients would still ask for a password without there being one.
Jonas Ådahl ef47932
---
Jonas Ådahl ef47932
 libvncserver/auth.c | 7 +++++++
Jonas Ådahl ef47932
 rfb/rfb.h           | 1 +
Jonas Ådahl ef47932
 2 files changed, 8 insertions(+)
Jonas Ådahl ef47932
Jonas Ådahl ef47932
diff --git a/libvncserver/auth.c b/libvncserver/auth.c
Jonas Ådahl ef47932
index fc74c800..94b46fd6 100644
Jonas Ådahl ef47932
--- a/libvncserver/auth.c
Jonas Ådahl ef47932
+++ b/libvncserver/auth.c
Jonas Ådahl ef47932
@@ -248,6 +248,13 @@ determinePrimarySecurityType(rfbClientPtr cl)
Jonas Ådahl ef47932
     }
Jonas Ådahl ef47932
 }
Jonas Ådahl ef47932
 
Jonas Ådahl ef47932
+void
Jonas Ådahl ef47932
+rfbUnregisterPrimarySecurityHandlers (void)
Jonas Ådahl ef47932
+{
Jonas Ådahl ef47932
+    rfbUnregisterSecurityHandler(&VncSecurityHandlerNone);
Jonas Ådahl ef47932
+    rfbUnregisterSecurityHandler(&VncSecurityHandlerVncAuth);
Jonas Ådahl ef47932
+}
Jonas Ådahl ef47932
+
Jonas Ådahl ef47932
 void
Jonas Ådahl ef47932
 rfbSendSecurityTypeList(rfbClientPtr cl,
Jonas Ådahl ef47932
                         enum rfbSecurityTag exclude)
Jonas Ådahl ef47932
diff --git a/rfb/rfb.h b/rfb/rfb.h
Jonas Ådahl ef47932
index f56bd47d..d1763c6c 100644
Jonas Ådahl ef47932
--- a/rfb/rfb.h
Jonas Ådahl ef47932
+++ b/rfb/rfb.h
Jonas Ådahl ef47932
@@ -856,6 +856,7 @@ extern void rfbUnregisterSecurityHandler(rfbSecurityHandler* handler);
Jonas Ådahl ef47932
 extern void rfbRegisterChannelSecurityHandler(rfbSecurityHandler* handler);
Jonas Ådahl ef47932
 extern void rfbUnregisterChannelSecurityHandler(rfbSecurityHandler* handler);
Jonas Ådahl ef47932
 extern void rfbSendSecurityTypeList(rfbClientPtr cl, enum rfbSecurityTag exclude);
Jonas Ådahl ef47932
+extern void rfbUnregisterPrimarySecurityHandlers (void);
Jonas Ådahl ef47932
 
Jonas Ådahl ef47932
 /* rre.c */
Jonas Ådahl ef47932
 
Jonas Ådahl ef47932
-- 
Jonas Ådahl ef47932
2.26.2
Jonas Ådahl ef47932