|
@@ -28,10 +28,30 @@
|
|
#include "vnc.h"
|
|
#include "vnc.h"
|
|
#include "trace.h"
|
|
#include "trace.h"
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * Apple has deprecated sasl.h functions in OS X 10.11. Therefore,
|
|
|
|
+ * files that use SASL API need to disable -Wdeprecated-declarations.
|
|
|
|
+ */
|
|
|
|
+#ifdef CONFIG_DARWIN
|
|
|
|
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
|
|
+#endif
|
|
|
|
+
|
|
/* Max amount of data we send/recv for SASL steps to prevent DOS */
|
|
/* Max amount of data we send/recv for SASL steps to prevent DOS */
|
|
#define SASL_DATA_MAX_LEN (1024 * 1024)
|
|
#define SASL_DATA_MAX_LEN (1024 * 1024)
|
|
|
|
|
|
|
|
|
|
|
|
+bool vnc_sasl_server_init(Error **errp)
|
|
|
|
+{
|
|
|
|
+ int saslErr = sasl_server_init(NULL, "qemu");
|
|
|
|
+
|
|
|
|
+ if (saslErr != SASL_OK) {
|
|
|
|
+ error_setg(errp, "Failed to initialize SASL auth: %s",
|
|
|
|
+ sasl_errstring(saslErr, NULL, NULL));
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+}
|
|
|
|
+
|
|
void vnc_sasl_client_cleanup(VncState *vs)
|
|
void vnc_sasl_client_cleanup(VncState *vs)
|
|
{
|
|
{
|
|
if (vs->sasl.conn) {
|
|
if (vs->sasl.conn) {
|