summaryrefslogtreecommitdiff
path: root/gui/gdmcomm.c
diff options
context:
space:
mode:
authorGeorge Lebl <jirka@5z.com>2002-07-21 19:45:40 +0000
committerGeorge Lebl <jirka@src.gnome.org>2002-07-21 19:45:40 +0000
commit1a4f884fd5138973033d627b92978bd43f15ae75 (patch)
tree5068bbcb5f2d7c4477e9b9fa96f9dbc63139ca6e /gui/gdmcomm.c
parent65e9ac1315e6e1d1a197402609cd3547f1a4fa71 (diff)
downloadgdm-1a4f884fd5138973033d627b92978bd43f15ae75.tar.gz
note that gethostname doesn't neccessairly nul terminate string
Sun Jul 21 12:57:57 2002 George Lebl <jirka@5z.com> * daemon/xdmcp.c, daemon/server.c, daemon/auth.c, daemon/misc.c, gui/gdmXnestchooser.c, gui/gdmchooser.c, gui/gdmlogin.c, gui/greeter/greeter_item.c: note that gethostname doesn't neccessairly nul terminate string * gui/Makefile.am, gui/gdmXnestchooser.c: fix background xnest mode, add plain X nest mode by just running gdmXnest. Use gtk dialogs instead of gnomes. Setup a cookie in plain x nest mode. * daemon/slave.c, daemon/server.c, daemon/display.c, gui/gdmlogin.c: use the waitpid version from ve that doesn't break on signals this could fix some possible session being killed bugs unintentionally
Diffstat (limited to 'gui/gdmcomm.c')
-rw-r--r--gui/gdmcomm.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/gui/gdmcomm.c b/gui/gdmcomm.c
index 7feb4eef..c3b402ca 100644
--- a/gui/gdmcomm.c
+++ b/gui/gdmcomm.c
@@ -183,7 +183,7 @@ gdmcomm_call_gdm (const char *command, const char * auth_cookie, const char *min
return ret;
}
-char *
+const char *
gdmcomm_get_display (void)
{
static char *display = NULL;
@@ -229,7 +229,7 @@ get_dispnum (void)
/* This just gets a cookie of MIT-MAGIC-COOKIE-1 type */
char *
-gdmcomm_get_a_cookie (void)
+gdmcomm_get_a_cookie (gboolean binary)
{
FILE *fp;
char *number;
@@ -246,14 +246,12 @@ gdmcomm_get_a_cookie (void)
cookie = NULL;
while ((xau = XauReadAuth (fp)) != NULL) {
- int i;
- GString *str;
-
/* Just find the FIRST magic cookie, that's what gdm uses */
if (xau->number_length != strlen (number) ||
strncmp (xau->number, number, xau->number_length) != 0 ||
/* gdm sends MIT-MAGIC-COOKIE-1 cookies of length 16,
* so just do those */
+ xau->data_length != 16 ||
xau->name_length != strlen ("MIT-MAGIC-COOKIE-1") ||
strncmp (xau->name, "MIT-MAGIC-COOKIE-1",
xau->name_length) != 0) {
@@ -261,17 +259,24 @@ gdmcomm_get_a_cookie (void)
continue;
}
- str = g_string_new (NULL);
+ if (binary) {
+ cookie = g_new0 (char, 16);
+ memcpy (cookie, xau->data, 16);
+ } else {
+ int i;
+ GString *str;
+
+ str = g_string_new (NULL);
- for (i = 0; i < xau->data_length; i++) {
- g_string_sprintfa (str, "%02x",
- (guint)(guchar)xau->data[i]);
+ for (i = 0; i < xau->data_length; i++) {
+ g_string_sprintfa (str, "%02x",
+ (guint)(guchar)xau->data[i]);
+ }
+ cookie = g_string_free (str, FALSE);
}
XauDisposeAuth (xau);
- cookie = str->str;
- g_string_free (str, FALSE);
break;
}
fclose (fp);
@@ -317,6 +322,7 @@ gdmcomm_get_auth_cookie (void)
strncmp (xau->number, number, xau->number_length) != 0 ||
/* gdm sends MIT-MAGIC-COOKIE-1 cookies of length 16,
* so just do those */
+ xau->data_length != 16 ||
xau->name_length != strlen ("MIT-MAGIC-COOKIE-1") ||
strncmp (xau->name, "MIT-MAGIC-COOKIE-1",
xau->name_length) != 0 ||