Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions usr/src/cmd/gui-install/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,9 +545,11 @@ main(int argc, char *argv[])
bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
textdomain(GETTEXT_PACKAGE);
setlocale(LC_ALL,"");
#endif

gui_error_logging_init("gui-install");
gtk_init(&argc, &argv);
g_option_context_add_main_entries(
option_context,
option_entries,
Expand Down
55 changes: 50 additions & 5 deletions usr/src/cmd/gui-install/src/welcome-screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,20 @@

#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <pwd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include "callbacks.h"
#include "installation-profile.h"
#include "interface-globals.h"
#include "window-graphics.h"
#include "welcome-screen.h"
#include "help-dialog.h"

#define XDG_OPEN "/usr/bin/xdg-open"

/*
* Signal handler connected up by Glade XML signal autoconnect
* for the release notes button clicked event.
Expand All @@ -46,19 +53,57 @@ on_releasenotesbutton_clicked(GtkWidget *widget,
{
GError *error = NULL;
gboolean result;
uid_t suid;
int pid;

result = FALSE;
/* The installer will typically be run as root under sudo,
but we don't want to run browser as root */

suid = geteuid();
if (suid == 0) {
char *sudo_uid;

sudo_uid = getenv("SUDO_UID");
if (sudo_uid)
suid = strtol(sudo_uid, (char**)NULL, 10);
}
pid = fork();
if (pid == 0) {
if (suid > 0 && suid != geteuid()) {
struct passwd *pw;

setuid(suid);
pw = getpwuid(suid);
if (pw != NULL) {
if (pw->pw_name != NULL) {
setenv("USERNAME", pw->pw_name, 1);
setenv("LOGNAME", pw->pw_name, 1);
}
if (pw->pw_dir != NULL) {
setenv("HOME", pw->pw_dir, 1);
}
}
}
execl(XDG_OPEN, XDG_OPEN, RELEASENOTESURL, (char *)0);
exit(-1);
} else if (pid > 0) {
int status;

waitpid(pid, &status, 0);
if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
result = TRUE;
}
}

result = gtk_show_uri(gtk_widget_get_screen(widget),
RELEASENOTESURL,
GDK_CURRENT_TIME,
&error);
if (result != TRUE) {
gui_install_prompt_dialog(
FALSE,
FALSE,
FALSE,
GTK_MESSAGE_ERROR,
_("Unable to display release notes"),
error->message);
NULL);
g_error_free(error);
}
return (TRUE);
Expand Down