Back to index

lightdm  1.3.2
Classes | Defines | Enumerations | Functions
greeter.h File Reference
#include <glib-object.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  LightDMGreeter
struct  LightDMGreeterClass

Defines

#define LIGHTDM_TYPE_GREETER   (lightdm_greeter_get_type())
#define LIGHTDM_GREETER(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), LIGHTDM_TYPE_GREETER, LightDMGreeter));
#define LIGHTDM_GREETER_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), LIGHTDM_TYPE_GREETER, LightDMGreeterClass))
#define LIGHTDM_IS_GREETER(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LIGHTDM_TYPE_GREETER))
#define LIGHTDM_IS_GREETER_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), LIGHTDM_TYPE_GREETER))
#define LIGHTDM_GREETER_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), LIGHTDM_TYPE_GREETER, LightDMGreeterClass))

Enumerations

enum  LightDMPromptType { LIGHTDM_PROMPT_TYPE_QUESTION, LIGHTDM_PROMPT_TYPE_SECRET }
 LightDMPromptType: : Prompt is a question. More...
enum  LightDMMessageType { LIGHTDM_MESSAGE_TYPE_INFO, LIGHTDM_MESSAGE_TYPE_ERROR }
 LightDMMessageType: : Informational message. More...

Functions

GType lightdm_greeter_get_type (void)
LightDMGreeterlightdm_greeter_new (void)
 lightdm_greeter_new:
gboolean lightdm_greeter_connect_sync (LightDMGreeter *greeter, GError **error)
 lightdm_greeter_connect_sync: : The greeter to connect : return location for a #GError, or NULL
const gchar * lightdm_greeter_get_hint (LightDMGreeter *greeter, const gchar *name)
const gchar * lightdm_greeter_get_default_session_hint (LightDMGreeter *greeter)
 lightdm_greeter_get_default_session_hint: : A LightDMGreeter
gboolean lightdm_greeter_get_hide_users_hint (LightDMGreeter *greeter)
 lightdm_greeter_get_hide_users_hint: : A LightDMGreeter
gboolean lightdm_greeter_get_show_manual_login_hint (LightDMGreeter *greeter)
 lightdm_greeter_get_show_manual_login_hint: : A LightDMGreeter
gboolean lightdm_greeter_get_lock_hint (LightDMGreeter *greeter)
 lightdm_greeter_get_lock_hint: : A LightDMGreeter
gboolean lightdm_greeter_get_has_guest_account_hint (LightDMGreeter *greeter)
 lightdm_greeter_get_has_guest_account_hint: : A LightDMGreeter
const gchar * lightdm_greeter_get_select_user_hint (LightDMGreeter *greeter)
 lightdm_greeter_get_select_user_hint: : A LightDMGreeter
gboolean lightdm_greeter_get_select_guest_hint (LightDMGreeter *greeter)
 lightdm_greeter_get_select_guest_hint: : A LightDMGreeter
const gchar * lightdm_greeter_get_autologin_user_hint (LightDMGreeter *greeter)
 lightdm_greeter_get_autologin_user_hint: : A LightDMGreeter
gboolean lightdm_greeter_get_autologin_guest_hint (LightDMGreeter *greeter)
 lightdm_greeter_get_autologin_guest_hint: : A LightDMGreeter
gint lightdm_greeter_get_autologin_timeout_hint (LightDMGreeter *greeter)
 lightdm_greeter_get_autologin_timeout_hint: : A LightDMGreeter
void lightdm_greeter_cancel_autologin (LightDMGreeter *greeter)
 lightdm_greeter_cancel_autologin: : A LightDMGreeter
void lightdm_greeter_authenticate (LightDMGreeter *greeter, const char *username)
 lightdm_greeter_authenticate: : A LightDMGreeter : (allow-none): A username or #NULL to prompt for a username.
void lightdm_greeter_authenticate_as_guest (LightDMGreeter *greeter)
 lightdm_greeter_authenticate_as_guest: : A LightDMGreeter
void lightdm_greeter_respond (LightDMGreeter *greeter, const gchar *response)
 lightdm_greeter_respond: : A LightDMGreeter : Response to a prompt
void lightdm_greeter_cancel_authentication (LightDMGreeter *greeter)
 lightdm_greeter_cancel_authentication: : A LightDMGreeter
gboolean lightdm_greeter_get_in_authentication (LightDMGreeter *greeter)
 lightdm_greeter_get_in_authentication: : A LightDMGreeter
gboolean lightdm_greeter_get_is_authenticated (LightDMGreeter *greeter)
 lightdm_greeter_get_is_authenticated: : A LightDMGreeter
const gchar * lightdm_greeter_get_authentication_user (LightDMGreeter *greeter)
 lightdm_greeter_get_authentication_user: : A LightDMGreeter
void lightdm_greeter_set_language (LightDMGreeter *greeter, const gchar *language)
 lightdm_greeter_set_language: : A LightDMGreeter : The language to use for this user.
gboolean lightdm_greeter_start_session_sync (LightDMGreeter *greeter, const gchar *session, GError **error)
 lightdm_greeter_start_session_sync: : A LightDMGreeter : (allow-none): The session to log into or #NULL to use the default.

Class Documentation

struct LightDMGreeter

Definition at line 48 of file greeter.h.

Class Members
GObject parent_instance

Define Documentation

#define LIGHTDM_GREETER (   obj)    (G_TYPE_CHECK_INSTANCE_CAST ((obj), LIGHTDM_TYPE_GREETER, LightDMGreeter));

Definition at line 20 of file greeter.h.

#define LIGHTDM_GREETER_CLASS (   klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), LIGHTDM_TYPE_GREETER, LightDMGreeterClass))

Definition at line 21 of file greeter.h.

#define LIGHTDM_GREETER_GET_CLASS (   obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), LIGHTDM_TYPE_GREETER, LightDMGreeterClass))

Definition at line 24 of file greeter.h.

#define LIGHTDM_IS_GREETER (   obj)    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LIGHTDM_TYPE_GREETER))

Definition at line 22 of file greeter.h.

#define LIGHTDM_IS_GREETER_CLASS (   klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), LIGHTDM_TYPE_GREETER))

Definition at line 23 of file greeter.h.

Definition at line 19 of file greeter.h.


Enumeration Type Documentation

LightDMMessageType: : Informational message.

: Error message.

Enumerator:
LIGHTDM_MESSAGE_TYPE_INFO 
LIGHTDM_MESSAGE_TYPE_ERROR 

Definition at line 42 of file greeter.h.

LightDMPromptType: : Prompt is a question.

The information can be shown as it is entered. : Prompt is for secret information. The entered information should be obscured so it can't be publically visible.

Enumerator:
LIGHTDM_PROMPT_TYPE_QUESTION 
LIGHTDM_PROMPT_TYPE_SECRET 

Definition at line 31 of file greeter.h.


Function Documentation

void lightdm_greeter_authenticate ( LightDMGreeter greeter,
const char *  username 
)

lightdm_greeter_authenticate: : A LightDMGreeter : (allow-none): A username or #NULL to prompt for a username.

Starts the authentication procedure for a user.

Definition at line 764 of file greeter.c.

{
    LightDMGreeterPrivate *priv;
    guint8 message[MAX_MESSAGE_LENGTH];
    gsize offset = 0;

    g_return_if_fail (LIGHTDM_IS_GREETER (greeter));

    priv = GET_PRIVATE (greeter);

    g_return_if_fail (priv->connected);

    priv->cancelling_authentication = FALSE;
    priv->authenticate_sequence_number++;
    priv->in_authentication = TRUE;  
    priv->is_authenticated = FALSE;
    if (username != priv->authentication_user)
    {
        g_free (priv->authentication_user);
        priv->authentication_user = g_strdup (username);
    }

    g_debug ("Starting authentication for user %s...", username);
    write_header (message, MAX_MESSAGE_LENGTH, GREETER_MESSAGE_AUTHENTICATE, int_length () + string_length (username), &offset);
    write_int (message, MAX_MESSAGE_LENGTH, priv->authenticate_sequence_number, &offset);
    write_string (message, MAX_MESSAGE_LENGTH, username, &offset);
    write_message (greeter, message, offset);
}

Here is the call graph for this function:

Here is the caller graph for this function:

lightdm_greeter_authenticate_as_guest: : A LightDMGreeter

Starts the authentication procedure for the guest user.

Definition at line 800 of file greeter.c.

{
    LightDMGreeterPrivate *priv;
    guint8 message[MAX_MESSAGE_LENGTH];
    gsize offset = 0;

    g_return_if_fail (LIGHTDM_IS_GREETER (greeter));

    priv = GET_PRIVATE (greeter);

    g_return_if_fail (priv->connected);

    priv->cancelling_authentication = FALSE;
    priv->authenticate_sequence_number++;
    priv->in_authentication = TRUE;
    priv->is_authenticated = FALSE;
    g_free (priv->authentication_user);
    priv->authentication_user = NULL;

    g_debug ("Starting authentication for guest account...");
    write_header (message, MAX_MESSAGE_LENGTH, GREETER_MESSAGE_AUTHENTICATE_AS_GUEST, int_length (), &offset);
    write_int (message, MAX_MESSAGE_LENGTH, priv->authenticate_sequence_number, &offset);
    write_message (greeter, message, offset);
}

Here is the call graph for this function:

Here is the caller graph for this function:

lightdm_greeter_cancel_authentication: : A LightDMGreeter

Cancel the current user authentication.

Definition at line 861 of file greeter.c.

{
    LightDMGreeterPrivate *priv;
    guint8 message[MAX_MESSAGE_LENGTH];
    gsize offset = 0;

    g_return_if_fail (LIGHTDM_IS_GREETER (greeter));

    priv = GET_PRIVATE (greeter);

    g_return_if_fail (priv->connected);

    priv->cancelling_authentication = TRUE;
    write_header (message, MAX_MESSAGE_LENGTH, GREETER_MESSAGE_CANCEL_AUTHENTICATION, 0, &offset);
    write_message (greeter, message, offset);
}

Here is the call graph for this function:

lightdm_greeter_cancel_autologin: : A LightDMGreeter

Cancel the automatic login.

Definition at line 743 of file greeter.c.

{
    LightDMGreeterPrivate *priv;

    g_return_if_fail (LIGHTDM_IS_GREETER (greeter));

    priv = GET_PRIVATE (greeter);

    if (priv->autologin_timeout)
       g_source_remove (priv->autologin_timeout);
    priv->autologin_timeout = 0;
}
gboolean lightdm_greeter_connect_sync ( LightDMGreeter greeter,
GError **  error 
)

lightdm_greeter_connect_sync: : The greeter to connect : return location for a #GError, or NULL

Connects the greeter to the display manager. Will block until connected.

Return value: #TRUE if successfully connected

Definition at line 470 of file greeter.c.

{
    LightDMGreeterPrivate *priv;
    const gchar *fd;
    guint8 message[MAX_MESSAGE_LENGTH];
    guint8 *response;
    gsize response_length, offset = 0;
    guint32 id;

    g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);

    priv = GET_PRIVATE (greeter);

    fd = g_getenv ("LIGHTDM_TO_SERVER_FD");
    if (!fd)
    {
        g_warning ("No LIGHTDM_TO_SERVER_FD environment variable");
        return FALSE;
    }
    priv->to_server_channel = g_io_channel_unix_new (atoi (fd));
    g_io_channel_set_encoding (priv->to_server_channel, NULL, NULL);

    fd = g_getenv ("LIGHTDM_FROM_SERVER_FD");
    if (!fd)
    {
        g_warning ("No LIGHTDM_FROM_SERVER_FD environment variable");
        return FALSE;
    }
    priv->from_server_channel = g_io_channel_unix_new (atoi (fd));
    g_io_channel_set_encoding (priv->from_server_channel, NULL, NULL);
    g_io_add_watch (priv->from_server_channel, G_IO_IN, from_server_cb, greeter);

    g_debug ("Connecting to display manager...");
    write_header (message, MAX_MESSAGE_LENGTH, GREETER_MESSAGE_CONNECT, string_length (VERSION), &offset);
    write_string (message, MAX_MESSAGE_LENGTH, VERSION, &offset);
    write_message (greeter, message, offset);

    response = read_message (greeter, &response_length, TRUE);
    if (!response)
        return FALSE;

    offset = 0;
    id = read_int (response, response_length, &offset);
    read_int (response, response_length, &offset);
    if (id == SERVER_MESSAGE_CONNECTED)
        handle_connected (greeter, response, response_length, &offset);
    g_free (response);
    if (id != SERVER_MESSAGE_CONNECTED)
    {
        g_warning ("Expected CONNECTED message, got %d", id);
        return FALSE;
    }

    priv->connected = TRUE;

    return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

lightdm_greeter_get_authentication_user: : A LightDMGreeter

Get the user that is being authenticated.

Return value: The username of the authentication user being authenticated or #NULL if no authentication in progress.

Definition at line 917 of file greeter.c.

{
    g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), NULL);
    return GET_PRIVATE (greeter)->authentication_user;
}

Here is the caller graph for this function:

lightdm_greeter_get_autologin_guest_hint: : A LightDMGreeter

Check if the guest account should be automatically logged into when the timer expires.

Return value: #TRUE if the guest account should be automatically logged into.

Definition at line 702 of file greeter.c.

{
    const gchar *value;

    g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
    value = lightdm_greeter_get_hint (greeter, "autologin-guest");
  
    return g_strcmp0 (value, "true") == 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

lightdm_greeter_get_autologin_timeout_hint: : A LightDMGreeter

Get the number of seconds to wait before automaitcally logging in.

Return value: The number of seconds to wait before automatically logging in or 0 for no timeout.

Definition at line 721 of file greeter.c.

{
    const gchar *value;
    gint timeout = 0;

    g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
    value = lightdm_greeter_get_hint (greeter, "autologin-timeout");
    if (value)
        timeout = atoi (value);
    if (timeout < 0)
        timeout = 0;

    return timeout;
}

Here is the call graph for this function:

Here is the caller graph for this function:

lightdm_greeter_get_autologin_user_hint: : A LightDMGreeter

Get the user account to automatically logg into when the timer expires.

Return value: The user account to automatically log into.

Definition at line 687 of file greeter.c.

{
    g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), NULL);
    return lightdm_greeter_get_hint (greeter, "autologin-user");
}

Here is the call graph for this function:

Here is the caller graph for this function:

lightdm_greeter_get_default_session_hint: : A LightDMGreeter

Get the default session to use.

Return value: The session name

Definition at line 553 of file greeter.c.

{
    g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), NULL);
    return lightdm_greeter_get_hint (greeter, "default-session");
}

Here is the call graph for this function:

Here is the caller graph for this function:

lightdm_greeter_get_has_guest_account_hint: : A LightDMGreeter

Check if guest sessions are supported.

Return value: #TRUE if guest sessions are supported.

Definition at line 634 of file greeter.c.

{
    const gchar *value;

    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;
}

Here is the call graph for this function:

Here is the caller graph for this function:

lightdm_greeter_get_hide_users_hint: : A LightDMGreeter

Check if user accounts should be shown. If this is TRUE then the list of 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.

Return value: #TRUE if the available users should not be shown.

Definition at line 574 of file greeter.c.

{
    const gchar *value;

    g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
    value = lightdm_greeter_get_hint (greeter, "hide-users");

    return g_strcmp0 (value, "true") == 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

const gchar* lightdm_greeter_get_hint ( LightDMGreeter greeter,
const gchar *  name 
)

Definition at line 538 of file greeter.c.

{
    g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), NULL);
    return g_hash_table_lookup (GET_PRIVATE (greeter)->hints, name);
}

Here is the caller graph for this function:

lightdm_greeter_get_in_authentication: : A LightDMGreeter

Checks if the greeter is in the process of authenticating.

Return value: #TRUE if the greeter is authenticating a user.

Definition at line 887 of file greeter.c.

{
    g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
    return GET_PRIVATE (greeter)->in_authentication;
}

Here is the caller graph for this function:

lightdm_greeter_get_is_authenticated: : A LightDMGreeter

Checks if the greeter has successfully authenticated.

Return value: #TRUE if the greeter is authenticated for login.

Definition at line 902 of file greeter.c.

{
    g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
    return GET_PRIVATE (greeter)->is_authenticated;
}

Here is the caller graph for this function:

lightdm_greeter_get_lock_hint: : A LightDMGreeter

Check if the greeter is acting as a lock screen.

Return value: #TRUE if the greeter was triggered by locking the seat.

Definition at line 615 of file greeter.c.

{
    const gchar *value;

    g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
    value = lightdm_greeter_get_hint (greeter, "lock-screen");

    return g_strcmp0 (value, "true") == 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

lightdm_greeter_get_select_guest_hint: : A LightDMGreeter

Check if the guest account should be selected by default.

Return value: #TRUE if the guest account should be selected by default.

Definition at line 668 of file greeter.c.

{
    const gchar *value;

    g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
    value = lightdm_greeter_get_hint (greeter, "select-guest");
  
    return g_strcmp0 (value, "true") == 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

lightdm_greeter_get_select_user_hint: : A LightDMGreeter

Get the user to select by default.

Return value: A username

Definition at line 653 of file greeter.c.

{
    g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), NULL);
    return lightdm_greeter_get_hint (greeter, "select-user");
}

Here is the call graph for this function:

Here is the caller graph for this function:

lightdm_greeter_get_show_manual_login_hint: : A LightDMGreeter

Check if a manual login option should be shown. If set the GUI should provide a way for a username to be entered manually. Without this hint a greeter which is showing a user list can limit logins to only those users.

Return value: #TRUE if a manual login option should be shown.

Definition at line 596 of file greeter.c.

{
    const gchar *value;

    g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);
    value = lightdm_greeter_get_hint (greeter, "show-manual-login");

    return g_strcmp0 (value, "true") == 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

GType lightdm_greeter_get_type ( void  )

lightdm_greeter_new:

Create a new greeter.

Return value: the new LightDMGreeter

Definition at line 100 of file greeter.c.

{
    return g_object_new (LIGHTDM_TYPE_GREETER, NULL);
}

Here is the caller graph for this function:

void lightdm_greeter_respond ( LightDMGreeter greeter,
const gchar *  response 
)

lightdm_greeter_respond: : A LightDMGreeter : Response to a prompt

Provide response to a prompt.

Definition at line 833 of file greeter.c.

{
    LightDMGreeterPrivate *priv;
    guint8 message[MAX_MESSAGE_LENGTH];
    gsize offset = 0;

    g_return_if_fail (LIGHTDM_IS_GREETER (greeter));
    g_return_if_fail (response != NULL);

    priv = GET_PRIVATE (greeter);

    g_return_if_fail (priv->connected);

    g_debug ("Providing response to display manager");
    write_header (message, MAX_MESSAGE_LENGTH, GREETER_MESSAGE_CONTINUE_AUTHENTICATION, int_length () + string_length (response), &offset);
    // FIXME: Could be multiple responses required
    write_int (message, MAX_MESSAGE_LENGTH, 1, &offset);
    write_string (message, MAX_MESSAGE_LENGTH, response, &offset);
    write_message (greeter, message, offset);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void lightdm_greeter_set_language ( LightDMGreeter greeter,
const gchar *  language 
)

lightdm_greeter_set_language: : A LightDMGreeter : The language to use for this user.

Set the language for the currently authenticated user.

Definition at line 931 of file greeter.c.

{
    LightDMGreeterPrivate *priv;
    guint8 message[MAX_MESSAGE_LENGTH];
    gsize offset = 0;

    g_return_if_fail (LIGHTDM_IS_GREETER (greeter));

    priv = GET_PRIVATE (greeter);

    g_return_if_fail (priv->connected);

    write_header (message, MAX_MESSAGE_LENGTH, GREETER_MESSAGE_SET_LANGUAGE, string_length (language), &offset);
    write_string (message, MAX_MESSAGE_LENGTH, language, &offset);
    write_message (greeter, message, offset);
}

Here is the call graph for this function:

gboolean lightdm_greeter_start_session_sync ( LightDMGreeter greeter,
const gchar *  session,
GError **  error 
)

lightdm_greeter_start_session_sync: : A LightDMGreeter : (allow-none): The session to log into or #NULL to use the default.

: return location for a #GError, or NULL

Start a session for the authenticated user.

Return value: TRUE if the session was started.

Definition at line 959 of file greeter.c.

{
    LightDMGreeterPrivate *priv;
    guint8 message[MAX_MESSAGE_LENGTH];
    guint8 *response;
    gsize response_length, offset = 0;
    guint32 id, return_code = 1;

    g_return_val_if_fail (LIGHTDM_IS_GREETER (greeter), FALSE);

    priv = GET_PRIVATE (greeter);

    g_return_val_if_fail (priv->connected, FALSE);
    g_return_val_if_fail (priv->is_authenticated, FALSE);

    if (session)
        g_debug ("Starting session %s", session);
    else
        g_debug ("Starting default session");

    write_header (message, MAX_MESSAGE_LENGTH, GREETER_MESSAGE_START_SESSION, string_length (session), &offset);
    write_string (message, MAX_MESSAGE_LENGTH, session, &offset);
    write_message (greeter, message, offset);

    response = read_message (greeter, &response_length, TRUE);
    if (!response)
        return FALSE;

    offset = 0;
    id = read_int (response, response_length, &offset);
    read_int (response, response_length, &offset);
    if (id == SERVER_MESSAGE_SESSION_RESULT)
        return_code = read_int (response, response_length, &offset);
    else
        g_warning ("Expected SESSION_RESULT message, got %d", id);

    g_free (response);

    return return_code == 0;
}

Here is the call graph for this function:

Here is the caller graph for this function: