From e8a1ca20352f14bf3b527bb1f148610fc1fb5247 Mon Sep 17 00:00:00 2001 From: Jocelyn Le Sage Date: Tue, 21 Feb 2017 06:36:15 -0500 Subject: Fixed compilation of websockets on system where there is no implementation of base64 functions. --- libvncserver/websockets.c | 8 ++++---- libvncserver/ws_decode.c | 3 ++- libvncserver/ws_decode.h | 3 --- 3 files changed, 6 insertions(+), 8 deletions(-) (limited to 'libvncserver') diff --git a/libvncserver/websockets.c b/libvncserver/websockets.c index b9947c4..4ebff72 100644 --- a/libvncserver/websockets.c +++ b/libvncserver/websockets.c @@ -52,7 +52,7 @@ #include "rfbssl.h" #include "rfbcrypto.h" #include "ws_decode.h" - +#include "base64.h" #if 0 #include @@ -117,8 +117,8 @@ static void webSocketsGenSha1Key(char *target, int size, char *key) iov[1].iov_base = GUID; iov[1].iov_len = sizeof(GUID) - 1; digestsha1(iov, 2, hash); - if (-1 == b64_ntop(hash, sizeof(hash), target, size)) - rfbErr("b64_ntop failed\n"); + if (-1 == rfbBase64NtoP(hash, sizeof(hash), target, size)) + rfbErr("rfbBase64NtoP failed\n"); } /* @@ -412,7 +412,7 @@ webSocketsEncodeHybi(rfbClientPtr cl, const char *src, int len, char **dst) } if (wsctx->base64) { - if (-1 == (ret = b64_ntop((unsigned char *)src, len, wsctx->codeBufEncode + sz, sizeof(wsctx->codeBufEncode) - sz))) { + if (-1 == (ret = rfbBase64NtoP((unsigned char *)src, len, wsctx->codeBufEncode + sz, sizeof(wsctx->codeBufEncode) - sz))) { rfbErr("%s: Base 64 encode failed\n", __func__); } else { if (ret != blen) diff --git a/libvncserver/ws_decode.c b/libvncserver/ws_decode.c index 513fd4b..441ebc7 100644 --- a/libvncserver/ws_decode.c +++ b/libvncserver/ws_decode.c @@ -1,4 +1,5 @@ #include "ws_decode.h" +#include "base64.h" #include #include @@ -432,7 +433,7 @@ hybiReadAndDecode(ws_ctx_t *wsctx, char *dst, int len, int *sockRet, int nInBuf) case WS_OPCODE_TEXT_FRAME: data[toReturn] = '\0'; ws_dbg("Initiate Base64 decoding in %p with max size %d and '\\0' at %p\n", data, bufsize, data + toReturn); - if (-1 == (wsctx->readlen = b64_pton((char *)data, data, bufsize))) { + if (-1 == (wsctx->readlen = rfbBase64PtoN((char *)data, data, bufsize))) { rfbErr("%s: Base64 decode error; %s\n", __func__, strerror(errno)); } wsctx->writePos = hybiPayloadStart(wsctx); diff --git a/libvncserver/ws_decode.h b/libvncserver/ws_decode.h index 2923e3d..709477a 100644 --- a/libvncserver/ws_decode.h +++ b/libvncserver/ws_decode.h @@ -3,9 +3,6 @@ #include #include -#ifndef _MSC_VER -#include /* __b64_ntop */ -#endif #if defined(__APPLE__) -- cgit v1.2.1