Commit 1896121f authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

increment version, prepare for release

Tue May 14 14:53:51 2002  George Lebl <jirka@5z.com>

	* NEWS, configure.in: increment version, prepare for release

	* gui/gdmsetup.c: fix initial selection of the current greeter

	* daemon/display.c, daemon/errorgui.c, daemon/gdm.[ch],
	  daemon/misc.c, daemon/server.c, daemon/slave.c:  Fix deadlocks
	  when using the syslog inside a signal handler by sending the
	  message to the main daemon which then syslogs it.
parent cf0bbf95
Tue May 14 14:53:51 2002 George Lebl <jirka@5z.com>
* NEWS, configure.in: increment version, prepare for release
* gui/gdmsetup.c: fix initial selection of the current greeter
* daemon/display.c, daemon/errorgui.c, daemon/gdm.[ch],
daemon/misc.c, daemon/server.c, daemon/slave.c: Fix deadlocks
when using the syslog inside a signal handler by sending the
message to the main daemon which then syslogs it.
Tue May 14 12:08:25 2002 George Lebl <jirka@5z.com>
* gui/gdmphotosetup.c, daemon/auth.c: Apply some leak fixes from
......
Ahh news...
2.3.90.3 stuff:
- The instant apply, no crack, setup proggie (gdmsetup) now works,
gdmconfig is removed (Check out the gdmgreeter theme selector, though
we only have one theme now)
- Fix the i18n encoding issues. non-english users can now log in! Yay!
The daemon is back to not using UTF-8 but the locale specific encoding
because of fun GConv cache crack. All the utf8 stuff is done on the
greeter side now
- Leak fixes #80888 (Ali Akcaagac, me)
- Gdmphotosetup fixiage #80835
- Look into other dirs for an X server, and use /usr/X11R6/bin/X by default
#80829 (Ali Akcaagac, me)
- Check for socklen_t #79373
- Fix focus on the Failsafe xterm session
- Randomly scattered fixes
- Greeter themes now have info files, so that we can have some info about a
theme for the theme browser
- Bunch of greeter work to bring it more up to speed with gdmlogin, though
it's still not quite there yet.
- Add an icon for the photo chooser 'capplet' (Seth)
- Some dialog fixes all around
- Fix gdmchooser, use a completely new looking glade file
- Translation updates (Pablo Saratxaga, Zbigniew Chyla, Stanislav Visnovsky,
Christophe Merlet, Ole Laursen, Kjartan Maraas, Changwoo Ryu,
Germán Poo-Caamaño, Fatih Demir, Duarte Loreto, Abel Cheung,
Jarkko Ranta)
Issues with this version:
- You need a very new libgnomeui to run gdmsetup else it'll crash
- The graphical greeter (gdmgreeter) is still not where it should be
functionality wise, but it is mostly usable as a login window
2.3.90.2 stuff:
- LOTS of new greeter work (Alex, Jonathan)
......
......@@ -7,7 +7,7 @@ dnl
AC_PROG_INTLTOOL
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(gdm,2.3.90.2)
AM_INIT_AUTOMAKE(gdm,2.3.90.3)
AM_MAINTAINER_MODE
GDK_PIXBUF_REQUIRED=1.3.1
......
......@@ -195,6 +195,8 @@ gdm_display_manage (GdmDisplay *d)
gdm_connection_close (unixconn);
unixconn = NULL;
closelog ();
/* Close everything */
for (i = 0; i < sysconf (_SC_OPEN_MAX); i++) {
if (i != fds[0])
......@@ -207,6 +209,8 @@ gdm_display_manage (GdmDisplay *d)
open("/dev/null", O_RDWR); /* open stdout - fd 1 */
open("/dev/null", O_RDWR); /* open stderr - fd 2 */
openlog ("gdm", LOG_PID, LOG_DAEMON);
d->slave_notify_fd = fds[0];
if (d->type == TYPE_LOCAL) {
......
......@@ -24,6 +24,7 @@
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <unistd.h>
#include <syslog.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <fcntl.h>
......@@ -80,6 +81,8 @@ gdm_error_box (GdmDisplay *d, GtkMessageType type, const char *error)
int screenheight = 0;
char *loc;
closelog ();
for (i = 0; i < sysconf (_SC_OPEN_MAX); i++)
close(i);
......@@ -89,6 +92,8 @@ gdm_error_box (GdmDisplay *d, GtkMessageType type, const char *error)
open ("/dev/null", O_RDWR); /* open stdout - fd 1 */
open ("/dev/null", O_RDWR); /* open stderr - fd 2 */
openlog ("gdm", LOG_PID, LOG_DAEMON);
seteuid (getuid ());
setegid (getgid ());
......@@ -190,6 +195,8 @@ gdm_failsafe_question (GdmDisplay *d,
int screenheight = 0;
char *loc;
closelog ();
for (i = 0; i < sysconf (_SC_OPEN_MAX); i++)
close(i);
......@@ -199,6 +206,8 @@ gdm_failsafe_question (GdmDisplay *d,
open ("/dev/null", O_RDWR); /* open stdout - fd 1 */
open ("/dev/null", O_RDWR); /* open stderr - fd 2 */
openlog ("gdm", LOG_PID, LOG_DAEMON);
seteuid (getuid ());
setegid (getgid ());
......@@ -327,6 +336,8 @@ gdm_failsafe_yesno (GdmDisplay *d,
int screenheight = 0;
char *loc;
closelog ();
for (i = 0; i < sysconf (_SC_OPEN_MAX); i++) {
if (p[1] != i)
close(i);
......@@ -338,6 +349,8 @@ gdm_failsafe_yesno (GdmDisplay *d,
open ("/dev/null", O_RDWR); /* open stdout - fd 1 */
open ("/dev/null", O_RDWR); /* open stderr - fd 2 */
openlog ("gdm", LOG_PID, LOG_DAEMON);
seteuid (getuid ());
setegid (getgid ());
......
......@@ -89,6 +89,8 @@ gboolean gdm_emergency_server = FALSE;
gboolean gdm_first_login = TRUE;
int gdm_in_signal = 0;
/* Configuration options */
gchar *GdmUser = NULL;
gchar *GdmGroup = NULL;
......@@ -840,6 +842,8 @@ deal_with_x_crashes (GdmDisplay *d)
char *xlog = g_strconcat (GdmLogDir, "/", d->name, ".log", NULL);
int ii;
closelog ();
for (ii = 0; ii < sysconf (_SC_OPEN_MAX); ii++)
close (ii);
......@@ -1851,6 +1855,30 @@ gdm_handle_message (GdmConnection *conn, const char *msg, gpointer data)
} else if (strcmp (msg, GDM_SOP_SOFT_RESTART) == 0) {
gdm_restart_mode = TRUE;
gdm_safe_restart ();
} else if (strncmp (msg, GDM_SOP_SYSLOG " ",
strlen (GDM_SOP_SYSLOG " ")) == 0) {
char *p;
long pid;
int type;
p = strchr (msg, ' ');
if (p == NULL)
return;
p++;
if (sscanf (p, "%ld", &pid) != 1)
return;
p = strchr (p, ' ');
if (p == NULL)
return;
p++;
if (sscanf (p, "%d", &type) != 1)
return;
p = strchr (p, ' ');
if (p == NULL)
return;
p++;
syslog (type, "(child %ld) %s", pid, p);
} else if (strcmp (msg, GDM_SOP_START_NEXT_LOCAL) == 0) {
gdm_start_first_unborn_local (3 /* delay */);
} else if (strcmp (msg, GDM_SOP_HUP_ALL_GREETERS) == 0) {
......
......@@ -421,6 +421,8 @@ GdmXServer * gdm_find_x_server (const char *id);
#define GDM_SOP_SOFT_RESTART "SOFT_RESTART" /* no arguments */
#define GDM_SOP_START_NEXT_LOCAL "START_NEXT_LOCAL" /* no arguments */
#define GDM_SOP_HUP_ALL_GREETERS "HUP_ALL_GREETERS" /* no arguments */
/* sometimes we can't do a syslog so we tell the main daemon */
#define GDM_SOP_SYSLOG "SYSLOG" /* <pid> <type> <message> */
/* Notification protocol */
#define GDM_NOTIFY_ALLOWREMOTEROOT "AllowRemoteRoot" /* <true/false as int> */
......
......@@ -37,6 +37,7 @@
#include "gdm.h"
#include "misc.h"
#include "slave.h"
/* Configuration option variables */
extern gchar *GdmPidFile;
......@@ -49,6 +50,20 @@ extern char **environ;
extern pid_t extra_process;
extern int extra_status;
extern gboolean preserve_ld_vars;
extern int gdm_in_signal;
static void
do_syslog (int type, const char *s)
{
if (gdm_in_signal > 0) {
char *m = g_strdup_printf (GDM_SOP_SYSLOG " %ld %d %s",
(long)getpid (), type, s);
gdm_slave_send (m, FALSE);
g_free (m);
} else {
syslog (type, "%s", s);
}
}
/**
......@@ -71,7 +86,7 @@ gdm_fail (const gchar *format, ...)
va_end (args);
/* Log to both syslog and stderr */
syslog (LOG_CRIT, "%s", s);
do_syslog (LOG_CRIT, s);
fprintf (stderr, "%s\n", s);
fflush (stderr);
......@@ -107,7 +122,7 @@ gdm_info (const gchar *format, ...)
s = g_strdup_vprintf (format, args);
va_end (args);
syslog (LOG_INFO, "%s", s);
do_syslog (LOG_INFO, s);
g_free (s);
}
......@@ -131,7 +146,7 @@ gdm_error (const gchar *format, ...)
s = g_strdup_vprintf (format, args);
va_end (args);
syslog (LOG_ERR, "%s", s);
do_syslog (LOG_ERR, s);
g_free (s);
}
......@@ -158,7 +173,7 @@ gdm_debug (const gchar *format, ...)
s = g_strdup_vprintf (format, args);
va_end (args);
syslog (LOG_ERR, "%s", s); /* Maybe should be LOG_DEBUG, but then normally
do_syslog (LOG_ERR, s); /* Maybe should be LOG_DEBUG, but then normally
* you wouldn't get it in the log. ??? */
g_free (s);
......@@ -464,6 +479,8 @@ gdm_exec_wait (char * const *argv, gboolean no_display,
if (pid == 0) {
int i;
closelog ();
for (i = 0; i < sysconf (_SC_OPEN_MAX); i++)
close (i);
......@@ -478,6 +495,8 @@ gdm_exec_wait (char * const *argv, gboolean no_display,
setegid (getgid ());
}
openlog ("gdm", LOG_PID, LOG_DAEMON);
if (no_display) {
gnome_unsetenv ("DISPLAY");
gnome_unsetenv ("XAUTHORITY");
......
......@@ -31,6 +31,7 @@
#include <sys/wait.h>
#include <strings.h>
#include <signal.h>
#include <syslog.h>
#include <errno.h>
#include <time.h>
#include <X11/Xlib.h>
......@@ -63,6 +64,7 @@ extern gboolean GdmXdmcp;
extern gint high_display_num;
extern pid_t extra_process;
extern int extra_status;
extern int gdm_in_signal;
/* Global vars */
static GdmDisplay *d = NULL;
......@@ -665,6 +667,8 @@ gdm_server_spawn (GdmDisplay *d)
if (GdmXdmcp)
gdm_xdmcp_close();
closelog ();
/* close things */
for (i = 0; i < sysconf (_SC_OPEN_MAX); i++)
close(i);
......@@ -675,6 +679,8 @@ gdm_server_spawn (GdmDisplay *d)
open ("/dev/null", O_RDWR); /* open stdout - fd 1 */
open ("/dev/null", O_RDWR); /* open stderr - fd 2 */
openlog ("gdm", LOG_PID, LOG_DAEMON);
/* Rotate the X server logs */
rotate_logs (d->name);
......@@ -873,6 +879,8 @@ gdm_server_spawn (GdmDisplay *d)
static void
gdm_server_usr1_handler (gint sig)
{
gdm_in_signal++;
d->servstat = SERVER_RUNNING; /* Server ready to accept connections */
d->starttime = time (NULL);
......@@ -881,6 +889,8 @@ gdm_server_usr1_handler (gint sig)
server_signal_notified = TRUE;
/* this will quit the select */
write (server_signal_pipe[1], "Yay!", 4);
gdm_in_signal--;
}
......@@ -894,14 +904,17 @@ gdm_server_usr1_handler (gint sig)
static void
gdm_server_alarm_handler (gint signal)
{
gdm_in_signal++;
d->servstat = SERVER_TIMEOUT; /* Server didn't start */
/* FIXME: apparently this can cause a hang */
/* gdm_debug ("gdm_server_alarm_handler: Got SIGALRM, server abort"); */
gdm_debug ("gdm_server_alarm_handler: Got SIGALRM, server abort");
server_signal_notified = TRUE;
/* this will quit the select */
write (server_signal_pipe[1], "Yay!", 4);
gdm_in_signal--;
}
......@@ -918,6 +931,8 @@ gdm_server_child_handler (int signal)
int status;
pid_t pid;
gdm_in_signal++;
gdm_debug ("gdm_server_child_handler: Got SIGCHLD");
while ((pid = waitpid (-1, &status, WNOHANG)) > 0) {
......@@ -946,6 +961,8 @@ gdm_server_child_handler (int signal)
extra_status = status;
}
}
gdm_in_signal--;
}
......
......@@ -85,6 +85,7 @@ extern gboolean gdm_first_login;
extern gboolean gdm_emergency_server;
extern pid_t extra_process;
extern int extra_status;
extern int gdm_in_signal;
/* Configuration option variables */
extern gchar *GdmUser;
......@@ -635,6 +636,8 @@ focus_first_x_window (const char *class_res_name)
return;
}
closelog ();
for (i = 0; i < sysconf (_SC_OPEN_MAX); i++)
close(i);
......@@ -644,6 +647,8 @@ focus_first_x_window (const char *class_res_name)
open ("/dev/null", O_RDWR); /* open stdout - fd 1 */
open ("/dev/null", O_RDWR); /* open stderr - fd 2 */
openlog ("gdm", LOG_PID, LOG_DAEMON);
disp = XOpenDisplay (d->name);
if (disp == NULL) {
gdm_error (_("focus_first_x_window: cannot open display %s"),
......@@ -735,6 +740,8 @@ run_config (GdmDisplay *display, struct passwd *pwent)
gnome_setenv ("PATH", GdmRootPath, TRUE);
gnome_setenv ("RUNNING_UNDER_GDM", "true", TRUE);
closelog ();
for (i = 0; i < sysconf (_SC_OPEN_MAX); i++)
close(i);
......@@ -744,6 +751,8 @@ run_config (GdmDisplay *display, struct passwd *pwent)
open ("/dev/null", O_RDWR); /* open stdout - fd 1 */
open ("/dev/null", O_RDWR); /* open stderr - fd 2 */
openlog ("gdm", LOG_PID, LOG_DAEMON);
/* exec the configurator */
argv = ve_split (GdmConfigurator);
if (argv != NULL &&
......@@ -1273,10 +1282,14 @@ gdm_slave_greeter (void)
if (pipe2[1] != STDOUT_FILENO)
dup2 (pipe2[1], STDOUT_FILENO);
closelog ();
for (i = 2; i < sysconf (_SC_OPEN_MAX); i++)
close(i);
open ("/dev/null", O_RDWR); /* open stderr - fd 2 */
openlog ("gdm", LOG_PID, LOG_DAEMON);
if (setgid (GdmGroupId) < 0)
gdm_child_exit (DISPLAY_ABORT,
......@@ -1451,6 +1464,8 @@ parent_exists (void)
return TRUE;
}
/* This should not call anything that could cause a syslog in case we
* are in a signal */
void
gdm_slave_send (const char *str, gboolean wait_for_ack)
{
......@@ -1458,7 +1473,8 @@ gdm_slave_send (const char *str, gboolean wait_for_ack)
char *fifopath;
int i;
gdm_debug ("Sending %s", str);
if (gdm_in_signal == 0)
gdm_debug ("Sending %s", str);
if (wait_for_ack)
gdm_got_ack = FALSE;
......@@ -1469,7 +1485,8 @@ gdm_slave_send (const char *str, gboolean wait_for_ack)
/* eek */
if (fd < 0) {
gdm_error (_("%s: Can't open fifo!"), "gdm_slave_send");
if (gdm_in_signal == 0)
gdm_error (_("%s: Can't open fifo!"), "gdm_slave_send");
return;
}
......@@ -1492,11 +1509,11 @@ gdm_slave_send_num (const char *opcode, long num)
{
char *msg;
gdm_debug ("Sending %s == %ld for slave %ld",
opcode,
(long)num,
(long)getpid ());
if (gdm_in_signal == 0)
gdm_debug ("Sending %s == %ld for slave %ld",
opcode,
(long)num,
(long)getpid ());
msg = g_strdup_printf ("%s %ld %ld", opcode,
(long)getpid (), (long)num);
......@@ -1512,7 +1529,7 @@ gdm_slave_send_string (const char *opcode, const char *str)
char *msg;
/* Evil!, all this for debugging? */
if (GdmDebug) {
if (GdmDebug && gdm_in_signal == 0) {
if (strcmp (opcode, GDM_SOP_COOKIE) == 0)
gdm_debug ("Sending %s == <secret> for slave %ld",
opcode,
......@@ -1611,6 +1628,8 @@ gdm_slave_chooser (void)
if (p[1] != STDOUT_FILENO)
dup2 (p[1], STDOUT_FILENO);
closelog ();
close (0);
for (i = 2; i < sysconf (_SC_OPEN_MAX); i++)
close(i);
......@@ -1618,6 +1637,8 @@ gdm_slave_chooser (void)
open ("/dev/null", O_RDONLY); /* open stdin - fd 0 */
open ("/dev/null", O_RDWR); /* open stderr - fd 2 */
openlog ("gdm", LOG_PID, LOG_DAEMON);
if (setgid (GdmGroupId) < 0)
gdm_child_exit (DISPLAY_ABORT,
_("%s: Couldn't set groupid to %d"),
......@@ -2088,6 +2109,8 @@ session_child_run (struct passwd *pwent,
gnome_config_drop_all ();
}
closelog ();
for (i = 0; i < sysconf (_SC_OPEN_MAX); i++)
close (i);
......@@ -2096,6 +2119,8 @@ session_child_run (struct passwd *pwent,
open ("/dev/null", O_RDONLY); /* open stdin - fd 0 */
open ("/dev/null", O_RDWR); /* open stdout - fd 1 */
open ("/dev/null", O_RDWR); /* open stderr - fd 2 */
openlog ("gdm", LOG_PID, LOG_DAEMON);
sigemptyset (&mask);
sigprocmask (SIG_SETMASK, &mask, NULL);
......@@ -2581,6 +2606,8 @@ gdm_slave_term_handler (int sig)
{
sigset_t tmask;
gdm_in_signal++;
gdm_debug ("gdm_slave_term_handler: %s got TERM/INT signal", d->name);
/* just for paranoia's sake */
......@@ -2631,10 +2658,13 @@ gdm_slave_alrm_handler (int sig)
{
static gboolean in_ping = FALSE;
gdm_in_signal++;
gdm_debug ("gdm_slave_alrm_handler: %s got ARLM signal, "
"to ping display", d->name);
if (d->dsp == NULL) {
gdm_in_signal --;
/* huh? */
return;
}
......@@ -2660,6 +2690,8 @@ gdm_slave_alrm_handler (int sig)
XSync (d->dsp, True);
in_ping = FALSE;
gdm_in_signal --;
}
/* Called on every SIGCHLD */
......@@ -2669,6 +2701,8 @@ gdm_slave_child_handler (int sig)
gint status;
pid_t pid;
gdm_in_signal++;
gdm_debug ("gdm_slave_child_handler");
while ((pid = waitpid (-1, &status, WNOHANG)) > 0) {
......@@ -2695,6 +2729,7 @@ gdm_slave_child_handler (int sig)
interrupted = TRUE;
do_restart_greeter = TRUE;
}
gdm_in_signal--;
return;
}
......@@ -2733,6 +2768,7 @@ gdm_slave_child_handler (int sig)
extra_status = status;
}
}
gdm_in_signal--;
}
static void
......@@ -2743,17 +2779,23 @@ gdm_slave_usr2_handler (int sig)
char **vec;
int i;
gdm_in_signal++;
gdm_debug ("gdm_slave_usr2_handler: %s got USR2 signal", d->name);
count = read (d->slave_notify_fd, buf, sizeof (buf) -1);
if (count <= 0)
if (count <= 0) {
gdm_in_signal--;
return;
}
buf[count] = '\0';
vec = g_strsplit (buf, "\n", -1);
if (vec == NULL)
if (vec == NULL) {
gdm_in_signal--;
return;
}
for (i = 0; vec[i] != NULL; i++) {
char *s = vec[i];
......@@ -2771,6 +2813,8 @@ gdm_slave_usr2_handler (int sig)
}
g_strfreev (vec);
gdm_in_signal--;
}
/* Minor X faults */
......@@ -3032,6 +3076,8 @@ gdm_slave_exec_script (GdmDisplay *d, const gchar *dir, const char *login,
switch (pid) {
case 0:
closelog ();
for (i = 0; i < sysconf (_SC_OPEN_MAX); i++)
close (i);
......@@ -3041,6 +3087,8 @@ gdm_slave_exec_script (GdmDisplay *d, const gchar *dir, const char *login,
open ("/dev/null", O_RDWR); /* open stdout - fd 1 */
open ("/dev/null", O_RDWR); /* open stderr - fd 2 */
openlog ("gdm", LOG_PID, LOG_DAEMON);
if (login != NULL) {
gnome_setenv ("LOGNAME", login, TRUE);
gnome_setenv ("USER", login, TRUE);
......@@ -3169,6 +3217,7 @@ gdm_parse_enriched_login (const gchar *s, GdmDisplay *display)
if (pipe (pipe1) < 0) {
gdm_error (_("gdm_parse_enriched_login: Failed creating pipe"));
} else {
int i;
pid = gdm_fork_extra ();
switch (pid) {
......@@ -3181,6 +3230,15 @@ gdm_parse_enriched_login (const gchar *s, GdmDisplay *display)
if(pipe1[1] != STDOUT_FILENO)
dup2 (pipe1[1], STDOUT_FILENO);
closelog ();
for (i = 3; i < sysconf (_SC_OPEN_MAX); i++) {
if (pipe1[1] != i)
close (i);
}
openlog ("gdm", LOG_PID, LOG_DAEMON);
/* runs as root */
gnome_setenv ("XAUTHORITY", display->authfile, TRUE);
gnome_setenv ("DISPLAY", display->name, TRUE);
......
......@@ -853,8 +853,13 @@ setup_greeter_option (const char *name,
selected == NULL)
add_menuitem (menu, val, val, val, &selected);
if (selected != NULL)
gtk_menu_item_activate (GTK_MENU_ITEM (selected));
/* FIXME: Evil, but GtkOptionMenu is SOOOO FUCKING STUPID! */
if (selected != NULL) {
if (GTK_MENU (menu)->old_active_menu_item)
gtk_widget_unref (GTK_MENU (menu)->old_active_menu_item);
GTK_MENU (menu)->old_active_menu_item = selected;
gtk_widget_ref (GTK_MENU (menu)->old_active_menu_item);
}
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment