summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog33
-rwxr-xr-xconfig/XKeepsCrashing2
-rw-r--r--daemon/auth.c4
-rw-r--r--daemon/gdm.c2
-rw-r--r--daemon/misc.c85
-rw-r--r--daemon/server.c8
-rw-r--r--daemon/slave.c8
-rw-r--r--daemon/verify-shadow.c17
-rw-r--r--gui/gdmsetup.c9
-rw-r--r--utils/gdmopen.c33
10 files changed, 142 insertions, 59 deletions
diff --git a/ChangeLog b/ChangeLog
index ebac18d3..ea1817a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,36 @@
+Tue May 13 12:22:45 2003 George Lebl <jirka@5z.com>
+
+ * gui/gdmsetup.c: when more then 50 users don't put them all in the
+ combo boxes, this is a semi-solution to #111830
+
+ * daemon/verify-shadow.c: Apply patch from cschelcher@free.fr to fall
+ back to standard password when shadow is not available. Apparently
+ fixes NIS stuff, but I really think people should be using pam,
+ but I digress. Fixes #109765
+
+ * daemon/auth.c, daemon/misc.c, daemon/server.c, daemon/slave.c:
+ use strerror instead of g_strerror as that returns always UTF-8
+ and we want current locale. We already assume strerror is on
+ the system so this is not a portability issue anyway. Fixes
+ #106655
+
+ * utils/gdmopen.c: apply patch from Owen Taylor to fix #106656
+ by not deallocating the vt after we are done as apparently this
+ is what open does and the kernel has a fit otherwise anyway.
+ It's braindead, but oh well, this is the way it apparently works
+ right.
+
+ * daemon/gdm.c: apply patch from Owen Taylor to fix #106656
+ by setting TEXTDOMAIN to GETTEXT_PACKAGE rather then PACKAGE
+ before running scripts
+
+ * utils/gdmopen.c, daemon/misc.c: Apply patch from Owen Taylor
+ to fix #106658, but fix it portably by adding the -l
+ option to gdmopen as suggested by Owen. So all gdmopens
+ we do are now using login shells which makes me wonder if we
+ should just build that into gdmopen, since it's a special
+ purpose utility anyhow.
+
2003-05-08 Brian Cameron <Brian.Cameron@Sun.COM>
* gui/greeter/greeter.dtd: Updated so it is no longer
out of date. Patch provided by Aidan.Butler@Sun.COM.
diff --git a/config/XKeepsCrashing b/config/XKeepsCrashing
index df768c52..8aafada9 100755
--- a/config/XKeepsCrashing
+++ b/config/XKeepsCrashing
@@ -91,7 +91,7 @@ else
# We do a lot of work wastefully over again, but oh well,
# perhaps this needs fixing.
#
- "$SBINDIR/gdmopen" $0 -noopen "$@"
+ "$SBINDIR/gdmopen" -l /bin/sh -c "$0 -noopen $@"
exit $?
fi
diff --git a/daemon/auth.c b/daemon/auth.c
index 8ab5c529..27af302d 100644
--- a/daemon/auth.c
+++ b/daemon/auth.c
@@ -53,7 +53,7 @@ display_add_error (GdmDisplay *d)
{
if (errno != 0)
gdm_error (_("%s: Could not write new authorization entry: %s"),
- "add_auth_entry", g_strerror (errno));
+ "add_auth_entry", strerror (errno));
else
gdm_error (_("%s: Could not write new authorization entry. "
"Possibly out of diskspace"),
@@ -63,7 +63,7 @@ display_add_error (GdmDisplay *d)
(_("GDM could not write a new authorization "
"entry to disk. Possibly out of diskspace.%s%s"),
errno != 0 ? " Error: " : "",
- errno != 0 ? g_strerror (errno) : "");
+ errno != 0 ? strerror (errno) : "");
gdm_text_message_dialog (s);
g_free (s);
}
diff --git a/daemon/gdm.c b/daemon/gdm.c
index 258e53d5..34c9844b 100644
--- a/daemon/gdm.c
+++ b/daemon/gdm.c
@@ -925,7 +925,7 @@ deal_with_x_crashes (GdmDisplay *d)
gnome_setenv ("SBINDIR", EXPANDED_SBINDIR, TRUE);
/* To enable gettext stuff in the script */
- gnome_setenv ("TEXTDOMAIN", PACKAGE, TRUE);
+ gnome_setenv ("TEXTDOMAIN", GETTEXT_PACKAGE, TRUE);
gnome_setenv ("TEXTDOMAINDIR", GNOMELOCALEDIR, TRUE);
execv (argv[0], argv);
diff --git a/daemon/misc.c b/daemon/misc.c
index 4f5f0a74..737857e2 100644
--- a/daemon/misc.c
+++ b/daemon/misc.c
@@ -373,53 +373,61 @@ gboolean
gdm_text_message_dialog (const char *msg)
{
char *dialog; /* do we have dialog?*/
+ char *msg_locale;
+ char *msg_quoted;
if (access (EXPANDED_SBINDIR "/gdmopen", X_OK) != 0)
return FALSE;
+ msg_quoted = g_shell_quote (msg);
+
dialog = g_find_program_in_path ("dialog");
if (dialog == NULL)
dialog = g_find_program_in_path ("gdialog");
if (dialog == NULL)
dialog = g_find_program_in_path ("whiptail");
if (dialog != NULL) {
- char *argv[7];
-
+ char *argv[6];
+
argv[0] = EXPANDED_SBINDIR "/gdmopen";
- argv[1] = dialog;
- argv[2] = "--msgbox";
- argv[3] = (char *)msg;
- argv[4] = "11";
- argv[5] = "70";
- argv[6] = NULL;
+ argv[1] = "-l";
+ argv[2] = "/bin/sh";
+ argv[3] = "-c";
+ argv[4] = g_strdup_printf ("%s --msgbox %s 11 70",
+ dialog, msg_quoted);
+ argv[5] = NULL;
/* make sure gdialog wouldn't get confused */
if (gdm_exec_wait (argv, TRUE /* no display */,
TRUE /* de_setuid */) < 0) {
g_free (dialog);
+ g_free (msg_quoted);
return FALSE;
}
g_free (dialog);
} else {
- char *argv[5];
+ char *argv[6];
argv[0] = EXPANDED_SBINDIR "/gdmopen";
- argv[1] = "/bin/sh";
- argv[2] = "-c";
- argv[3] = g_strdup_printf
+ argv[1] = "-l";
+ argv[2] = "/bin/sh";
+ argv[3] = "-c";
+ argv[4] = g_strdup_printf
("clear ; "
- "echo \"%s\" ; read ; clear",
- msg);
- argv[4] = NULL;
+ "echo %s ; read ; clear",
+ msg_quoted);
+ argv[5] = NULL;
if (gdm_exec_wait (argv, TRUE /* no display */,
TRUE /* de_setuid */) < 0) {
g_free (argv[3]);
+ g_free (msg_quoted);
return FALSE;
}
g_free (argv[3]);
}
+ g_free (msg_quoted);
return TRUE;
}
@@ -427,29 +435,34 @@ gboolean
gdm_text_yesno_dialog (const char *msg, gboolean *ret)
{
char *dialog; /* do we have dialog?*/
-
+ char *msg_locale;
+ char *msg_quoted;
+
if (access (EXPANDED_SBINDIR "/gdmopen", X_OK) != 0)
return FALSE;
if (ret != NULL)
*ret = FALSE;
+ msg_quoted = g_shell_quote (msg);
+
dialog = g_find_program_in_path ("dialog");
if (dialog == NULL)
dialog = g_find_program_in_path ("gdialog");
if (dialog == NULL)
dialog = g_find_program_in_path ("whiptail");
if (dialog != NULL) {
- char *argv[7];
+ char *argv[6];
+ char *msg_quoted;
int retint;
argv[0] = EXPANDED_SBINDIR "/gdmopen";
- argv[1] = dialog;
- argv[2] = "--yesno";
- argv[3] = (char *)msg;
- argv[4] = "11";
- argv[5] = "70";
- argv[6] = NULL;
+ argv[1] = "-l";
+ argv[2] = "/bin/sh";
+ argv[3] = "-c";
+ argv[4] = g_strdup_printf ("%s --yesno %s 11 70",
+ dialog, msg_quoted);
+ argv[5] = NULL;
/* will unset DISPLAY and XAUTHORITY if they exist
* so that gdialog (if used) doesn't get confused */
@@ -457,6 +470,7 @@ gdm_text_yesno_dialog (const char *msg, gboolean *ret)
TRUE /* de_setuid */);
if (retint < 0) {
g_free (dialog);
+ g_free (msg_quoted);
return FALSE;
}
@@ -464,6 +478,7 @@ gdm_text_yesno_dialog (const char *msg, gboolean *ret)
*ret = (retint == 0) ? TRUE : FALSE;
g_free (dialog);
+ g_free (msg_quoted);
return TRUE;
} else {
@@ -471,30 +486,34 @@ gdm_text_yesno_dialog (const char *msg, gboolean *ret)
int tempfd;
FILE *fp;
char buf[256];
- char *argv[5];
+ char *argv[6];
tempfd = g_mkstemp (tempname);
- if (tempfd < 0)
+ if (tempfd < 0) {
+ g_free (msg_quoted);
return FALSE;
+ }
close (tempfd);
argv[0] = EXPANDED_SBINDIR "/gdmopen";
- argv[1] = "/bin/sh";
- argv[2] = "-c";
- argv[3] = g_strdup_printf
+ argv[1] = "-l";
+ argv[2] = "/bin/sh";
+ argv[3] = "-c";
+ argv[4] = g_strdup_printf
("clear ; "
- "echo \"%s\" ; echo ; echo \"%s\" ; "
+ "echo %s ; echo ; echo \"%s\" ; "
"read RETURN ; echo $RETURN > %s ; clear'",
- msg,
+ msg_quoted,
/* Translators, don't translate the 'y' and 'n' */
_("y = Yes or n = No? >"),
tempname);
- argv[4] = NULL;
+ argv[5] = NULL;
if (gdm_exec_wait (argv, TRUE /* no display */,
TRUE /* de_setuid */) < 0) {
g_free (argv[3]);
+ g_free (msg_quoted);
return FALSE;
}
g_free (argv[3]);
@@ -507,12 +526,14 @@ gdm_text_yesno_dialog (const char *msg, gboolean *ret)
*ret = TRUE;
fclose (fp);
} else {
+ g_free (msg_quoted);
return FALSE;
}
}
unlink (tempname);
+ g_free (msg_quoted);
return TRUE;
}
}
@@ -818,7 +839,7 @@ gdm_peek_local_address_list (void)
if (gethostname (hostbuf, BUFSIZ-1) != 0) {
gdm_debug ("%s: Could not get server hostname: %s!",
"gdm_peek_local_address_list",
- g_strerror (errno));
+ strerror (errno));
addr = g_new0 (struct in_addr, 1);
addr->s_addr = INADDR_LOOPBACK;
return g_list_append (NULL, addr);
diff --git a/daemon/server.c b/daemon/server.c
index e59db78a..d5d5d279 100644
--- a/daemon/server.c
+++ b/daemon/server.c
@@ -456,7 +456,7 @@ gdm_server_start (GdmDisplay *disp, gboolean treat_as_flexi,
if (pipe (server_signal_pipe) != 0) {
gdm_error (_("%s: Error opening a pipe: %s"),
- "gdm_server_start", g_strerror (errno));
+ "gdm_server_start", strerror (errno));
return FALSE;
}
server_signal_notified = FALSE;
@@ -468,7 +468,7 @@ gdm_server_start (GdmDisplay *disp, gboolean treat_as_flexi,
if (sigaction (SIGUSR1, &usr1, &old_usr1) < 0) {
gdm_error (_("%s: Error setting up USR1 signal handler: %s"),
- "gdm_server_start", g_strerror (errno));
+ "gdm_server_start", strerror (errno));
close (server_signal_pipe[0]);
close (server_signal_pipe[1]);
return FALSE;
@@ -481,7 +481,7 @@ gdm_server_start (GdmDisplay *disp, gboolean treat_as_flexi,
if (sigaction (SIGCHLD, &chld, &old_chld) < 0) {
gdm_error (_("%s: Error setting up CHLD signal handler: %s"),
- "gdm_server_start", g_strerror (errno));
+ "gdm_server_start", strerror (errno));
sigaction (SIGUSR1, &old_usr1, NULL);
close (server_signal_pipe[0]);
close (server_signal_pipe[1]);
@@ -495,7 +495,7 @@ gdm_server_start (GdmDisplay *disp, gboolean treat_as_flexi,
if (sigaction (SIGALRM, &alrm, &old_alrm) < 0) {
gdm_error (_("%s: Error setting up ALRM signal handler: %s"),
- "gdm_server_start", g_strerror (errno));
+ "gdm_server_start", strerror (errno));
sigaction (SIGUSR1, &old_usr1, NULL);
sigaction (SIGCHLD, &old_chld, NULL);
close (server_signal_pipe[0]);
diff --git a/daemon/slave.c b/daemon/slave.c
index 0a598444..ac3e363e 100644
--- a/daemon/slave.c
+++ b/daemon/slave.c
@@ -269,7 +269,7 @@ gdm_slave_start (GdmDisplay *display)
if (sigaction (SIGALRM, &alrm, NULL) < 0)
gdm_slave_exit (DISPLAY_ABORT,
_("%s: Error setting up ALRM signal handler: %s"),
- "gdm_slave_start", g_strerror (errno));
+ "gdm_slave_start", strerror (errno));
}
/* Handle a INT/TERM signals from gdm master */
@@ -283,7 +283,7 @@ gdm_slave_start (GdmDisplay *display)
(sigaction (SIGINT, &term, NULL) < 0))
gdm_slave_exit (DISPLAY_ABORT,
_("%s: Error setting up TERM/INT signal handler: %s"),
- "gdm_slave_start", g_strerror (errno));
+ "gdm_slave_start", strerror (errno));
/* Child handler. Keeps an eye on greeter/session */
child.sa_handler = gdm_slave_child_handler;
@@ -293,7 +293,7 @@ gdm_slave_start (GdmDisplay *display)
if (sigaction (SIGCHLD, &child, NULL) < 0)
gdm_slave_exit (DISPLAY_ABORT, _("%s: Error setting up CHLD signal handler: %s"),
- "gdm_slave_start", g_strerror (errno));
+ "gdm_slave_start", strerror (errno));
/* Handle a USR2 which is ack from master that it received a message */
usr2.sa_handler = gdm_slave_usr2_handler;
@@ -303,7 +303,7 @@ gdm_slave_start (GdmDisplay *display)
if (sigaction (SIGUSR2, &usr2, NULL) < 0)
gdm_slave_exit (DISPLAY_ABORT, _("%s: Error setting up USR2 signal handler: %s"),
- "gdm_slave_start", g_strerror (errno));
+ "gdm_slave_start", strerror (errno));
/* The signals we wish to listen to */
sigfillset (&mask);
diff --git a/daemon/verify-shadow.c b/daemon/verify-shadow.c
index 643010cb..dd455d26 100644
--- a/daemon/verify-shadow.c
+++ b/daemon/verify-shadow.c
@@ -88,10 +88,19 @@ gdm_verify_user (GdmDisplay *d, const char *username, const gchar *display, gboo
/* Lookup shadow password */
sp = getspnam (login);
- if (sp)
- ppasswd = g_strdup (sp->sp_pwdp);
- else
- ppasswd = NULL;
+ /* Use shadow password when available */
+ if (sp != NULL) {
+ ppasswd = g_strdup (sp->sp_pwdp);
+ } else {
+ /* In case shadow password cannot be retrieved (when using NIS
+ authentication for example), use standard passwd */
+ if (pwent != NULL &&
+ pwent->pw_passwd != NULL)
+ ppasswd = g_strdup (pwent->pw_passwd);
+ else
+ /* If no password can be retrieved, set it to NULL */
+ ppasswd = NULL;
+ }
endspent ();
diff --git a/gui/gdmsetup.c b/gui/gdmsetup.c
index 00d1c63d..29d80a3b 100644
--- a/gui/gdmsetup.c
+++ b/gui/gdmsetup.c
@@ -414,6 +414,7 @@ setup_user_combo (const char *name, const char *key)
GList *users = NULL;
struct passwd *pwent;
char *str;
+ int cnt;
str = ve_config_get_string (ve_config_get (GDM_CONFIG_FILE), key);
@@ -426,12 +427,20 @@ setup_user_combo (const char *name, const char *key)
setpwent ();
pwent = getpwent();
+ cnt = 0;
while (pwent != NULL) {
if (pwent->pw_uid >= GdmMinimalUID &&
strcmp (ve_sure_string (str), pwent->pw_name) != 0) {
+ cnt ++;
users = g_list_append (users,
g_strdup (pwent->pw_name));
+ /* FIXME: fix properly, see bug #111830 */
+ if (cnt >= 50) {
+ users = g_list_append (users,
+ g_strdup (_("Too many users to list here...")));
+ break;
+ }
}
pwent = getpwent();
diff --git a/utils/gdmopen.c b/utils/gdmopen.c
index 00f91b2a..fdc382d5 100644
--- a/utils/gdmopen.c
+++ b/utils/gdmopen.c
@@ -59,7 +59,7 @@ static pid_t child_pid = -1;
struct vt_stat vt;
static int vtno;
static int fd = 0;
-static int do_dealloc = FALSE;
+static int do_switchback = FALSE;
static void
sighandler (int sig)
@@ -69,14 +69,11 @@ sighandler (int sig)
waitpid (child_pid, NULL, 0);
}
- if (do_dealloc) {
+ if (do_switchback) {
/* Switch back... */
(void) ioctl(fd, VT_ACTIVATE, vt.v_active);
/* wait to be really sure we have switched */
(void) ioctl(fd, VT_WAITACTIVE, vt.v_active);
-
- /* Now deallocate our new one */
- (void) ioctl(fd, VT_DISALLOCATE, vtno);
}
/* Kill myself with this signal */
@@ -89,6 +86,8 @@ main (int argc, char *argv[])
{
char vtname[256];
int status;
+ int cmd_start = 1;
+ char *command = NULL;
if (getuid () != geteuid () ||
getuid () != 0) {
@@ -105,6 +104,21 @@ main (int argc, char *argv[])
return 66;
}
+ command = argv[1];
+
+ if (strcmp (argv[1], "-l") == 0) {
+ if (argc <= 2) {
+ fprintf (stderr, "gdmopen: must supply a command!\n");
+ return 66;
+ }
+ /* prepend '-' and start the command at
+ * argument 2 */
+ cmd_start = 2;
+ command = malloc (strlen (argv[2]) + 2);
+ strcpy (command+1, argv[2]);
+ command[0] = '-';
+ }
+
fd = open ("/dev/console", O_WRONLY, 0);
if (fd < 0) {
perror ("gdmopen: Failed to open /dev/console");
@@ -176,7 +190,7 @@ main (int argc, char *argv[])
write (0, "\033(K", 3);
#endif /* __linux__ */
- execvp (argv[1], &argv[1]);
+ execvp (command, &argv[1]);
_exit (66); /* failed */
}
@@ -186,21 +200,18 @@ main (int argc, char *argv[])
return 66;
}
- do_dealloc = TRUE;
+ do_switchback = TRUE;
waitpid (child_pid, &status, 0);
child_pid = -1;
- do_dealloc = FALSE;
+ do_switchback = FALSE;
/* Switch back... */
(void) ioctl(fd, VT_ACTIVATE, vt.v_active);
/* wait to be really sure we have switched */
(void) ioctl(fd, VT_WAITACTIVE, vt.v_active);
- /* Now deallocate our new one */
- (void) ioctl(fd, VT_DISALLOCATE, vtno);
-
close (fd);
if (WIFEXITED (status))