[gtk+] broadway: Remove authentication support



commit eb1ab0dac2f3d7a05cfe8b87e83b363d39279a38
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Sep 26 14:04:34 2013 -0400

    broadway: Remove authentication support

 gdk/broadway/broadway-output.c |   12 ---------
 gdk/broadway/broadway-output.h |    2 -
 gdk/broadway/broadway-server.c |   52 +---------------------------------------
 gdk/broadway/broadway.js       |   41 ++++---------------------------
 4 files changed, 7 insertions(+), 100 deletions(-)
---
diff --git a/gdk/broadway/broadway-output.c b/gdk/broadway/broadway-output.c
index 6eaaf44..96b6f71 100644
--- a/gdk/broadway/broadway-output.c
+++ b/gdk/broadway/broadway-output.c
@@ -266,18 +266,6 @@ broadway_output_new_surface(BroadwayOutput *output,
 }
 
 void
-broadway_output_request_auth (BroadwayOutput *output)
-{
-  write_header (output, BROADWAY_OP_REQUEST_AUTH);
-}
-
-void
-broadway_output_auth_ok (BroadwayOutput *output)
-{
-  write_header (output, BROADWAY_OP_AUTH_OK);
-}
-
-void
 broadway_output_disconnected (BroadwayOutput *output)
 {
   write_header (output, BROADWAY_OP_DISCONNECTED);
diff --git a/gdk/broadway/broadway-output.h b/gdk/broadway/broadway-output.h
index 9525487..487dfad 100644
--- a/gdk/broadway/broadway-output.h
+++ b/gdk/broadway/broadway-output.h
@@ -31,8 +31,6 @@ void            broadway_output_new_surface     (BroadwayOutput *output,
                                                 int             w,
                                                 int             h,
                                                 gboolean        is_temp);
-void            broadway_output_request_auth    (BroadwayOutput *output);
-void            broadway_output_auth_ok         (BroadwayOutput *output);
 void            broadway_output_disconnected    (BroadwayOutput *output);
 void            broadway_output_show_surface    (BroadwayOutput *output,
                                                 int             id);
diff --git a/gdk/broadway/broadway-server.c b/gdk/broadway/broadway-server.c
index ffc893a..c1b3ef5 100644
--- a/gdk/broadway/broadway-server.c
+++ b/gdk/broadway/broadway-server.c
@@ -39,7 +39,6 @@ typedef struct BroadwayWindow BroadwayWindow;
 struct _BroadwayServer {
   GObject parent_instance;
 
-  char *password;
   char *address;
   int port;
   GSocketService *service;
@@ -124,8 +123,6 @@ static void
 broadway_server_init (BroadwayServer *server)
 {
   BroadwayWindow *root;
-  char *passwd_file;
-  char *password, *p;
 
   server->service = g_socket_service_new ();
   server->pointer_grab_window_id = -1;
@@ -134,22 +131,6 @@ broadway_server_init (BroadwayServer *server)
   server->id_ht = g_hash_table_new (NULL, NULL);
   server->id_counter = 0;
 
-  passwd_file = g_build_filename (g_get_user_config_dir (),
-                                 "broadway.passwd", NULL);
-
-  if (g_file_get_contents (passwd_file,
-                          &password, NULL, NULL))
-    {
-      p = strchr (password, '\n');
-      if (p)
-       *p = 0;
-      g_strstrip (password);
-      if (strlen (password) > 3)
-       server->password = password;
-      else
-       g_free (password);
-    }
-
   root = g_new0 (BroadwayWindow, 1);
   root->id = server->id_counter++;
   root->width = 1024;
@@ -391,14 +372,6 @@ update_future_pointer_info (BroadwayServer *server, BroadwayInputPointerMsg *dat
   server->future_mouse_in_toplevel = data->mouse_window_id;
 }
 
-static gboolean
-verify_password (BroadwayServer *server, const char *password)
-{
-  char *hash;
-  hash = crypt (password, server->password);
-  return strcmp (hash, server->password) == 0;
-}
-
 static void
 parse_input_message (BroadwayInput *input, const char *message)
 {
@@ -407,22 +380,6 @@ parse_input_message (BroadwayInput *input, const char *message)
   char *p;
   gint64 time_;
 
-  if (!input->active)
-    {
-      /* The input has not been activated yet, handle auth/start */
-
-      if (message[0] != 'l' ||
-         !verify_password (server, message+1))
-       {
-         broadway_output_request_auth (input->output);
-         broadway_output_flush (input->output);
-       }
-      else
-       start (input);
-
-      return;
-    }
-
   memset (&msg, 0, sizeof (msg));
 
   p = (char *)message;
@@ -1054,13 +1011,7 @@ start_input (HttpRequest *request)
   g_source_set_callback (input->source, (GSourceFunc)input_data_cb, input, NULL);
   g_source_attach (input->source, NULL);
 
-  if (input->server->password)
-    {
-      broadway_output_request_auth (input->output);
-      broadway_output_flush (input->output);
-    }
-  else
-    start (input);
+  start (input);
 
   /* Process any data in the pipe already */
   parse_input (input);
@@ -1099,7 +1050,6 @@ start (BroadwayInput *input)
   server->output = input->output;
 
   broadway_output_set_next_serial (server->output, server->saved_serial);
-  broadway_output_auth_ok (server->output);
   broadway_output_flush (server->output);
 
   broadway_server_resync_windows (server);
diff --git a/gdk/broadway/broadway.js b/gdk/broadway/broadway.js
index f879ef4..7596e6d 100644
--- a/gdk/broadway/broadway.js
+++ b/gdk/broadway/broadway.js
@@ -447,23 +447,19 @@ function cmdUngrabPointer()
        doUngrab();
 }
 
+var active = false;
 function handleCommands(cmd)
 {
+    if (!active) {
+        start();
+        active = true;
+    }
+
     while (cmd.pos < cmd.length) {
        var id, x, y, w, h, q;
        var command = cmd.get_char();
        lastSerial = cmd.get_32();
        switch (command) {
-       case 'l':
-           login ();
-           break;
-
-       case 'L':
-           if (loginDiv != null)
-               loginDiv.parentNode.removeChild(loginDiv);
-           start ();
-           break;
-
        case 'D':
            alert ("disconnected");
            inputSocket = null;
@@ -2522,31 +2518,6 @@ function start()
     sendInput ("d", [w, h]);
 }
 
-var loginDiv = null;
-function login()
-{
-    if (loginDiv == null) {
-       var div = document.createElement('div');
-       document.body.appendChild(div);
-       div.innerHTML = "Please enter password<br>";
-       div.style.marginTop = "40px";
-       div.style.textAlign = "center";
-
-       var input = document.createElement("input");
-       input.setAttribute("type", "password");
-       div.appendChild(input);
-       input.focus ();
-       input.onkeyup = function(e) {
-           if (e.keyCode === 13 && input.value != "") {
-               inputSocket.send ("l" + input.value);
-           }
-       }
-       loginDiv = div;
-    } else {
-       alert ("Wrong password");
-    }
-}
-
 function connect()
 {
     var url = window.location.toString();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]