From cb4e15c1aecbe283b87e4e97c1d485062ef7f571 Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 21 Apr 2017 01:24:56 +0100 Subject: Added SASL authentication support Added SASL support to OpenSSL --- rfb/rfbclient.h | 23 +++++++++++++++++++++++ rfb/rfbconfig.h.cmakein | 3 +++ rfb/rfbproto.h | 6 ++++-- 3 files changed, 30 insertions(+), 2 deletions(-) (limited to 'rfb') diff --git a/rfb/rfbclient.h b/rfb/rfbclient.h index 72e7a5a..053bd42 100644 --- a/rfb/rfbclient.h +++ b/rfb/rfbclient.h @@ -52,6 +52,10 @@ #include #include +#ifdef LIBVNCSERVER_HAVE_SASL +#include +#endif /* LIBVNCSERVER_HAVE_SASL */ + #define rfbClientSwap16IfLE(s) \ (*(char *)&client->endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s)) @@ -197,6 +201,11 @@ typedef rfbBool (*GotJpegProc)(struct _rfbClient* client, const uint8_t* buffer, typedef rfbBool (*LockWriteToTLSProc)(struct _rfbClient* client); typedef rfbBool (*UnlockWriteToTLSProc)(struct _rfbClient* client); +#ifdef LIBVNCSERVER_HAVE_SASL +typedef char* (*GetUserProc)(struct _rfbClient* client); +typedef char* (*GetSASLMechanismProc)(struct _rfbClient* client, char* mechlist); +#endif /* LIBVNCSERVER_HAVE_SASL */ + typedef struct _rfbClient { uint8_t* frameBuffer; int width, height; @@ -391,6 +400,20 @@ typedef struct _rfbClient { GotBitmapProc GotBitmap; /** Hook for custom JPEG decoding and rendering */ GotJpegProc GotJpeg; + +#ifdef LIBVNCSERVER_HAVE_SASL + sasl_conn_t *saslconn; + const char *saslDecoded; + unsigned int saslDecodedLength; + unsigned int saslDecodedOffset; + sasl_secret_t *saslSecret; + + /* Callback to allow the client to choose a preferred mechanism. The string returned will + be freed once no longer required. */ + GetSASLMechanismProc GetSASLMechanism; + GetUserProc GetUser; + +#endif /* LIBVNCSERVER_HAVE_SASL */ } rfbClient; /* cursor.c */ diff --git a/rfb/rfbconfig.h.cmakein b/rfb/rfbconfig.h.cmakein index c4dc5c0..7638921 100644 --- a/rfb/rfbconfig.h.cmakein +++ b/rfb/rfbconfig.h.cmakein @@ -148,6 +148,9 @@ /* Define to 1 if OpenSSL is present */ #cmakedefine LIBVNCSERVER_HAVE_LIBSSL 1 +/* Define to 1 if Cyrus SASL is present */ +#cmakedefine LIBVNCSERVER_HAVE_SASL 1 + /* Define to 1 to build with websockets */ #cmakedefine LIBVNCSERVER_WITH_WEBSOCKETS 1 diff --git a/rfb/rfbproto.h b/rfb/rfbproto.h index f0d6ea1..c5b2723 100644 --- a/rfb/rfbproto.h +++ b/rfb/rfbproto.h @@ -67,9 +67,8 @@ typedef int8_t rfbBool; #include #include -#else -#include #endif +#include #ifdef LIBVNCSERVER_HAVE_LIBZ #include @@ -287,6 +286,9 @@ typedef char rfbProtocolVersionMsg[13]; /* allow extra byte for null */ #define rfbUltra 17 #define rfbTLS 18 #define rfbVeNCrypt 19 +#ifdef LIBVNCSERVER_HAVE_SASL +#define rfbSASL 20 +#endif /* LIBVNCSERVER_HAVE_SASL */ #define rfbARD 30 #define rfbMSLogon 0xfffffffa -- cgit v1.2.3