broadway: Remove authentication support

This commit is contained in:
Jasper St. Pierre 2013-09-26 14:04:34 -04:00
parent f2e30144f8
commit eb1ab0dac2
4 changed files with 7 additions and 100 deletions

View File

@ -265,18 +265,6 @@ broadway_output_new_surface(BroadwayOutput *output,
append_bool (output, is_temp);
}
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)
{

View File

@ -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);

View File

@ -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);

View File

@ -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();