summaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorBrian Cameron <brian.cameron@sun.com>2005-05-17 16:55:39 +0000
committerBrian Cameron <bcameron@src.gnome.org>2005-05-17 16:55:39 +0000
commitc45dc52b4d3d8c67db2fe4e6679a8f09642d398f (patch)
treeab096c4bb3bd50067bf9c515cc7c55d1a1c44e5f /daemon
parent5e1fdcf69919cba60e76541ec6116aded537b031 (diff)
downloadgdm-c45dc52b4d3d8c67db2fe4e6679a8f09642d398f.tar.gz
Added support for dynamic Xservers. Fixes enhancement request #168219.
2005-05-17 Brian Cameron <brian.cameron@sun.com> * daemon/gdm.[ch], daemon/misc.c, daemon/verify-pam.c, docs/C/gdm.xml, gui/Makefile.am, gui/gdmdynamic.c: Added support for dynamic Xservers. Fixes enhancement request #168219. Patch provided by Bob Terek <Robert.Terek@sun.com>
Diffstat (limited to 'daemon')
-rw-r--r--daemon/gdm.c276
-rw-r--r--daemon/gdm.h65
-rw-r--r--daemon/misc.c6
-rw-r--r--daemon/verify-pam.c4
4 files changed, 299 insertions, 52 deletions
diff --git a/daemon/gdm.c b/daemon/gdm.c
index c07b4187..7924e535 100644
--- a/daemon/gdm.c
+++ b/daemon/gdm.c
@@ -60,6 +60,10 @@
#include "cookie.h"
#include "filecheck.h"
+#define DYNAMIC_ADD 0
+#define DYNAMIC_RELEASE 1
+#define DYNAMIC_REMOVE 2
+
#ifdef HAVE_LOGINDEVPERM
#include <libdevinfo.h>
#endif /* HAVE_LOGINDEVPERM */
@@ -209,6 +213,7 @@ gboolean GdmTimedLoginEnable = FALSE;
gint GdmTimedLoginDelay = 0;
gchar *GdmStandardXServer = NULL;
gint GdmFlexibleXServers = 5;
+gboolean GdmDynamicXServers = FALSE;
gchar *GdmXnest = NULL;
int GdmFirstVT = 7;
gboolean GdmVTAllocation = TRUE;
@@ -220,7 +225,7 @@ gchar *GdmSoundOnLoginSuccessFile = NULL;
gboolean GdmSoundOnLoginFailure = FALSE;
gchar *GdmSoundOnLoginFailureFile = NULL;
gchar *GdmConsoleCannotHandle = NULL;
-
+gboolean GdmConsoleNotify = TRUE;
/* set in the main function */
char **stored_argv = NULL;
@@ -234,6 +239,28 @@ static GMainLoop *main_loop = NULL;
static gboolean monte_carlo_sqrt2 = FALSE;
+
+/*
+ * lookup display number if the display number is
+ * exists then clear the remove flag and return TRUE
+ * otherwise return FALSE
+ */
+static gboolean
+mark_display_exists (int num)
+{
+ GSList *li;
+
+ for (li = displays; li != NULL; li = li->next) {
+ GdmDisplay *disp = li->data;
+ if (disp->dispnum == num) {
+ disp->removeconf = FALSE;
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+
static gboolean
display_exists (int num)
{
@@ -275,7 +302,7 @@ check_servauthdir (struct stat *statbuf)
"correct gdm configuration %s and "
"restart gdm.")), GdmServAuthDir,
GDM_CONFIG_FILE);
- if ( ! no_console)
+ if (GdmConsoleNotify)
gdm_text_message_dialog (s);
GdmPidFile = NULL;
gdm_fail (_("%s: Authdir %s does not exist. Aborting."), "gdm_config_parse", GdmServAuthDir);
@@ -289,7 +316,7 @@ check_servauthdir (struct stat *statbuf)
"correct gdm configuration %s and "
"restart gdm.")), GdmServAuthDir,
GDM_CONFIG_FILE);
- if ( ! no_console)
+ if (GdmConsoleNotify)
gdm_text_message_dialog (s);
GdmPidFile = NULL;
gdm_fail (_("%s: Authdir %s is not a directory. Aborting."), "gdm_config_parse", GdmServAuthDir);
@@ -398,6 +425,7 @@ gdm_config_parse (void)
GdmNeverPlaceCookiesOnNFS = ve_config_get_bool (cfg, GDM_KEY_NEVERPLACECOOKIESONNFS);
GdmUserAuthFile = ve_config_get_string (cfg, GDM_KEY_UAUTHFILE);
GdmUserAuthFB = ve_config_get_string (cfg, GDM_KEY_UAUTHFB);
+ GdmConsoleNotify = ve_config_get_bool (cfg, GDM_KEY_CONSOLE_NOTIFY);
GdmGtkRC = ve_config_get_string (cfg, GDM_KEY_GTKRC);
GdmGtkTheme = ve_config_get_string (cfg, GDM_KEY_GTK_THEME);
@@ -451,6 +479,7 @@ gdm_config_parse (void)
}
}
g_free (bin);
+ GdmDynamicXServers = ve_config_get_bool (cfg, GDM_KEY_DYNAMIC_XSERVERS);
GdmFlexibleXServers = ve_config_get_int (cfg, GDM_KEY_FLEXIBLE_XSERVERS);
GdmXnest = ve_config_get_string (cfg, GDM_KEY_XNEST);
if (ve_string_empty (GdmXnest))
@@ -619,7 +648,8 @@ gdm_config_parse (void)
}
ve_config_free_list_of_strings (list);
- if G_UNLIKELY (displays == NULL && ! GdmXdmcp) {
+ if G_UNLIKELY ((displays == NULL) && (! GdmXdmcp) &&
+ (!GdmDynamicXServers)) {
char *server = NULL;
/* if we requested no static servers (there is no console),
@@ -675,6 +705,9 @@ gdm_config_parse (void)
if (displays == NULL)
no_console = TRUE;
+ if (no_console)
+ GdmConsoleNotify = FALSE;
+
/* Lookup user and groupid for the gdm user */
pwent = getpwnam (GdmUser);
@@ -684,7 +717,7 @@ gdm_config_parse (void)
"Please correct gdm configuration %s "
"and restart gdm.")),
GDM_CONFIG_FILE);
- if ( ! no_console)
+ if (GdmConsoleNotify)
gdm_text_message_dialog (s);
GdmPidFile = NULL;
gdm_fail (_("%s: Can't find the gdm user (%s). Aborting!"), "gdm_config_parse", GdmUser);
@@ -699,7 +732,7 @@ gdm_config_parse (void)
"pose a security risk. Please "
"correct gdm configuration %s and "
"restart gdm.")), GDM_CONFIG_FILE);
- if ( ! no_console)
+ if (GdmConsoleNotify)
gdm_text_message_dialog (s);
GdmPidFile = NULL;
gdm_fail (_("%s: The gdm user should not be root. Aborting!"), "gdm_config_parse");
@@ -713,7 +746,7 @@ gdm_config_parse (void)
"Please correct gdm configuration %s "
"and restart gdm.")),
GDM_CONFIG_FILE);
- if ( ! no_console)
+ if (GdmConsoleNotify)
gdm_text_message_dialog (s);
GdmPidFile = NULL;
gdm_fail (_("%s: Can't find the gdm group (%s). Aborting!"), "gdm_config_parse", GdmGroup);
@@ -728,7 +761,7 @@ gdm_config_parse (void)
"pose a security risk. Please "
"correct gdm configuration %s and "
"restart gdm.")), GDM_CONFIG_FILE);
- if ( ! no_console)
+ if (GdmConsoleNotify)
gdm_text_message_dialog (s);
GdmPidFile = NULL;
gdm_fail (_("%s: The gdm group should not be root. Aborting!"), "gdm_config_parse");
@@ -771,7 +804,7 @@ gdm_config_parse (void)
/* Check the serv auth and log dirs */
if G_UNLIKELY (ve_string_empty (GdmServAuthDir)) {
- if ( ! no_console)
+ if (GdmConsoleNotify)
gdm_text_message_dialog
(C_(N_("No daemon/ServAuthDir specified in the configuration file")));
GdmPidFile = NULL;
@@ -807,7 +840,7 @@ gdm_config_parse (void)
"gdm.")),
GdmServAuthDir, GdmUser, GdmGroup,
GDM_CONFIG_FILE);
- if ( ! no_console)
+ if (GdmConsoleNotify)
gdm_text_message_dialog (s);
GdmPidFile = NULL;
gdm_fail (_("%s: Authdir %s is not owned by user %s, group %s. Aborting."), "gdm_config_parse",
@@ -824,7 +857,7 @@ gdm_config_parse (void)
"the gdm configuration %s and "
"restart gdm.")),
GdmServAuthDir, (S_IRWXU|S_IRWXG|S_ISVTX), GDM_CONFIG_FILE);
- if ( ! no_console)
+ if (GdmConsoleNotify)
gdm_text_message_dialog (s);
GdmPidFile = NULL;
gdm_fail (_("%s: Authdir %s has wrong permissions %o. Should be %o. Aborting."), "gdm_config_parse",
@@ -1427,6 +1460,8 @@ gdm_cleanup_children (void)
if (d->servpid > 1)
kill (d->servpid, SIGTERM);
d->servpid = 0;
+ if (GdmDynamicXServers) /* XXX - This needs to be handled better */
+ gdm_server_whack_lockfile (d);
/* race avoider */
gdm_sleep_no_signal (1);
@@ -1448,7 +1483,8 @@ gdm_cleanup_children (void)
d->dispstat = DISPLAY_DEAD;
if ( ! GdmSystemMenu &&
- (status == DISPLAY_REBOOT ||
+ (status == DISPLAY_RESTARTGDM ||
+ status == DISPLAY_REBOOT ||
status == DISPLAY_SUSPEND ||
status == DISPLAY_HALT)) {
gdm_info (_("Reboot or Halt request when there is no system menu from display %s"), d->name);
@@ -3365,6 +3401,111 @@ handle_flexi_server (GdmConnection *conn, int type, const char *server,
/* Now we wait for the server to start up (or not) */
}
+static void
+handle_dynamic_server (GdmConnection *conn, int type, char *key)
+{
+ GdmDisplay *disp;
+ int disp_num;
+ char *full;
+ char *val;
+
+ if (!(GdmDynamicXServers)) {
+ gdm_connection_write (conn, "ERROR 200 Dynamic Displays not allowed\n");
+ return;
+ }
+
+ if ( ! GDM_CONN_AUTH_GLOBAL(conn)) {
+ gdm_info (_("DYNAMIC request denied: " "Not authenticated"));
+ gdm_connection_write (conn, "ERROR 100 Not authenticated\n");
+ return;
+ }
+
+ if ((key == NULL) || (!(isdigit (*key)))) {
+ gdm_connection_write (conn, "ERROR 1 Bad display number\n");
+ return;
+ }
+ disp_num = atoi (key);
+
+ if (type == DYNAMIC_ADD) {
+ /* prime an X server for launching */
+
+ if (mark_display_exists (disp_num)) {
+ /* need to skip starting this one again */
+ gdm_connection_write (conn, "ERROR 2 Existing display\n");
+ return;
+ }
+
+ full = strchr(key, '=');
+ if (full == NULL || *(full+1) == 0) {
+ gdm_connection_write (conn, "ERROR 3 No server string\n");
+ return;
+ }
+
+ val = full+1;
+ disp = gdm_server_alloc (disp_num, val);
+
+ if (disp == NULL) {
+ gdm_connection_write (conn, "ERROR 4 Display startup failure\n");
+ return;
+ }
+ displays = g_slist_insert_sorted (displays,
+ disp,
+ compare_displays);
+
+ disp->dispstat = DISPLAY_CONFIG;
+ disp->removeconf = FALSE;
+
+ if (disp_num > high_display_num)
+ high_display_num = disp_num;
+
+ gdm_connection_write (conn, "OK\n");
+ return;
+ }
+
+ if (type == DYNAMIC_REMOVE) {
+ GSList *li;
+ GSList *nli;
+ /* shutdown a dynamic X server */
+
+ for (li = displays; li != NULL; li = nli) {
+ disp = li->data;
+ nli = li->next;
+ if (disp->dispnum == disp_num) {
+ disp->removeconf = TRUE;
+ gdm_display_unmanage (disp);
+ gdm_connection_write (conn, "OK\n");
+ return;
+ }
+ }
+
+ gdm_connection_write (conn, "ERROR 1 Bad display number\n");
+ return;
+ }
+
+ if (type == DYNAMIC_RELEASE) {
+ /* cause the newly configured X servers to actually run */
+ GSList *li;
+ GSList *nli;
+
+ for (li = displays; li != NULL; li = nli) {
+ GdmDisplay *disp = li->data;
+ nli = li->next;
+ if ((disp->dispnum == disp_num) &&
+ (disp->dispstat == DISPLAY_CONFIG)) {
+ disp->dispstat = DISPLAY_UNBORN;
+
+ if ( ! gdm_display_manage (disp)) {
+ gdm_display_unmanage(disp);
+ }
+ }
+ }
+
+ gdm_connection_write (conn, "OK\n");
+ /* Now we wait for the server to start up (or not) */
+ return;
+ }
+}
+
static gboolean
is_key (const char *key1, const char *key2)
{
@@ -3732,7 +3873,7 @@ gdm_handle_user_message (GdmConnection *conn, const char *msg, gpointer data)
g_ascii_strcasecmp (gdm_global_cookie, cookie) == 0) {
g_free (cookie);
GDM_CONNECTION_SET_USER_FLAG
- (conn, GDM_SUP_FLAG_AUTHENTICATED);
+ (conn, GDM_SUP_FLAG_AUTH_GLOBAL);
gdm_connection_write (conn, "OK\n");
return;
}
@@ -3740,13 +3881,14 @@ gdm_handle_user_message (GdmConnection *conn, const char *msg, gpointer data)
/* Hmmm, perhaps this is better defined behaviour */
GDM_CONNECTION_UNSET_USER_FLAG
(conn, GDM_SUP_FLAG_AUTHENTICATED);
+ GDM_CONNECTION_UNSET_USER_FLAG
+ (conn, GDM_SUP_FLAG_AUTH_GLOBAL);
gdm_connection_set_display (conn, NULL);
gdm_connection_write (conn, "ERROR 100 Not authenticated\n");
g_free (cookie);
} else if (strcmp (msg, GDM_SUP_FLEXI_XSERVER) == 0) {
/* Only allow locally authenticated connections */
- if ( ! (gdm_connection_get_user_flags (conn) &
- GDM_SUP_FLAG_AUTHENTICATED)) {
+ if ( ! GDM_CONN_AUTHENTICATED(conn)) {
gdm_info (_("%s request denied: "
"Not authenticated"), "FLEXI_XSERVER");
gdm_connection_write (conn,
@@ -3764,8 +3906,7 @@ gdm_handle_user_message (GdmConnection *conn, const char *msg, gpointer data)
GdmXServer *svr;
/* Only allow locally authenticated connections */
- if ( ! (gdm_connection_get_user_flags (conn) &
- GDM_SUP_FLAG_AUTHENTICATED)) {
+ if ( ! GDM_CONN_AUTHENTICATED(conn)) {
gdm_info (_("%s request denied: "
"Not authenticated"), "FLEXI_XSERVER");
gdm_connection_write (conn,
@@ -3837,31 +3978,49 @@ gdm_handle_user_message (GdmConnection *conn, const char *msg, gpointer data)
g_free (dispname);
g_free (xauthfile);
- } else if ((strcmp (msg, GDM_SUP_ATTACHED_SERVERS) == 0) ||
- (strcmp (msg, GDM_SUP_CONSOLE_SERVERS) == 0)) {
- GString *msg;
- GSList *li;
+ } else if ((strncmp (msg, GDM_SUP_ATTACHED_SERVERS,
+ strlen(GDM_SUP_ATTACHED_SERVERS)) == 0) ||
+ (strncmp (msg, GDM_SUP_CONSOLE_SERVERS,
+ strlen(GDM_SUP_CONSOLE_SERVERS)) == 0)) {
+ GString *retMsg;
+ GSList *li;
const char *sep = " ";
+ char *key;
+ int msgLen=0;
- msg = g_string_new ("OK");
+ if (strncmp (msg, GDM_SUP_ATTACHED_SERVERS,
+ strlen(GDM_SUP_ATTACHED_SERVERS)) == 0)
+ msgLen = strlen (GDM_SUP_ATTACHED_SERVERS);
+ else if (strncmp (msg, GDM_SUP_CONSOLE_SERVERS,
+ strlen(GDM_SUP_CONSOLE_SERVERS)) == 0)
+ msgLen = strlen (GDM_SUP_CONSOLE_SERVERS);
+
+ key = g_strdup (&msg[msgLen]);
+ g_strstrip (key);
+
+ retMsg = g_string_new ("OK");
for (li = displays; li != NULL; li = li->next) {
GdmDisplay *disp = li->data;
+
if ( ! disp->attached)
continue;
- g_string_append_printf (msg, "%s%s,%s,", sep,
- ve_sure_string (disp->name),
- ve_sure_string (disp->login));
- sep = ";";
- if (disp->type == TYPE_FLEXI_XNEST) {
- g_string_append (msg,
- ve_sure_string (disp->parent_disp));
- } else {
- g_string_append_printf (msg, "%d", disp->vt);
+ if (!(strlen(key)) || (g_pattern_match_simple(key, disp->command))) {
+ g_string_append_printf (retMsg, "%s%s,%s,", sep,
+ ve_sure_string (disp->name),
+ ve_sure_string (disp->login));
+ sep = ";";
+ if (disp->type == TYPE_FLEXI_XNEST) {
+ g_string_append (retMsg, ve_sure_string (disp->parent_disp));
+ } else {
+ g_string_append_printf (retMsg, "%d", disp->vt);
+ }
}
}
- g_string_append (msg, "\n");
- gdm_connection_write (conn, msg->str);
- g_string_free (msg, TRUE);
+
+ g_string_append (retMsg, "\n");
+ gdm_connection_write (conn, retMsg->str);
+ g_free(key);
+ g_string_free (retMsg, TRUE);
} else if (strcmp (msg, GDM_SUP_ALL_SERVERS) == 0) {
GString *msg;
GSList *li;
@@ -3930,8 +4089,7 @@ gdm_handle_user_message (GdmConnection *conn, const char *msg, gpointer data)
disp = gdm_connection_get_display (conn);
/* Only allow locally authenticated connections */
- if ( ! (gdm_connection_get_user_flags (conn) &
- GDM_SUP_FLAG_AUTHENTICATED) ||
+ if ( ! GDM_CONN_AUTHENTICATED(conn) ||
disp == NULL) {
gdm_info (_("%s request denied: "
"Not authenticated"), "QUERY_LOGOUT_ACTION");
@@ -3983,8 +4141,7 @@ gdm_handle_user_message (GdmConnection *conn, const char *msg, gpointer data)
disp = gdm_connection_get_display (conn);
/* Only allow locally authenticated connections */
- if ( ! (gdm_connection_get_user_flags (conn) &
- GDM_SUP_FLAG_AUTHENTICATED) ||
+ if ( ! GDM_CONN_AUTHENTICATED(conn) ||
disp == NULL ||
! disp->logged_in) {
gdm_info (_("%s request denied: "
@@ -4038,8 +4195,7 @@ gdm_handle_user_message (GdmConnection *conn, const char *msg, gpointer data)
disp = gdm_connection_get_display (conn);
/* Only allow locally authenticated connections */
- if ( ! (gdm_connection_get_user_flags (conn) &
- GDM_SUP_FLAG_AUTHENTICATED) ||
+ if ( ! GDM_CONN_AUTHENTICATED(conn) ||
disp == NULL ||
! disp->logged_in) {
gdm_info (_("%s request denied: "
@@ -4085,8 +4241,7 @@ gdm_handle_user_message (GdmConnection *conn, const char *msg, gpointer data)
}
} else if (strcmp (msg, GDM_SUP_QUERY_VT) == 0) {
/* Only allow locally authenticated connections */
- if ( ! (gdm_connection_get_user_flags (conn) &
- GDM_SUP_FLAG_AUTHENTICATED)) {
+ if ( ! GDM_CONN_AUTHENTICATED(conn)) {
gdm_info (_("%s request denied: "
"Not authenticated"), "QUERY_VT");
gdm_connection_write (conn,
@@ -4112,8 +4267,7 @@ gdm_handle_user_message (GdmConnection *conn, const char *msg, gpointer data)
}
/* Only allow locally authenticated connections */
- if ( ! (gdm_connection_get_user_flags (conn) &
- GDM_SUP_FLAG_AUTHENTICATED)) {
+ if ( ! GDM_CONN_AUTHENTICATED(conn)) {
gdm_info (_("%s request denied: "
"Not authenticated"), "QUERY_VT");
gdm_connection_write (conn,
@@ -4134,6 +4288,40 @@ gdm_handle_user_message (GdmConnection *conn, const char *msg, gpointer data)
#else
gdm_connection_write (conn, "ERROR 8 Virtual terminals not supported\n");
#endif
+ } else if (strncmp (msg, GDM_SUP_ADD_DYNAMIC_DISPLAY " ",
+ strlen (GDM_SUP_ADD_DYNAMIC_DISPLAY " ")) == 0) {
+ char *key;
+
+ key = g_strdup (&msg[strlen (GDM_SUP_ADD_DYNAMIC_DISPLAY " ")]);
+ g_strstrip (key);
+
+ handle_dynamic_server(conn, DYNAMIC_ADD, key);
+
+ g_free(key);
+
+ } else if (strncmp (msg, GDM_SUP_REMOVE_DYNAMIC_DISPLAY " ",
+ strlen (GDM_SUP_REMOVE_DYNAMIC_DISPLAY " ")) == 0) {
+ char *key;
+
+ key = g_strdup (&msg[strlen (GDM_SUP_REMOVE_DYNAMIC_DISPLAY " ")]);
+ g_strstrip (key);
+
+ handle_dynamic_server(conn, DYNAMIC_REMOVE, key);
+
+ g_free(key);
+
+ } else if (strncmp (msg, GDM_SUP_RELEASE_DYNAMIC_DISPLAYS " ",
+ strlen(GDM_SUP_RELEASE_DYNAMIC_DISPLAYS " ")) == 0) {
+
+ char *key;
+
+ key = g_strdup (&msg[strlen (GDM_SUP_RELEASE_DYNAMIC_DISPLAYS " ")]);
+ g_strstrip (key);
+
+ handle_dynamic_server(conn, DYNAMIC_RELEASE, key);
+
+ g_free(key);
+
} else if (strcmp (msg, GDM_SUP_VERSION) == 0) {
gdm_connection_write (conn, "GDM " VERSION "\n");
} else if (strcmp (msg, GDM_SUP_CLOSE) == 0) {
diff --git a/daemon/gdm.h b/daemon/gdm.h
index 8fe6cdf8..4677af6d 100644
--- a/daemon/gdm.h
+++ b/daemon/gdm.h
@@ -81,7 +81,8 @@ enum {
DISPLAY_ALIVE /* Yay! we're alive (non-xdmcp) */,
XDMCP_PENDING /* Pending XDMCP display */,
XDMCP_MANAGED /* Managed XDMCP display */,
- DISPLAY_DEAD /* Left for dead */
+ DISPLAY_DEAD /* Left for dead */,
+ DISPLAY_CONFIG /* in process of being configured */
};
/* Opcodes for the highly sophisticated protocol used for
@@ -171,6 +172,7 @@ enum {
#define GDM_KEY_UAUTHFB "daemon/UserAuthFBDir=/tmp"
#define GDM_KEY_UAUTHFILE "daemon/UserAuthFile=.Xauthority"
#define GDM_KEY_USER "daemon/User=gdm"
+#define GDM_KEY_CONSOLE_NOTIFY "daemon/ConsoleNotify=true"
#define GDM_KEY_DOUBLELOGINWARNING "daemon/DoubleLoginWarning=true"
@@ -187,6 +189,7 @@ enum {
#define GDM_KEY_STANDARD_XSERVER "daemon/StandardXServer=" X_SERVER
#define GDM_KEY_FLEXIBLE_XSERVERS "daemon/FlexibleXServers=5"
+#define GDM_KEY_DYNAMIC_XSERVERS "daemon/DynamicXServers=false"
#define GDM_KEY_XNEST "daemon/Xnest=" X_SERVER_PATH "/Xnest -name Xnest"
/* Keys for automatic VT allocation rather then letting it up to the
* X server */
@@ -387,6 +390,7 @@ struct _GdmDisplay {
guint8 dispstat;
guint16 dispnum;
+ gboolean removeconf;
guint8 servstat;
time_t starttime;
time_t managetime;
@@ -742,7 +746,13 @@ void gdm_final_cleanup (void);
* Doesn't list xdmcp and xnest non-attached servers
* CONSOLE_SERVERS supported, but deprecated due to terminology
* Supported since: 2.2.4.0
- * Arguments: None
+ * Note: This command used to be named CONSOLE_SERVERS, which is still recognized
+ * for backwards compatibility. The optional pattern argument is supported
+ * as of version 2.8.0.0.
+ * Arguments: <pattern> (optional)
+ * With no argument, all dynamic displays are returned. The optional
+ * <pattern> is a string that may contain glob characters '*', '?', and
+ * '[]'. Only displays that match the pattern will be returned.
* Answers:
* OK <server>;<server>;...
*
@@ -957,12 +967,61 @@ void gdm_final_cleanup (void);
* Supported since: 2.2.4.0
*/
+#define GDM_SUP_ADD_DYNAMIC_DISPLAY "ADD_DYNAMIC_DISPLAY"
+/*
+ * ADD_X_SERVER: Add a dynamic display configuration.
+ * Configures a dynamic X server to run on the specified display
+ * leaving it in DISPLAY_CONFIG state.
+ * Supported since: 2.8.0.0
+ * Arguments: <display to run on>=<server>
+ * Where <server> is either a configuration named in gdm.conf or
+ * a literal command name.
+ * Answers:
+ * OK
+ * ERROR
+ * 0 = Not implemented
+ * 999 = Unknown error
+ */
+#define GDM_SUP_REMOVE_DYNAMIC_DISPLAY "REMOVE_DYNAMIC_DISPLAY"
+/*
+ * REMOVE_X_SERVER: Remove a dynamic display
+ * Removes a dynamic display, killing the server and purging
+ * the display configuration
+ * Supported since: 2.8.0.0
+ * Arguments: <display to remove>
+ * Answers:
+ * OK
+ * ERROR
+ * 0 = Not implemented
+ * 999 = Unknown error
+ */
+#define GDM_SUP_RELEASE_DYNAMIC_DISPLAYS "RELEASE_DYNAMIC_DISPLAYS"
+/*
+ * RELEASE_SERVERS: Release dynamic displays currently in PAUSED state
+ * Supported since: 2.8.0.0
+ * Arguments: None
+ * Answers:
+ * OK
+ * ERROR
+ * 0 = Not implemented
+ * 999 = Unknown error
+ */
+
/* User flags for the SUP protocol */
enum {
- GDM_SUP_FLAG_AUTHENTICATED = 0x1 /* authenticated as a local user,
+ GDM_SUP_FLAG_AUTHENTICATED = 0x1, /* authenticated as a local user,
* from a local display we started */
+ GDM_SUP_FLAG_AUTH_GLOBAL = 0x2 /* authenticated with global cookie */
};
+/* Macros to check authentication level */
+#define GDM_CONN_AUTHENTICATED(conn) \
+ ((gdm_connection_get_user_flags (conn) & GDM_SUP_FLAG_AUTHENTICATED) || \
+ (gdm_connection_get_user_flags (conn) & GDM_SUP_FLAG_AUTH_GLOBAL))
+
+#define GDM_CONN_AUTH_GLOBAL(conn) \
+ (gdm_connection_get_user_flags (conn) & GDM_SUP_FLAG_AUTH_GLOBAL)
+
#define NEVER_FAILS_seteuid(uid) \
{ int r = 0; \
diff --git a/daemon/misc.c b/daemon/misc.c
index 4e7eb15f..779961b3 100644
--- a/daemon/misc.c
+++ b/daemon/misc.c
@@ -67,7 +67,7 @@ extern pid_t gdm_main_pid;
extern gboolean preserve_ld_vars;
extern int gdm_in_signal;
-extern gboolean no_console;
+extern gboolean GdmConsoleNotify;
extern char *gdm_charset;
@@ -585,7 +585,7 @@ gdm_text_message_dialog (const char *msg)
char *dialog; /* do we have dialog?*/
char *msg_quoted;
- if (no_console)
+ if ( ! GdmConsoleNotify)
return FALSE;
if (access (EXPANDED_LIBEXECDIR "/gdmopen", X_OK) != 0)
@@ -663,7 +663,7 @@ gdm_text_yesno_dialog (const char *msg, gboolean *ret)
char *dialog; /* do we have dialog?*/
char *msg_quoted;
- if (no_console)
+ if ( ! GdmConsoleNotify)
return FALSE;
if (access (EXPANDED_LIBEXECDIR "/gdmopen", X_OK) != 0)
diff --git a/daemon/verify-pam.c b/daemon/verify-pam.c
index d23d76b1..566214e3 100644
--- a/daemon/verify-pam.c
+++ b/daemon/verify-pam.c
@@ -58,7 +58,7 @@ extern gboolean GdmDisplayLastLogin;
extern uid_t GdmUserId;
extern gid_t GdmGroupId;
-extern gboolean no_console;
+extern gboolean GdmConsoleNotify;
/* Evil, but this way these things are passed to the child session */
static pam_handle_t *pamh = NULL;
@@ -1428,7 +1428,7 @@ gdm_verify_check (void)
closelog ();
openlog ("gdm", LOG_PID, LOG_DAEMON);
- if ( ! no_console)
+ if (GdmConsoleNotify)
gdm_text_message_dialog
(C_(N_("Can't find PAM configuration for gdm.")));
gdm_fail ("gdm_verify_check: %s",