while (*offset < message_length)
{
gchar *name, *value;
-
+
name = read_string (message, message_length, offset);
value = read_string (message, message_length, offset);
g_hash_table_insert (priv->hints, name, value);
* accounts should be taken from #LightDMUserList and displayed in the greeter
* for the user to choose from. Note that this list can be empty and it is
* recommended you show a method for the user to enter a username manually.
- *
+ *
* If this option is shown the greeter should only allow these users to be
* chosen for login unless the manual login hint is set.
*
g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
value = lightdm_greeter_get_hint (greeter, "has-guest-account");
-
+
return g_strcmp0 (value, "true") == 0;
}
g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
value = lightdm_greeter_get_hint (greeter, "select-guest");
-
+
return g_strcmp0 (value, "true") == 0;
}
g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
value = lightdm_greeter_get_hint (greeter, "autologin-guest");
-
+
return g_strcmp0 (value, "true") == 0;
}
priv->cancelling_authentication = FALSE;
priv->authenticate_sequence_number++;
- priv->in_authentication = TRUE;
+ priv->in_authentication = TRUE;
priv->is_authenticated = FALSE;
if (username != priv->authentication_user)
{
/*
* Copyright (C) 2010 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2 or version 3 of the License.
/**
* lightdm_language_get_code:
* @language: A #LightDMLanguage
- *
+ *
* Get the code of a language (e.g. "de_DE.UTF-8")
- *
+ *
* Return value: The code of the language
**/
const gchar *
/**
* lightdm_language_get_name:
* @language: A #LightDMLanguage
- *
+ *
* Get the name of a language.
*
* Return value: The name of the language
/**
* lightdm_language_get_territory:
* @language: A #LightDMLanguage
- *
+ *
* Get the territory the language is used in.
- *
+ *
* Return value: The territory the language is used in.
**/
const gchar *
* lightdm_language_matches:
* @language: A #LightDMLanguage
* @code: A language code
- *
+ *
* Check if a language code matches this language.
- *
+ *
* Return value: #TRUE if the code matches this language.
**/
gboolean
lightdm_language_class_init (LightDMLanguageClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
+
g_type_class_add_private (klass, sizeof (LightDMLanguagePrivate));
object_class->set_property = lightdm_language_set_property;
*
* Copyright (C) 2010 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2 or version 3 of the License.
display = XOpenDisplay (NULL);
if (display == NULL)
return NULL;
-
+
xkl_engine = xkl_engine_get_instance (display);
xkl_config = xkl_config_rec_new ();
if (!xkl_config_rec_get_from_server (xkl_config, xkl_engine))
/**
* lightdm_layout_get_name:
* @layout: A #LightDMLayout
- *
+ *
* Get the name of a layout.
- *
+ *
* Return value: The name of the layout
**/
const gchar *
/**
* lightdm_layout_get_short_description:
* @layout: A #LightDMLayout
- *
+ *
* Get the short description of a layout.
*
* Return value: A short description of the layout
/**
* lightdm_layout_get_description:
* @layout: A #LightDMLayout
- *
+ *
* Get the long description of a layout.
- *
+ *
* Return value: A long description of the layout
**/
const gchar *
lightdm_layout_class_init (LightDMLayoutClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
+
g_type_class_add_private (klass, sizeof (LightDMLayoutPrivate));
object_class->set_property = lightdm_layout_set_property;
* @error: return location for a #GError, or %NULL
*
* Triggers a system shutdown.
- *
+ *
* Return value: #TRUE if shutdown initiated.
**/
gboolean
/*
* Copyright (C) 2010 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2 or version 3 of the License.
static GList *local_sessions = NULL;
static GList *remote_sessions = NULL;
-static gint
+static gint
compare_session (gconstpointer a, gconstpointer b)
{
LightDMSessionPrivate *priv_a = GET_PRIVATE (a);
LightDMSession *session;
LightDMSessionPrivate *priv;
gchar *try_exec;
-
+
if (g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY, NULL) ||
g_key_file_get_boolean (key_file, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_HIDDEN, NULL))
return NULL;
}
g_dir_close (directory);
-
+
return sessions;
}
for (i = 0; dirs[i]; i++)
sessions = load_sessions_dir (sessions, dirs[i]);
g_strfreev (dirs);
-
+
return sessions;
}
/* Use session directory from configuration */
config_load_from_standard_locations (config_get_instance (), NULL, NULL);
-
+
value = config_get_string (config_get_instance (), "LightDM", "sessions-directory");
if (value)
{
/**
* lightdm_session_get_key:
* @session: A #LightDMSession
- *
+ *
* Get the key for a session
- *
+ *
* Return value: The session key
**/
const gchar *
/**
* lightdm_session_get_session_type:
* @session: A #LightDMSession
- *
+ *
* Get the type a session
- *
+ *
* Return value: The session type, e.g. x or mir
**/
const gchar *
/**
* lightdm_session_get_name:
* @session: A #LightDMSession
- *
+ *
* Get the name for a session
- *
+ *
* Return value: The session name
**/
const gchar *
/**
* lightdm_session_get_comment:
* @session: A #LightDMSession
- *
+ *
* Get the comment for a session
- *
+ *
* Return value: The session comment
**/
const gchar *
lightdm_session_class_init (LightDMSessionClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
+
g_type_class_add_private (klass, sizeof (LightDMSessionPrivate));
object_class->set_property = lightdm_session_set_property;
* Copyright (C) 2014 Canonical, Ltd.
* Authors: Robert Ancell <robert.ancell@canonical.com>
* Michael Terry <michael.terry@canonical.com>
- *
+ *
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2 or version 3 of the License.
/**
* lightdm_user_get_name:
* @user: A #LightDMUser
- *
+ *
* Get the name of a user.
- *
+ *
* Return value: The name of the given user
**/
const gchar *
/**
* lightdm_user_get_real_name:
* @user: A #LightDMUser
- *
+ *
* Get the real name of a user.
*
* Return value: The real name of the given user
/**
* lightdm_user_get_display_name:
* @user: A #LightDMUser
- *
+ *
* Get the display name of a user.
- *
+ *
* Return value: The display name of the given user
**/
const gchar *
/**
* lightdm_user_get_home_directory:
* @user: A #LightDMUser
- *
+ *
* Get the home directory for a user.
- *
+ *
* Return value: The users home directory
*/
const gchar *
/**
* lightdm_user_get_image:
* @user: A #LightDMUser
- *
+ *
* Get the image URI for a user.
- *
+ *
* Return value: The image URI for the given user or #NULL if no URI
**/
const gchar *
/**
* lightdm_user_get_background:
* @user: A #LightDMUser
- *
+ *
* Get the background file path for a user.
- *
+ *
* Return value: The background file path for the given user or #NULL if no path
**/
const gchar *
/**
* lightdm_user_get_language:
* @user: A #LightDMUser
- *
+ *
* Get the language for a user.
- *
+ *
* Return value: The language in the form of a local specification (e.g. "de_DE.UTF-8") for the given user or #NULL if using the system default locale.
**/
const gchar *
/**
* lightdm_user_get_layout:
* @user: A #LightDMUser
- *
+ *
* Get the keyboard layout for a user.
- *
+ *
* Return value: The keyboard layout for the given user or #NULL if using system defaults. Copy the value if you want to use it long term.
**/
const gchar *
/**
* lightdm_user_get_layouts:
* @user: A #LightDMUser
- *
+ *
* Get the configured keyboard layouts for a user.
- *
+ *
* Return value: (transfer none): A NULL-terminated array of keyboard layouts for the given user. Copy the values if you want to use them long term.
**/
const gchar * const *
/**
* lightdm_user_get_session:
* @user: A #LightDMUser
- *
+ *
* Get the session for a user.
- *
+ *
* Return value: The session for the given user or #NULL if using system defaults.
**/
const gchar *
/**
* lightdm_user_get_logged_in:
* @user: A #LightDMUser
- *
+ *
* Check if a user is logged in.
- *
+ *
* Return value: #TRUE if the user is currently logged in.
**/
gboolean
/**
* lightdm_user_get_has_messages:
* @user: A #LightDMUser
- *
+ *
* Check if a user has waiting messages.
- *
+ *
* Return value: #TRUE if the user has waiting messages.
**/
gboolean
/**
* lightdm_user_get_uid:
* @user: A #LightDMUser
- *
+ *
* Get the uid of a user.
- *
+ *
* Return value: The uid of the given user
**/
uid_t
class Q_DECL_EXPORT Greeter : public QObject
{
Q_OBJECT
-
+
Q_PROPERTY(bool authenticated READ isAuthenticated ) //NOTFIY authenticationComplete
Q_PROPERTY(QString authenticationUser READ authenticationUser )
Q_PROPERTY(QString defaultSession READ defaultSessionHint CONSTANT)
Q_PROPERTY(QString hostname READ hostname CONSTANT)
Q_PROPERTY(bool hasGuestAccount READ hasGuestAccountHint CONSTANT)
Q_PROPERTY(bool locked READ lockHint CONSTANT)
-
+
Q_PROPERTY(QString hostname READ hostname CONSTANT)
Q_ENUMS(PromptType MessageType)
explicit Greeter(QObject* parent=0);
virtual ~Greeter();
- QString getHint(const QString &name) const;
+ QString getHint(const QString &name) const;
QString defaultSessionHint() const;
bool hideUsersHint() const;
bool showManualLoginHint() const;
protected:
SessionsModelPrivate *d_ptr;
-
+
private:
Q_DECLARE_PRIVATE(SessionsModel)
};
LightDMGreeter *ldmGreeter;
protected:
Greeter* q_ptr;
-
+
static void cb_showPrompt(LightDMGreeter *greeter, const gchar *text, LightDMPromptType type, gpointer data);
static void cb_showMessage(LightDMGreeter *greeter, const gchar *text, LightDMMessageType type, gpointer data);
static void cb_authenticationComplete(LightDMGreeter *greeter, gpointer data);
static void cb_autoLoginExpired(LightDMGreeter *greeter, gpointer data);
static void cb_idle(LightDMGreeter *greeter, gpointer data);
static void cb_reset(LightDMGreeter *greeter, gpointer data);
-
+
private:
Q_DECLARE_PUBLIC(Greeter)
};
void GreeterPrivate::cb_showPrompt(LightDMGreeter *greeter, const gchar *text, LightDMPromptType type, gpointer data)
{
Q_UNUSED(greeter);
-
+
GreeterPrivate *that = static_cast<GreeterPrivate*>(data);
QString message = QString::fromUtf8(text);
-
+
Q_EMIT that->q_func()->showPrompt(message, type == LIGHTDM_PROMPT_TYPE_QUESTION ?
Greeter::PromptTypeQuestion : Greeter::PromptTypeSecret);
}
}
}
qWarning() << d->login1Interface->lastError();
-
+
QDBusReply<bool> reply = d->consoleKitInterface->call("CanRestart");
if (reply.isValid()) {
return reply.value();
*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/* Disable Plymouth if no X servers are replacing it */
if (plymouth_get_is_active ())
{
- g_debug ("Stopping Plymouth, no displays replace it");
+ g_debug ("Stopping Plymouth, no displays replace it");
plymouth_quit (FALSE);
}
}
check_stopped (manager);
}
-
+
static void
display_manager_init (DisplayManager *manager)
{
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
if (seat_proxy)
return seat_proxy;
-
+
if (!g_getenv ("XDG_SEAT_PATH"))
{
g_printerr ("Not running inside a display manager, XDG_SEAT_PATH not defined\n");
exit (EXIT_FAILURE);
}
g_clear_error (&error);
-
+
return seat_proxy;
}
if (!g_str_has_prefix (arg, "-"))
break;
-
+
if (strcmp (arg, "-h") == 0 || strcmp (arg, "--help") == 0)
{
g_printerr ("Usage:\n"
return EXIT_FAILURE;
}
g_clear_error (&error);
-
+
command = argv[arg_index];
arg_index++;
n_options = argc - arg_index;
lock_name = g_strdup_printf ("/tmp/.X%d-lock", xephyr_display_number);
has_lock = g_file_test (lock_name, G_FILE_TEST_EXISTS);
g_free (lock_name);
-
+
if (has_lock)
xephyr_display_number++;
else
}
else if (strcmp (dimensions, "fullscreen") == 0)
{
- xephyr_command = g_strdup_printf ("Xephyr :%d -fullscreen", xephyr_display_number);
+ xephyr_command = g_strdup_printf ("Xephyr :%d -fullscreen", xephyr_display_number);
}
else
{
- xephyr_command = g_strdup_printf ("Xephyr :%d -screen %s", xephyr_display_number, dimensions);
+ xephyr_command = g_strdup_printf ("Xephyr :%d -screen %s", xephyr_display_number, dimensions);
}
if (!g_shell_parse_argv (xephyr_command, NULL, &xephyr_argv, &error) ||
!g_spawn_async (NULL, xephyr_argv, NULL,
g_variant_get (result, "(&o)", &path);
g_print ("%s\n", path);
- return EXIT_SUCCESS;
+ return EXIT_SUCCESS;
}
else if (strcmp (command, "add-seat") == 0)
{
type = options[0];
properties = g_variant_builder_new (G_VARIANT_TYPE ("a(ss)"));
-
+
for (i = 1; i < n_options; i++)
{
gchar *property, *name, *value;
g_variant_builder_add_value (properties, g_variant_new ("(ss)", name, value));
g_free (property);
}
-
+
result = g_dbus_proxy_call_sync (dm_proxy,
"AddSeat",
g_variant_new ("(sa(ss))", type, properties),
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
guint8 *read_buffer;
gsize n_read;
gboolean use_secure_memory;
-
+
/* Hints for the greeter */
GHashTable *hints;
- /* Default session to use */
+ /* Default session to use */
gchar *default_session;
/* Sequence number of current PAM session */
write_string (guint8 *buffer, gint buffer_length, const gchar *value, gsize *offset)
{
gint length;
-
+
if (value)
length = strlen (value);
else
size = int_length () + string_length (session_get_username (session)) + int_length ();
for (i = 0; i < messages_length; i++)
size += int_length () + string_length (messages[i].msg);
-
+
write_header (message, MAX_MESSAGE_LENGTH, SERVER_MESSAGE_PROMPT_AUTHENTICATION, size, &offset);
write_int (message, MAX_MESSAGE_LENGTH, greeter->priv->authentication_sequence_number, &offset);
write_string (message, MAX_MESSAGE_LENGTH, session_get_username (session), &offset);
write_int (message, MAX_MESSAGE_LENGTH, sequence_number, &offset);
write_string (message, MAX_MESSAGE_LENGTH, username, &offset);
write_int (message, MAX_MESSAGE_LENGTH, result, &offset);
- write_message (greeter, message, offset);
+ write_message (greeter, message, offset);
}
void
return;
}
- greeter->priv->guest_account_authenticated = TRUE;
+ greeter->priv->guest_account_authenticated = TRUE;
send_end_authentication (greeter, sequence_number, "", PAM_SUCCESS);
}
greeter->priv->from_greeter_watch = 0;
return FALSE;
}
-
+
n_to_read = HEADER_SIZE;
if (greeter->priv->n_read >= HEADER_SIZE)
{
greeter->priv->read_buffer = secure_realloc (greeter, greeter->priv->read_buffer, n_to_read);
read_cb (source, condition, greeter);
return TRUE;
- }
+ }
}
-
+
offset = 0;
id = read_int (greeter, &offset);
length = HEADER_SIZE + read_int (greeter, &offset);
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
{
gchar *script;
static gchar *setup_script = NULL;
-
+
if (setup_script)
return setup_script;
setup_script = g_find_program_in_path (script);
g_free (script);
-
+
return setup_script;
}
NULL, NULL,
stdout_text, NULL, exit_status, error);
g_strfreev (argv);
-
+
return result;
}
g_debug ("Guest account setup script didn't return a username");
return NULL;
}
-
+
g_debug ("Guest account %s setup", username);
return username;
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
*
* Copyright (C) 2011 Canonical Ltd.
* Author: Martin Pitt <martin.pitt@ubuntu.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
g_variant_new ("(sa{sv}as)", interface_name, &builder, NULL),
&error))
g_warning ("Failed to emit PropertiesChanged signal: %s", error->message);
- g_clear_error (&error);
+ g_clear_error (&error);
}
static void
g_variant_new ("(o)", object_path),
&error))
g_warning ("Failed to emit %s signal on %s: %s", signal_name, path, error->message);
- g_clear_error (&error);
+ g_clear_error (&error);
}
static void
g_free (config_section);
g_object_unref (seat);
-
+
return started;
}
seat = login1_service_get_seat (service, id);
if (seat)
{
- service->priv->seats = g_list_remove (service->priv->seats, seat);
+ service->priv->seats = g_list_remove (service->priv->seats, seat);
g_signal_emit (service, service_signals[SEAT_REMOVED], 0, seat);
g_object_unref (seat);
- }
- }
+ }
+ }
}
gboolean
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
MirServer *mir_server_new (void)
{
- return g_object_new (MIR_SERVER_TYPE, NULL);
+ return g_object_new (MIR_SERVER_TYPE, NULL);
}
void
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
enum {
GOT_DATA,
- GOT_SIGNAL,
+ GOT_SIGNAL,
STOPPED,
LAST_SIGNAL
};
/* Process ID */
GPid pid;
-
+
/* Exit status of process */
int exit_status;
{
g_return_if_fail (process != NULL);
g_return_if_fail (name != NULL);
- g_hash_table_insert (process->priv->env, g_strdup (name), g_strdup (value));
+ g_hash_table_insert (process->priv->env, g_strdup (name), g_strdup (value));
}
const gchar *
if (process->priv->quit_timeout)
g_source_remove (process->priv->quit_timeout);
- process->priv->quit_timeout = 0;
+ process->priv->quit_timeout = 0;
process->priv->pid = 0;
g_hash_table_remove (processes, GINT_TO_POINTER (pid));
GError *error = NULL;
g_return_val_if_fail (process != NULL, FALSE);
- g_return_val_if_fail (process->priv->command != NULL, FALSE);
+ g_return_val_if_fail (process->priv->command != NULL, FALSE);
g_return_val_if_fail (process->priv->pid == 0, FALSE);
if (!g_shell_parse_argv (process->priv->command, &argc, &argv, &error))
#endif
for (i = 0; i < env_length; i++)
setenv (env_keys[i], env_values[i], TRUE);
-
+
execvp (argv[0], argv);
_exit (EXIT_FAILURE);
}
-
+
close (log_fd);
g_strfreev (argv);
g_free (env_keys);
int exit_status;
waitpid (process->priv->pid, &exit_status, 0);
process_watch_cb (process->priv->pid, exit_status, process);
- }
+ }
else
{
g_hash_table_insert (processes, GINT_TO_POINTER (process->priv->pid), g_object_ref (process));
Process *process;
errno = 0;
- if (read (signal_pipe[0], &signo, sizeof (int)) != sizeof (int) ||
+ if (read (signal_pipe[0], &signo, sizeof (int)) != sizeof (int) ||
read (signal_pipe[0], &pid, sizeof (pid_t)) != sizeof (pid_t))
{
g_warning ("Error reading from signal pipe: %s", strerror (errno));
struct sigaction action;
klass->stopped = process_stopped;
- object_class->finalize = process_finalize;
+ object_class->finalize = process_finalize;
g_type_class_add_private (klass, sizeof (ProcessPrivate));
G_STRUCT_OFFSET (ProcessClass, got_data),
NULL, NULL,
NULL,
- G_TYPE_NONE, 0);
+ G_TYPE_NONE, 0);
signals[GOT_SIGNAL] =
g_signal_new ("got-signal",
G_TYPE_FROM_CLASS (klass),
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
result = g_key_file_load_from_file (keys, path, G_KEY_FILE_NONE, &error);
if (error)
l_debug (seat, "Error getting key %s", error->message);
- g_clear_error (&error);
+ g_clear_error (&error);
if (result)
{
layout = seat_get_string_property (seat, "xserver-layout");
if (layout)
x_server_local_set_layout (x_server, layout);
-
+
x_server_local_set_xdg_seat (x_server, seat_get_name (seat));
config_file = seat_get_string_property (seat, "xserver-config");
static DisplayServer *
seat_unity_create_display_server (Seat *seat, Session *session)
-{
+{
const gchar *session_type;
-
+
session_type = session_get_session_type (session);
if (strcmp (session_type, "x") == 0)
return DISPLAY_SERVER (create_x_server (seat));
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
g_signal_handlers_disconnect_matched (SEAT_XLOCAL (seat)->priv->xdmcp_x_server, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, seat);
SEAT_XLOCAL (seat)->priv->xdmcp_x_server = NULL;
g_object_unref (display_server);
-
+
if (seat_get_is_stopping (seat))
check_stopped (SEAT_XLOCAL (seat));
else
result = g_key_file_load_from_file (keys, path, G_KEY_FILE_NONE, &error);
if (error)
l_debug (seat, "Error getting key %s", error->message);
- g_clear_error (&error);
+ g_clear_error (&error);
if (result)
{
config_file = seat_get_string_property (seat, "xserver-config");
if (config_file)
x_server_local_set_config (x_server, config_file);
-
+
allow_tcp = seat_get_boolean_property (seat, "xserver-allow-tcp");
- x_server_local_set_allow_tcp (x_server, allow_tcp);
+ x_server_local_set_allow_tcp (x_server, allow_tcp);
return x_server;
}
vt = get_vt (seat, DISPLAY_SERVER (compositor));
if (vt >= 0)
unity_system_compositor_set_vt (compositor, vt);
-
+
for (i = 0; ; i++)
{
socket_name = g_strdup_printf ("/run/lightdm-mir-%d", i);
compositor_command = session_config_get_compositor_command (session_get_config (session));
if (compositor_command)
unity_system_compositor_set_command (UNITY_SYSTEM_COMPOSITOR (compositor), compositor_command);
-
+
return compositor;
}
else
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
XServerRemote *x_server;
x_server = X_SERVER_REMOTE (display_server);
- process_set_env (script, "DISPLAY", x_server_get_address (X_SERVER (x_server)));
+ process_set_env (script, "DISPLAY", x_server_get_address (X_SERVER (x_server)));
process_set_env (script, "REMOTE_HOST", x_server_get_hostname (X_SERVER (x_server)));
SEAT_CLASS (seat_xremote_parent_class)->run_script (seat, display_server, script);
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
if (strcmp (session_get_session_type (session), "x") != 0)
return NULL;
-
+
x_server = x_server_xvnc_new ();
x_server_xvnc_set_socket (x_server, g_socket_get_fd (SEAT_XVNC (seat)->priv->connection));
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/* The session to set active when it starts */
Session *session_to_activate;
-
+
/* TRUE once we have started */
gboolean started;
{
Seat *seat;
SeatModule *m = NULL;
-
+
g_return_val_if_fail (module_name != NULL, NULL);
if (seat_modules)
{
Process *script;
gboolean result = FALSE;
-
+
script = process_new (NULL, NULL);
process_set_command (script, script_name);
static void
seat_real_run_script (Seat *seat, DisplayServer *display_server, Process *process)
-{
+{
}
static void
static void
set_greeter_hints (Seat *seat, Greeter *greeter_session)
{
- greeter_clear_hints (greeter_session);
+ greeter_clear_hints (greeter_session);
greeter_set_hint (greeter_session, "default-session", seat_get_string_property (seat, "user-session"));
greeter_set_hint (greeter_session, "hide-users", seat_get_boolean_property (seat, "greeter-hide-users") ? "true" : "false");
greeter_set_hint (greeter_session, "show-manual-login", seat_get_boolean_property (seat, "greeter-show-manual-login") ? "true" : "false");
g_free (argv[0]);
argv[0] = path;
}
-
+
return argv;
}
session_set_argv (session, argv);
g_strfreev (argv);
g_object_unref (session_config);
-
+
return session;
}
gchar **argv;
session = greeter_get_authentication_session (greeter);
-
+
/* Get session command to run */
switch (type)
{
g_signal_connect (greeter_session, "notify::active-username", G_CALLBACK (greeter_active_username_changed_cb), seat);
g_signal_connect (greeter_session, "authentication-complete", G_CALLBACK (session_authentication_complete_cb), seat);
g_signal_connect (greeter_session, "stopped", G_CALLBACK (session_stopped_cb), seat);
-
+
set_session_env (SESSION (greeter_session));
session_set_env (SESSION (greeter_session), "XDG_SESSION_CLASS", "greeter");
session_set_pam_service (SESSION (greeter_session), seat_get_string_property (seat, "pam-greeter-service"));
if (getuid () == 0)
{
- gchar *greeter_user;
+ gchar *greeter_user;
greeter_user = config_get_string (config_get_instance (), "LightDM", "greeter-user");
session_set_username (SESSION (greeter_session), greeter_user);
g_free (greeter_user);
background_session = session;
session = NULL;
}
-
+
if (session)
{
DisplayServer *display_server;
{
DisplayServer *display_server = link->data;
g_signal_handlers_disconnect_matched (display_server, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, self);
- }
+ }
g_list_free_full (self->priv->display_servers, g_object_unref);
for (link = self->priv->sessions; link; link = link->next)
{
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
n_read = read (from_daemon_output, buf, count);
if (n_read < 0)
g_printerr ("Error reading from daemon: %s\n", strerror (errno));
-
+
return n_read;
}
g_printerr ("Invalid string length %d from daemon\n", length);
return NULL;
}
-
+
value = (*alloc_fn) (sizeof (char) * (length + 1));
read_data (value, length);
- value[length] = '\0';
+ value[length] = '\0';
return value;
}
strncpy (u.ut_host, ut->ut_host, sizeof (u.ut_host));
u.ut_tv.tv_sec = ut->ut_tv.tv_sec;
u.ut_tv.tv_usec = ut->ut_tv.tv_usec;
-
+
updwtmp (wtmp_file, &u);
}
pam_set_item (pam_handle, PAM_TTY, xdisplay);
}
else if (tty)
- pam_set_item (pam_handle, PAM_TTY, tty);
+ pam_set_item (pam_handle, PAM_TTY, tty);
#ifdef PAM_XAUTHDATA
if (x_authority)
if (version >= 1)
{
g_free (tty);
- tty = read_string ();
+ tty = read_string ();
}
x_authority_filename = read_string ();
if (version >= 1)
}
else
{
- fd = open ("/dev/null", O_WRONLY);
+ fd = open ("/dev/null", O_WRONLY);
dup2 (fd, STDERR_FILENO);
close (fd);
}
pam_end (pam_handle, 0);
return EXIT_FAILURE;
}
-
+
/* Open the session */
result = pam_open_session (pam_handle, 0);
if (result != PAM_SUCCESS)
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2013 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
link = find_env_entry (session, name);
if (!link)
return NULL;
-
+
entry = link->data;
return entry + strlen (name) + 1;
GList *link;
g_return_if_fail (session != NULL);
-
+
link = find_env_entry (session, name);
if (!link)
return;
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2014 Canonical, Ltd
* Author: Michael Terry <michael.terry@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
entry = getpwnam (user);
if (!entry)
return NULL;
-
+
path = g_build_filename (USERS_DIR, user, NULL);
file = g_file_new_for_path (path);
else
g_warning ("Could not create user data directory %s: %s", path, error->message);
}
- g_clear_error (&error);
+ g_clear_error (&error);
if (!result)
{
g_object_unref (file);
/*
* Copyright (C) 2014 Canonical, Ltd
* Author: Michael Terry <michael.terry@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2013 Canonical Ltd.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
gsize n_to_read = 0;
guint16 id, payload_length;
/*guint8 *payload;*/
-
+
if (condition == G_IO_HUP)
{
l_debug (compositor, "Compositor closed communication channel");
return TRUE;
}
-
+
static void
unity_system_compositor_stop (DisplayServer *server)
{
{
UnitySystemCompositor *self;
- self = UNITY_SYSTEM_COMPOSITOR (object);
+ self = UNITY_SYSTEM_COMPOSITOR (object);
if (self->priv->process)
{
close (self->priv->from_compositor_pipe[0]);
close (self->priv->from_compositor_pipe[1]);
g_io_channel_unref (self->priv->from_compositor_channel);
- if (self->priv->from_compositor_watch)
+ if (self->priv->from_compositor_watch)
g_source_remove (self->priv->from_compositor_watch);
g_free (self->priv->read_buffer);
if (self->priv->timeout_source)
/*
* Copyright (C) 2013 Canonical Ltd.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
{
GSocket *socket;
GSocketAddress *address;
-
+
socket = g_socket_new (family, G_SOCKET_TYPE_STREAM, G_SOCKET_PROTOCOL_TCP, error);
if (!socket)
return NULL;
GError *error = NULL;
g_return_val_if_fail (server != NULL, FALSE);
-
+
server->priv->socket = open_tcp_socket (G_SOCKET_FAMILY_IPV4, server->priv->port, &error);
if (error)
g_warning ("Failed to create IPv4 VNC socket: %s", error->message);
g_clear_error (&error);
-
+
if (server->priv->socket)
{
source = g_socket_create_source (server->priv->socket, G_IO_IN, NULL);
g_source_set_callback (source, (GSourceFunc) read_cb, server, NULL);
g_source_attach (source, NULL);
}
-
+
server->priv->socket6 = open_tcp_socket (G_SOCKET_FAMILY_IPV6, server->priv->port, &error);
if (error)
g_warning ("Failed to create IPv6 VNC socket: %s", error->message);
VNCServer *self;
self = VNC_SERVER (object);
-
+
if (self->priv->socket)
g_object_unref (self->priv->socket);
if (self->priv->socket6)
g_object_unref (self->priv->socket6);
-
- G_OBJECT_CLASS (vnc_server_parent_class)->finalize (object);
+
+ G_OBJECT_CLASS (vnc_server_parent_class)->finalize (object);
}
static void
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = vnc_server_finalize;
+ object_class->finalize = vnc_server_finalize;
g_type_class_add_private (klass, sizeof (VNCServerPrivate));
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/* Pretend always active */
if (getuid () != 0)
- return;
+ return;
console_fd = open_console ();
if (console_fd >= 0)
number = vt_get_min ();
while (vt_is_used (number))
number++;
-
+
return number;
}
vt_ref (gint number)
{
g_debug ("Using VT %d", number);
- used_vts = g_list_append (used_vts, GINT_TO_POINTER (number));
+ used_vts = g_list_append (used_vts, GINT_TO_POINTER (number));
}
void
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/* Address of the X server (format dependent on family) */
guint8 *address;
gsize address_length;
-
+
/* Display number of X server */
gchar *number;
{
XAuthority *auth = g_object_new (X_AUTHORITY_TYPE, NULL);
- x_authority_set_family (auth, family);
+ x_authority_set_family (auth, family);
x_authority_set_address (auth, address, address_length);
x_authority_set_number (auth, number);
x_authority_set_authorization_name (auth, name);
{
guint8 cookie[16];
gint i;
-
+
for (i = 0; i < 16; i++)
cookie[i] = g_random_int () & 0xFF;
if (data_length - *offset < length)
return FALSE;
-
+
*value = g_malloc0 (length + 1);
for (i = 0; i < length; i++)
(*value)[i] = data[*offset + i];
}
return TRUE;
-}
+}
static void
x_authority_init (XAuthority *auth)
g_free (self->priv->authorization_name);
g_free (self->priv->authorization_data);
- G_OBJECT_CLASS (x_authority_parent_class)->finalize (object);
+ G_OBJECT_CLASS (x_authority_parent_class)->finalize (object);
}
static void
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
{
XAUTH_WRITE_MODE_REPLACE,
XAUTH_WRITE_MODE_REMOVE,
- XAUTH_WRITE_MODE_SET
+ XAUTH_WRITE_MODE_SET
} XAuthWriteMode;
GType x_authority_get_type (void);
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/* Server layout to use */
gchar *layout;
-
+
/* Value for -seat argument */
gchar *xdg_seat;
}
g_free (path);
-
+
return in_use;
}
const gchar *x_server_local_get_mir_id (XServerLocal *server)
{
g_return_val_if_fail (server != NULL, NULL);
- return server->priv->mir_id;
+ return server->priv->mir_id;
}
void
server->priv->have_vt_ref = FALSE;
}
x_server_local_release_display_number (x_server_get_display_number (X_SERVER (server)));
-
+
if (x_server_get_authority (X_SERVER (server)) && server->priv->authority_file)
{
l_debug (server, "Removing X server authority %s", server->priv->authority_file);
if (!server->priv->authority_file)
{
gchar *run_dir, *dir;
-
+
run_dir = config_get_string (config_get_instance (), "LightDM", "run-directory");
dir = g_build_filename (run_dir, "root", NULL);
g_free (run_dir);
if (server->priv->layout)
g_string_append_printf (command, " -layout %s", server->priv->layout);
-
+
if (server->priv->xdg_seat)
g_string_append_printf (command, " -seat %s", server->priv->xdg_seat);
return result;
}
-
+
static void
x_server_local_stop (DisplayServer *server)
{
{
XServerLocal *self;
- self = X_SERVER_LOCAL (object);
+ self = X_SERVER_LOCAL (object);
- if (self->priv->x_server_process)
+ if (self->priv->x_server_process)
{
g_signal_handlers_disconnect_matched (self->priv->x_server_process, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, self);
g_object_unref (self->priv->x_server_process);
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/* File descriptor to use for standard input */
gint socket_fd;
-
+
/* Geometry and colour depth */
gint width, height, depth;
if (error)
l_warning (display_server, "Failed to write authority: %s", error->message);
g_clear_error (&error);
-
+
command = g_string_new (absolute_command);
g_free (absolute_command);
-
+
g_string_append_printf (command, " :%d", x_server_get_display_number (X_SERVER (server)));
g_string_append_printf (command, " -auth %s", server->priv->authority_file);
g_string_append (command, " -inetd -nolisten tcp");
return result;
}
-
+
static void
x_server_xvnc_stop (DisplayServer *server)
{
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
#include "configuration.h"
struct XServerPrivate
-{
+{
/* Host running the server */
gchar *hostname;
server->priv->address = g_strdup_printf("%s:%d", server->priv->hostname, server->priv->number);
else
server->priv->address = g_strdup_printf(":%d", server->priv->number);
- }
+ }
return server->priv->address;
}
auth = &a;
}
- /* Open connection */
+ /* Open connection */
l_debug (server, "Connecting to XServer %s", x_server_get_address (server));
server->priv->connection = xcb_connect_to_display_with_auth_info (x_server_get_address (server), auth, NULL);
if (xcb_connection_has_error (server->priv->connection))
GObjectClass *object_class = G_OBJECT_CLASS (klass);
DisplayServerClass *display_server_class = DISPLAY_SERVER_CLASS (klass);
- display_server_class->get_session_type = x_server_get_session_type;
+ display_server_class->get_session_type = x_server_get_session_type;
display_server_class->get_can_share = x_server_get_can_share;
display_server_class->start = x_server_start;
display_server_class->connect_session = x_server_connect_session;
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
length = read_card16 (&reader);
if (reader.overflow)
- {
+ {
g_warning ("Ignoring short packet"); // FIXME: Use GError
return NULL;
}
write_string (&writer, packet->Request.manufacturer_display_id);
break;
case XDMCP_Accept:
- write_card32 (&writer, packet->Accept.session_id);
+ write_card32 (&writer, packet->Accept.session_id);
write_string (&writer, packet->Accept.authentication_name);
write_data (&writer, &packet->Accept.authentication_data);
write_string (&writer, packet->Accept.authorization_name);
g_warning ("Overflow writing response");
return -1;
}
-
+
return length + 6;
}
GString *s;
gchar *string;
gchar **i;
-
- s = g_string_new ("");
+
+ s = g_string_new ("");
for (i = strings; *i; i++)
{
if (i != strings)
packet->Willing.authentication_name, packet->Willing.hostname, packet->Willing.status);
case XDMCP_Unwilling:
return g_strdup_printf ("Unwilling(hostname='%s' status='%s')",
- packet->Unwilling.hostname, packet->Unwilling.status);
+ packet->Unwilling.hostname, packet->Unwilling.status);
case XDMCP_Request:
t = string_list_tostring (packet->Request.authorization_names);
t2 = data_tostring (&packet->Request.authentication_data);
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
typedef struct
{
XDMCPOpcode opcode;
-
+
union
{
struct
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
gssize n_written;
g_debug ("Send %s", xdmcp_packet_tostring (packet));
-
+
n_written = xdmcp_packet_encode (packet, data, 1024);
if (n_written < 0)
g_critical ("Failed to encode XDMCP packet");
else
response->Unwilling.status = g_strdup ("Server does not support authentication");
}
-
+
send_packet (socket, address, response);
xdmcp_packet_free (response);
xdmcp_packet_free (response);
return;
}
-
+
/* Must be using our authentication scheme */
if (strcmp (packet->Request.authentication_name, get_authentication_name (server)) != 0)
{
packet = xdmcp_packet_decode ((guint8 *)data, n_read);
if (packet)
- {
+ {
g_debug ("Got %s", xdmcp_packet_tostring (packet));
switch (packet->opcode)
handle_request (server, socket, address, packet);
break;
case XDMCP_Manage:
- handle_manage (server, socket, address, packet);
+ handle_manage (server, socket, address, packet);
break;
case XDMCP_KeepAlive:
handle_keep_alive (server, socket, address, packet);
GSocket *socket;
GSocketAddress *address;
gboolean result;
-
+
socket = g_socket_new (family, G_SOCKET_TYPE_DATAGRAM, G_SOCKET_PROTOCOL_UDP, error);
if (!socket)
return NULL;
GError *error = NULL;
g_return_val_if_fail (server != NULL, FALSE);
-
+
server->priv->socket = open_udp_socket (G_SOCKET_FAMILY_IPV4, server->priv->port, &error);
if (error)
g_warning ("Failed to create IPv4 XDMCP socket: %s", error->message);
g_clear_error (&error);
-
+
if (server->priv->socket)
{
source = g_socket_create_source (server->priv->socket, G_IO_IN, NULL);
g_source_set_callback (source, (GSourceFunc) read_cb, server, NULL);
g_source_attach (source, NULL);
}
-
+
server->priv->socket6 = open_udp_socket (G_SOCKET_FAMILY_IPV6, server->priv->port, &error);
if (error)
g_warning ("Failed to create IPv6 XDMCP socket: %s", error->message);
XDMCPServer *self;
self = XDMCP_SERVER (object);
-
+
if (self->priv->socket)
g_object_unref (self->priv->socket);
if (self->priv->socket6)
g_free (self->priv->status);
g_free (self->priv->key);
g_hash_table_unref (self->priv->sessions);
-
- G_OBJECT_CLASS (xdmcp_server_parent_class)->finalize (object);
+
+ G_OBJECT_CLASS (xdmcp_server_parent_class)->finalize (object);
}
static void
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = xdmcp_server_finalize;
+ object_class->finalize = xdmcp_server_finalize;
g_type_class_add_private (klass, sizeof (XDMCPServerPrivate));
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
guint inactive_timeout;
XAuthority *authority;
-
+
gboolean started;
guint16 display_number;
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
XDMCPSession *self;
self = XDMCP_SESSION (object);
-
+
g_free (self->priv->manufacturer_display_id);
if (self->priv->address)
g_object_unref (self->priv->address);
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = xdmcp_session_finalize;
+ object_class->finalize = xdmcp_session_finalize;
g_type_class_add_private (klass, sizeof (XDMCPSessionPrivate));
}
/*
* Copyright (C) 2010-2011 Robert Ancell.
* Author: Robert Ancell <robert.ancell@canonical.com>
- *
+ *
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
static void
xdmcp_decline_cb (XDMCPClient *client, XDMCPDecline *message)
{
- status_notify ("%s GOT-DECLINE STATUS=\"%s\" AUTHENTICATION-NAME=\"%s\"", id, message->status, message->authentication_name);
+ status_notify ("%s GOT-DECLINE STATUS=\"%s\" AUTHENTICATION-NAME=\"%s\"", id, message->status, message->authentication_name);
}
static void
static void
client_disconnected_cb (XServer *server, XClient *client)
-{
- g_signal_handlers_disconnect_matched (client, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, NULL);
+{
+ g_signal_handlers_disconnect_matched (client, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, NULL);
}
static void
gchar *socket_path;
socket_dir = g_build_filename (g_getenv ("LIGHTDM_TEST_ROOT"), "tmp", ".X11-unix", NULL);
- g_mkdir_with_parents (socket_dir, 0755);
+ g_mkdir_with_parents (socket_dir, 0755);
socket_filename = g_strdup_printf ("X%d", display_number);
socket_path = g_build_filename (socket_dir, socket_filename, NULL);
xdmcp_client_set_hostname (xdmcp_client, xdmcp_host);
if (xdmcp_port > 0)
xdmcp_client_set_port (xdmcp_client, xdmcp_port);
- g_signal_connect (xdmcp_client, "query", G_CALLBACK (xdmcp_query_cb), NULL);
+ g_signal_connect (xdmcp_client, "query", G_CALLBACK (xdmcp_query_cb), NULL);
g_signal_connect (xdmcp_client, "willing", G_CALLBACK (xdmcp_willing_cb), NULL);
g_signal_connect (xdmcp_client, "accept", G_CALLBACK (xdmcp_accept_cb), NULL);
g_signal_connect (xdmcp_client, "decline", G_CALLBACK (xdmcp_decline_cb), NULL);
static void
client_disconnected_cb (XServer *server, XClient *client)
-{
- g_signal_handlers_disconnect_matched (client, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, NULL);
+{
+ g_signal_handlers_disconnect_matched (client, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, NULL);
}
static gboolean
buffer[n_read-1] = '\0';
status_notify ("%s VNC-CLIENT-CONNECT VERSION=\"%s\"", id, buffer);
}
-
+
return TRUE;
}
{
g_free (geometry);
geometry = g_strdup (argv[i+1]);
- i++;
+ i++;
}
else if (strcmp (arg, "-depth") == 0)
{
config = g_key_file_new ();
g_key_file_load_from_file (config, g_build_filename (g_getenv ("LIGHTDM_TEST_ROOT"), "script", NULL), G_KEY_FILE_NONE, NULL);
-
+
if (use_inetd)
{
if (!g_io_add_watch (g_io_channel_unix_new (STDIN_FILENO), G_IO_IN, vnc_data_cb, NULL))
if (n_read > 0 && address[n_read - 1] == '\n')
address[n_read - 1] = '\0';
-
+
return g_strdup (address);
}
int (*_stat) (const char *path, struct stat *buf);
gchar *new_path = NULL;
int ret;
-
+
_stat = (int (*)(const char *path, struct stat *buf)) dlsym (RTLD_NEXT, "stat");
new_path = redirect_path (path);
int (*___xstat) (int version, const char *path, struct stat *buf);
gchar *new_path = NULL;
int ret;
-
+
___xstat = (int (*)(int version, const char *path, struct stat *buf)) dlsym (RTLD_NEXT, "__xstat");
new_path = redirect_path (path);
int (*___xstat64) (int version, const char *path, struct stat64 *buf);
gchar *new_path = NULL;
int ret;
-
+
___xstat64 = (int (*)(int version, const char *path, struct stat64 *buf)) dlsym (RTLD_NEXT, "__xstat64");
new_path = redirect_path (path);
int (*___fxstatat) (int ver, int dirfd, const char *pathname, struct stat *buf, int flags);
gchar *new_path = NULL;
int ret;
-
+
___fxstatat = (int (*)(int ver, int dirfd, const char *pathname, struct stat *buf, int flags)) dlsym (RTLD_NEXT, "__fxstatat");
new_path = redirect_path (pathname);
int (*___fxstatat64) (int ver, int dirfd, const char *pathname, struct stat64 *buf, int flags);
gchar *new_path = NULL;
int ret;
-
+
___fxstatat64 = (int (*)(int ver, int dirfd, const char *pathname, struct stat64 *buf, int flags)) dlsym (RTLD_NEXT, "__fxstatat64");
new_path = redirect_path (pathname);
result = _opendir (new_path);
g_free (new_path);
- return result;
+ return result;
}
int
free_user (gpointer data)
{
struct passwd *entry = data;
-
+
g_free (entry->pw_name);
g_free (entry->pw_passwd);
g_free (entry->pw_gecos);
getpwnam (const char *name)
{
GList *link;
-
+
if (name == NULL)
return NULL;
-
+
load_passwd_file ();
for (link = user_entries; link; link = link->next)
free_group (gpointer data)
{
struct group *entry = data;
-
+
g_free (entry->gr_name);
g_free (entry->gr_passwd);
g_strfreev (entry->gr_mem);
status_notify ("%s", status->str);
g_string_free (status, TRUE);
}
-
+
if (strcmp (pamh->service_name, "test-remote") == 0)
{
int result;
msg = malloc (sizeof (struct pam_message *) * 1);
msg[0] = malloc (sizeof (struct pam_message));
- msg[0]->msg_style = PAM_PROMPT_ECHO_ON;
+ msg[0]->msg_style = PAM_PROMPT_ECHO_ON;
msg[0]->msg = "remote-login:";
result = pamh->conversation.conv (1, (const struct pam_message **) msg, &resp, pamh->conversation.appdata_ptr);
free (msg[0]);
msg = malloc (sizeof (struct pam_message *) * 1);
msg[0] = malloc (sizeof (struct pam_message));
- msg[0]->msg_style = PAM_PROMPT_ECHO_ON;
+ msg[0]->msg_style = PAM_PROMPT_ECHO_ON;
msg[0]->msg = LOGIN_PROMPT;
result = pamh->conversation.conv (1, (const struct pam_message **) msg, &resp, pamh->conversation.appdata_ptr);
free (msg[0]);
free (resp);
return PAM_CONV_ERR;
}
-
+
pamh->user = strdup (resp[0].resp);
free (resp[0].resp);
free (resp);
get_env_value (const char *name_value, const char *name)
{
int j;
-
+
for (j = 0; name[j] && name_value[j] && name[j] == name_value[j]; j++);
if (name[j] == '\0' && name_value[j] == '=')
return &name_value[j + 1];
{
if (pamh == NULL || item == NULL)
return PAM_SYSTEM_ERR;
-
+
switch (item_type)
{
case PAM_SERVICE:
*item = pamh->service_name;
return PAM_SUCCESS;
-
+
case PAM_USER:
*item = pamh->user;
return PAM_SUCCESS;
case PAM_RUSER:
*item = pamh->ruser;
return PAM_SUCCESS;
-
+
case PAM_USER_PROMPT:
*item = LOGIN_PROMPT;
return PAM_SUCCESS;
-
+
case PAM_TTY:
*item = pamh->tty;
return PAM_SUCCESS;
status_notify ("%s", status->str);
g_string_free (status, TRUE);
}
-
+
if (!pamh->user)
return PAM_USER_UNKNOWN;
xcb_connection_t *c;
gchar *socket_path;
GError *error = NULL;
-
+
c = malloc (sizeof (xcb_connection_t));
c->display = g_strdup (display);
c->error = 0;
if (argc == 2 && strcmp (argv[1], "--has-active-vt") == 0)
{
if (g_key_file_get_boolean (config, "test-plymouth-config", "has-active-vt", NULL))
- {
+ {
status_notify ("PLYMOUTH HAS-ACTIVE-VT=TRUE");
return EXIT_SUCCESS;
}
gchar *id, *name = NULL;
gboolean id_matches;
GHashTable *params;
- GError *error = NULL;
+ GError *error = NULL;
n_read = g_socket_receive (socket, (gchar *)&length, sizeof (length), NULL, &error);
if (n_read > 0)
#ifdef __cplusplus
extern "C" {
#endif
-
+
#include <glib-object.h>
typedef void (*StatusRequestFunc)(const gchar *name, GHashTable *params);
const gchar *id, *v;
Login1Seat *seat;
- id = g_hash_table_lookup (params, "ID");
+ id = g_hash_table_lookup (params, "ID");
seat = add_login1_seat (g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL), id, TRUE);
v = g_hash_table_lookup (params, "CAN-GRAPHICAL");
if (v)
{
Login1Seat *seat;
const gchar *id;
-
+
id = g_hash_table_lookup (params, "ID");
seat = find_login1_seat (id);
if (seat)
CKSession *session = user_data;
if (strcmp (method_name, "Lock") == 0)
- {
+ {
if (!session->locked)
check_status ("CONSOLE-KIT LOCK-SESSION");
session->locked = TRUE;
if (error)
g_warning ("Failed to emit SeatNew: %s", error->message);
g_clear_error (&error);
-
+
login1_seats = g_list_remove (login1_seats, seat);
g_free (seat->id);
g_free (seat->path);
if (u->uid == uid)
return u;
}
-
+
return NULL;
}
if (!g_file_test (temp_dir, G_FILE_TEST_EXISTS))
break;
i++;
- }
+ }
g_mkdir_with_parents (temp_dir, 0755);
g_setenv ("LIGHTDM_TEST_ROOT", temp_dir, TRUE);
config = g_key_file_new ();
g_key_file_load_from_file (config, g_build_filename (g_getenv ("LIGHTDM_TEST_ROOT"), "script", NULL), G_KEY_FILE_NONE, NULL);
-
+
if (argc < 2)
{
g_printerr ("Usage: %s text [return-value]\n", argv[0]);
g_main_loop_quit (loop);
return;
}
-
+
if (strcmp (name, "LOGOUT") == 0)
exit (EXIT_SUCCESS);
{
const gchar *data = g_hash_table_lookup (params, "DATA");
gchar *dir;
-
+
dir = getenv ("XDG_GREETER_DATA_DIR");
if (dir)
{
if (n_read != payload_length)
{
g_printerr ("Short read for payload, %zi instead of expected %d\n", n_read, payload_length);
- return FALSE;
+ return FALSE;
}
switch (id)
config = g_key_file_new ();
g_key_file_load_from_file (config, g_build_filename (g_getenv ("LIGHTDM_TEST_ROOT"), "script", NULL), G_KEY_FILE_NONE, NULL);
-
+
if (argc > 1)
server_address = g_strdup (argv[1]);
else
address = g_network_address_new (hostname, port);
enumerator = g_socket_connectable_enumerate (address);
result = FALSE;
- while (TRUE)
+ while (TRUE)
{
GSocketAddress *socket_address;
GError *e = NULL;
for (link = authority->priv->records; link; link = link->next)
{
XAuthorityRecord *record = link->data;
-
+
if (strcmp (record->priv->authorization_name, authorization_name) != 0)
continue;
-
+
if (record->priv->family == XAUTH_FAMILY_WILD || record->priv->family == XAUTH_FAMILY_LOCAL)
return record;
}
for (link = authority->priv->records; link; link = link->next)
{
XAuthorityRecord *record = link->data;
-
+
if (strcmp (record->priv->authorization_name, authorization_name) != 0)
continue;
-
+
if (record->priv->family == XAUTH_FAMILY_WILD || record->priv->family == XAUTH_FAMILY_LOCALHOST)
return record;
}
if (strcmp (record->priv->authorization_name, "MIT-MAGIC-COOKIE-1") != 0)
return FALSE;
-
+
if (cookie_data_length != record->priv->authorization_data_length)
return FALSE;
struct XClientPrivate
{
XServer *server;
- GSocket *socket;
+ GSocket *socket;
GIOChannel *channel;
};
x_client_send_failed (XClient *client, const gchar *reason)
{
gchar *message;
-
+
message = g_strdup_printf ("FAILED:%s", reason);
errno = 0;
if (send (g_io_channel_unix_get_fd (client->priv->channel), message, strlen (message), 0) != strlen (message))
g_free (message);
}
-void
+void
x_client_send_success (XClient *client)
{
gchar *message;
};
enum {
- XDMCP_CLIENT_QUERY,
+ XDMCP_CLIENT_QUERY,
XDMCP_CLIENT_WILLING,
XDMCP_CLIENT_ACCEPT,
XDMCP_CLIENT_DECLINE,
/* Stop sending queries */
g_source_remove (client->priv->query_timer);
client->priv->query_timer = 0;
-
+
message = g_malloc0 (sizeof (XDMCPWilling));
length = read_card16 (buffer, buffer_length, X_BYTE_ORDER_MSB, &offset);
message->status = read_string (buffer, buffer_length, length, &offset);
g_signal_emit (client, xdmcp_client_signals[XDMCP_CLIENT_WILLING], 0, message);
-
+
g_free (message->authentication_name);
g_free (message->hostname);
g_free (message->status);
XDMCPDecline *message;
gsize offset = 0;
guint16 length;
-
+
message = g_malloc0 (sizeof (XDMCPDecline));
length = read_card16 (buffer, buffer_length, X_BYTE_ORDER_MSB, &offset);
message->authentication_name = read_string (buffer, buffer_length, length, &offset);
length = read_card16 (buffer, buffer_length, X_BYTE_ORDER_MSB, &offset);
read_string8 (buffer, buffer_length, length, &offset);
-
+
g_signal_emit (client, xdmcp_client_signals[XDMCP_CLIENT_DECLINE], 0, message);
g_free (message->status);
address = g_network_address_new (client->priv->host, client->priv->port);
enumerator = g_socket_connectable_enumerate (address);
result = FALSE;
- while (TRUE)
+ while (TRUE)
{
GSocketAddress *socket_address;
GError *e = NULL;
g_warning ("Unable to connect XDMCP socket: %s", error->message);
if (!result)
return FALSE;
-
+
g_io_add_watch (g_io_channel_unix_new (g_socket_get_fd (client->priv->socket)), G_IO_IN, xdmcp_data_cb, client);
client->priv->query_timer = g_timeout_add (2000, xdmcp_query_cb, client);
- xdmcp_query_cb (client);
+ xdmcp_query_cb (client);
return TRUE;
}
xdmcp_client_get_local_address (XDMCPClient *client)
{
GSocketAddress *socket_address;
-
+
if (!client->priv->socket)
return NULL;
write_card16 (buffer, MAXIMUM_REQUEST_LENGTH, X_BYTE_ORDER_MSB, 1, &offset);
write_card8 (buffer, MAXIMUM_REQUEST_LENGTH, 0, &offset);
- xdmcp_write (client, buffer, offset);
+ xdmcp_write (client, buffer, offset);
}
void
write_card16 (buffer, MAXIMUM_REQUEST_LENGTH, X_BYTE_ORDER_MSB, strlen (display_class), &offset);
write_string (buffer, MAXIMUM_REQUEST_LENGTH, display_class, &offset);
- xdmcp_write (client, buffer, offset);
+ xdmcp_write (client, buffer, offset);
}
static void