This commit is contained in:
Havoc Pennington 2001-09-16 02:52:23 +00:00
parent 39df21227d
commit a926a4a0ca
2 changed files with 75 additions and 37 deletions

View File

@ -50,7 +50,7 @@
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include "server.h"
#include "session.h"
@ -885,6 +885,8 @@ process_ice_messages (GIOChannel *channel,
/* We were disconnected */
IceSetShutdownNegotiation (connection, False);
IceCloseConnection (connection);
return FALSE;
}
return TRUE;
@ -975,11 +977,11 @@ accept_connection (GIOChannel *channel,
if (cstatus != IceConnectAccepted)
{
if (cstatus == IceConnectIOError)
msm_warning (_("IO error trying to accept new connection (client may have crashed trying to connect to the session manager, or client may be broken, or someone yanked the ethernet cable)"));
msm_warning (_("IO error trying to accept new connection (client may have crashed trying to connect to the session manager, or client may be broken, or someone yanked the ethernet cable)\n"));
else
msm_warning (_("Rejecting new connection (some client was not allowed to connect to the session manager)"));
msm_warning (_("Rejecting new connection (some client was not allowed to connect to the session manager)\n"));
IceCloseConnection (cnxn);
/* IceCloseConnection (cnxn);*/
}
return TRUE;
@ -1146,21 +1148,18 @@ create_auth_entries (MsmServer *server,
int original_umask;
int i;
int fd = -1;
char *tmpl = NULL;
GError *err;
IceAuthDataEntry *entries;
original_umask = umask (0077); /* disallow non-owner access */
path = msm_get_work_directory ();
err = NULL;
tmpl = g_strconcat (path, "/msm-add-commands-XXXXXX", NULL);
fd = g_file_open_tmp (tmpl, &add_file, &err);
if (err)
add_file = g_strconcat (path, "/msm-add-commands-XXXXXX", NULL);
fd = g_mkstemp (add_file);
if (fd < 0)
{
msm_fatal (_("Could not create ICE authentication script: %s\n"),
err->message);
msm_fatal (_("Could not create ICE authentication script '%s': %s\n"),
add_file, g_strerror (errno));
g_assert_not_reached ();
return FALSE;
}
@ -1169,17 +1168,12 @@ create_auth_entries (MsmServer *server,
if (addfp == NULL)
goto bad;
g_free (tmpl);
tmpl = NULL;
err = NULL;
tmpl = g_strconcat (path, "/msm-remove-commands-XXXXXX", NULL);
fd = g_file_open_tmp (tmpl, &remove_file, &err);
if (err)
remove_file = g_strconcat (path, "/msm-remove-commands-XXXXXX", NULL);
fd = g_mkstemp (remove_file);
if (fd < 0)
{
msm_fatal (_("Could not create ICE authentication script: %s\n"),
err->message);
msm_fatal (_("Could not create ICE authentication script '%s': %s\n"),
remove_file, g_strerror (errno));
g_assert_not_reached ();
return FALSE;
}
@ -1188,9 +1182,6 @@ create_auth_entries (MsmServer *server,
if (removefp == NULL)
goto bad;
g_free (tmpl);
tmpl = NULL;
server->n_auth_entries = n_listen_objs * 2;
server->auth_entries = g_new (IceAuthDataEntry, server->n_auth_entries);
entries = server->auth_entries;
@ -1237,9 +1228,6 @@ create_auth_entries (MsmServer *server,
bad:
if (tmpl)
g_free (tmpl);
if (addfp)
fclose (addfp);

View File

@ -198,9 +198,12 @@ msm_session_get_for_filename (const char *name,
GError *dir_error = NULL;
GError *err;
if (sessions)
{
session = g_hash_table_lookup (sessions, filename);
if (session)
return session;
}
session = g_new0 (MsmSession, 1);
session->name = g_strdup (name);
@ -228,7 +231,7 @@ msm_session_get_for_filename (const char *name,
* for users than the usual issues one worries about when locking.
*/
fd = open (session->full_filename, O_RDWR | O_CREAT | O_EXCL, 0700);
fd = open (session->full_filename, O_RDWR | O_CREAT, 0700);
if (fd < 0)
{
@ -301,11 +304,11 @@ msm_session_get_for_filename (const char *name,
return session;
}
if (session->clients == NULL)
if (FALSE && session->clients == NULL)
{
session = recover_failed_session (session,
MSM_SESSION_FAILURE_EMPTY,
_("Session doesn't contain any applications"));
NULL);
return session;
}
@ -544,8 +547,54 @@ static void
add_details_to_dialog (GtkDialog *dialog,
const char *details)
{
GtkWidget *hbox;
GtkWidget *button;
GtkWidget *label;
GtkRequisition req;
hbox = gtk_hbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 10);
gtk_box_pack_start (GTK_BOX (dialog->vbox),
hbox,
FALSE, FALSE, 0);
button = gtk_button_new_with_mnemonic (_("_Details"));
gtk_box_pack_end (GTK_BOX (hbox), button,
FALSE, FALSE, 0);
label = gtk_label_new (details);
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_box_pack_start (GTK_BOX (hbox), label,
TRUE, TRUE, 0);
/* show the label on click */
g_signal_connect_swapped (G_OBJECT (button),
"clicked",
G_CALLBACK (gtk_widget_show),
label);
/* second callback destroys the button (note disconnects first callback) */
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (gtk_widget_destroy),
NULL);
/* Set default dialog size to size with the label,
* and without the button, but then rehide the label
*/
gtk_widget_show_all (hbox);
gtk_widget_size_request (GTK_WIDGET (dialog), &req);
#if 0
/* Omitted for now because it triggers a GTK 1.3.7 bug */
gtk_window_set_default_size (GTK_WINDOW (dialog), req.width, req.height);
#endif
gtk_widget_hide (label);
}
static MsmSession*
@ -611,6 +660,7 @@ recover_failed_session (MsmSession *session,
message);
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
if (details)
add_details_to_dialog (GTK_DIALOG (dialog), details);
g_free (message);