5
0
mirror of git://git.proxmox.com/git/vncterm.git synced 2025-01-05 17:17:38 +03:00
vncterm/vncpatches/tls-auth-pluging.patch
Fabian Grünbichler 648c78ad87 build: rebase on libvncserver 0.9.13
upstream switched to cmake from autotools.

it is possible to drop systemd via a build option now, so use that
instead of patching.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-07-15 06:59:47 +02:00

69 lines
2.2 KiB
Diff

Index: libvncserver-LibVNCServer-0.9.13/libvncserver/auth.c
===================================================================
--- libvncserver-LibVNCServer-0.9.13.orig/libvncserver/auth.c
+++ libvncserver-LibVNCServer-0.9.13/libvncserver/auth.c
@@ -301,7 +301,8 @@ rfbAuthNewClient(rfbClientPtr cl)
if (!cl->screen->authPasswdData || cl->reverseConnection) {
/* chk if this condition is valid or not. */
- securityType = rfbSecTypeNone;
+ /* we disable anonymous auth */
+ // securityType = rfbSecTypeNone;
} else if (cl->screen->authPasswdData) {
securityType = rfbSecTypeVncAuth;
}
Index: libvncserver-LibVNCServer-0.9.13/libvncserver/sockets.c
===================================================================
--- libvncserver-LibVNCServer-0.9.13.orig/libvncserver/sockets.c
+++ libvncserver-LibVNCServer-0.9.13/libvncserver/sockets.c
@@ -638,7 +638,11 @@ rfbReadExactTimeout(rfbClientPtr cl, cha
n = read(sock, buf, len);
}
#else
- n = read(sock, buf, len);
+ if (cl->sock_read_fn) {
+ n = cl->sock_read_fn(cl, buf, len);
+ } else {
+ n = read(sock, buf, len);
+ }
#endif
if (n > 0) {
@@ -826,7 +830,11 @@ rfbWriteExact(rfbClientPtr cl,
n = rfbssl_write(cl, buf, len);
else
#endif
+ if (cl->sock_write_fn) {
+ n = cl->sock_write_fn(cl, buf, len);
+ } else {
n = write(sock, buf, len);
+ }
if (n > 0) {
Index: libvncserver-LibVNCServer-0.9.13/rfb/rfb.h
===================================================================
--- libvncserver-LibVNCServer-0.9.13.orig/rfb/rfb.h
+++ libvncserver-LibVNCServer-0.9.13/rfb/rfb.h
@@ -411,6 +411,9 @@ typedef struct _rfbStatList {
typedef struct _rfbSslCtx rfbSslCtx;
typedef struct _wsCtx wsCtx;
+typedef ssize_t (*sock_read_fn_t)(struct _rfbClientRec *cl, void *buf, size_t count);
+typedef ssize_t (*sock_write_fn_t)(struct _rfbClientRec *cl, const void *buf, size_t count);
+
typedef struct _rfbClientRec {
/** back pointer to the screen */
@@ -431,6 +434,10 @@ typedef struct _rfbClientRec {
void* clientData;
ClientGoneHookPtr clientGoneHook;
+ /* use to hook up TLS read/write */
+ sock_read_fn_t sock_read_fn;
+ sock_read_fn_t sock_write_fn;
+
rfbSocket sock;
char *host;