Commit 360ab4ae authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

use $HOME/.face by default

Mon Jun 09 17:01:27 2003  George Lebl <jirka@5z.com>

	* daemon/slave.c, gui/gdmphotosetup.c: use $HOME/.face by default

	* daemon/slave.c: when no home dir, try /tmp as the home and not /

	* config/*, daemon/gdm.[ch], gui/gdmlogin.c,
	  gui/greeter/greeter.c, gui/greeter/greeter_action_language.c,
	  gui/greeter/greeter_configuration.h,
	  gui/greeter/greeter_session.[ch]:  Rework the session setup as
	  discussed with Oswald Buddenhagen, the kdm maintainer.   Now the
	  sessions are .desktop files and we have one happy Xsession file
	  which parses that .desktop file and runs the appropriate command.
	  Also store preferences such as last session and language in .dmrc.
	  The session desktops are now in /etc/X11/dm/Sessions since they can
	  be shared by kdm as well in the future.  The setup needs a bit
	  more tuning I think and it's not all tested.
parent 321b5a36
Mon Jun 09 17:01:27 2003 George Lebl <jirka@5z.com>
* daemon/slave.c, gui/gdmphotosetup.c: use $HOME/.face by default
* daemon/slave.c: when no home dir, try /tmp as the home and not /
* config/*, daemon/gdm.[ch], gui/gdmlogin.c,
gui/greeter/greeter.c, gui/greeter/greeter_action_language.c,
gui/greeter/greeter_configuration.h,
gui/greeter/greeter_session.[ch]: Rework the session setup as
discussed with Oswald Buddenhagen, the kdm maintainer. Now the
sessions are .desktop files and we have one happy Xsession file
which parses that .desktop file and runs the appropriate command.
Also store preferences such as last session and language in .dmrc.
The session desktops are now in /etc/X11/dm/Sessions since they can
be shared by kdm as well in the future. The setup needs a bit
more tuning I think and it's not all tested.
Mon Jun 09 Brian Cameron <Brian.Cameron@Sun.COM>
* gui/modules/keymouselistener.c: Fixed bug that caused the
......
#!/bin/sh
#
# Distributors:
# You should modify the paths here to fit your distro
# If you need to do so, send me (jirka@5z.com) a patch
# and I'll try to make the script detect the distro stuff
#
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
userxkbmap=$HOME/.Xkbmap
sysresources=/etc/X11/Xresources
sysmodmap=/etc/X11/Xmodmap
sysxkbmap=/etc/X11/Xkbmap
rh6sysresources=/etc/X11/xinit/Xresources
rh6sysmodmap=/etc/X11/xinit/Xmodmap
if [ -x "$HOME/.gnomerc" ]; then
command="$HOME/.gnomerc"
elif [ -x @EXPANDED_SYSCONFDIR@/gdm/gnomerc ]; then
command="@EXPANDED_SYSCONFDIR@/gdm/gnomerc"
else
# as fallback in case the config is screwed
command=`which gnome-session`
fi
sshagent=`which ssh-agent`
if [ -n "$sshagent" ] && [ -x "$sshagent" ] && [ -z "$SSH_AUTH_SOCK" ]; then
command="$sshagent -- $command"
fi
# merge in defaults
if [ -f "$rh6sysresources" ]; then
xrdb -merge "$rh6sysresources"
fi
if [ -f "$sysresources" ]; then
xrdb -merge "$sysresources"
fi
if [ -f "$userresources" ]; then
xrdb -merge "$userresources"
fi
# merge in keymaps
if [ -f "$sysxkbmap" ]; then
setxkbmap `cat "$sysxkbmap"`
XKB_IN_USE=yes
fi
if [ -f "$userxkbmap" ]; then
setxkbmap `cat "$userxkbmap"`
XKB_IN_USE=yes
fi
#
# Eeek, this seems like too much magic here
#
if [ -z "$XKB_IN_USE" ] && [ ! -L /etc/X11/X ]; then
if grep '^exec.*/Xsun' /etc/X11/X > /dev/null 2>&1 && [ -f /etc/X11/XF86Config ]; then
xkbsymbols=`sed -n -e 's/^[ ]*XkbSymbols[ ]*"\(.*\)".*$/\1/p' /etc/X11/XF86Config`
if [ -n "$xkbsymbols" ]; then
setxkbmap -symbols "$xkbsymbols"
XKB_IN_USE=yes
fi
fi
fi
# xkb and xmodmap don't play nice together
if [ -z "$XKB_IN_USE" ]; then
if [ -f "$rh6sysmodmap" ]; then
xmodmap "$rh6sysmodmap"
fi
if [ -f "$sysmodmap" ]; then
xmodmap "$sysmodmap"
fi
if [ -f "$usermodmap" ]; then
xmodmap "$usermodmap"
fi
fi
unset XKB_IN_USE
# Normalize languages, some places/distros screw us up in /etc/profile,
# so in case the user did select a language
if [ -n "$GDM_LANG" ]; then
LANG=$GDM_LANG
export LANG
if [ -n "$LC_ALL" ]; then
if [ "$LC_ALL" != "$LANG" ]; then
LC_ALL=$LANG
fi
else
unset LC_ALL
fi
if [ -n "$LANGUAGE" ]; then
if [ "$LANGUAGE" != "$LANG" ]; then
LANGUAGE=$LANG
fi
else
unset LANGUAGE
fi
if [ -n "$LINGUAS" ]; then
if [ "$LINGUAS" != "$LANG" ]; then
LINGUAS=$LANG
fi
else
unset LINGUAS
fi
fi
# run all system xinitrc shell scripts.
if [ -d /etc/X11/xinit/xinitrc.d ]; then
for i in /etc/X11/xinit/xinitrc.d/* ; do
if [ -x "$i" ]; then
. "$i"
fi
done
fi
exec $command
pixmapdir = $(datadIR)/pixmaps
confdir = $(sysconfdir)/gdm
localedir = $(sysconfdir)/gdm
sessdir = $(sysconfdir)/gdm/Sessions
sessdir = $(sysconfdir)/dm/Sessions
initdir = $(sysconfdir)/gdm/Init
authdir = $(localstatedir)/gdm
gnomercdir = $(sysconfdir)/gdm
......@@ -14,15 +14,15 @@ noinst_DATA = gdm.conf
EXTRA_DIST = \
gdm.conf.in \
Gnome.in \
gnomerc.in \
gnome.desktop.in \
Xclients.desktop.in \
Xsession.in \
gdm \
gdm-autologin \
locale.alias \
Default \
PostSession \
PreSession \
Default.in \
PostSession.in \
PreSession.in \
PostLogin \
XKeepsCrashing \
gettextfoo.h \
......@@ -31,7 +31,9 @@ EXTRA_DIST = \
gettextfoo.h: XKeepsCrashing
cat $^ | $(srcdir)/extract-shell.sh > gettextfoo.h
install-data-hook: gdm.conf gnomerc Gnome Xsession
@INTLTOOL_DESKTOP_RULE@
install-data-hook: gdm.conf Xsession gnome.desktop Xclients.desktop Default PostSession PreSession
if test '!' -d $(DESTDIR)$(confdir); then \
$(mkinstalldirs) $(DESTDIR)$(confdir); \
chmod 755 $(DESTDIR)$(confdir); \
......@@ -46,6 +48,7 @@ install-data-hook: gdm.conf gnomerc Gnome Xsession
$(INSTALL_DATA) gdm.conf $(DESTDIR)$(confdir)/factory-gdm.conf
$(INSTALL_SCRIPT) $(srcdir)/XKeepsCrashing $(DESTDIR)$(confdir)/XKeepsCrashing
$(INSTALL_SCRIPT) $(srcdir)/Xsession $(DESTDIR)$(confdir)/Xsession
-if test -f $(DESTDIR)$(localedir)/locale.alias; then \
cp -f $(DESTDIR)$(localedir)/locale.alias $(DESTDIR)$(localedir)/locale.alias.orig; \
......@@ -57,22 +60,15 @@ install-data-hook: gdm.conf gnomerc Gnome Xsession
chmod 755 $(DESTDIR)$(sessdir); \
fi
-if test -f $(DESTDIR)$(sessdir)/Xsession; then \
cp -f $(DESTDIR)$(sessdir)/Xsession $(DESTDIR)$(sessdir)/Xsession.orig; \
fi
$(INSTALL_SCRIPT) Xsession $(DESTDIR)$(sessdir)/Xsession
-if test -f $(DESTDIR)$(sessdir)/Gnome; then \
cp -f $(DESTDIR)$(sessdir)/Gnome $(DESTDIR)$(sessdir)/Gnome.orig; \
-if test -f $(DESTDIR)$(sessdir)/Xclients.desktop; then \
cp -f $(DESTDIR)$(sessdir)/Xclients.desktop $(DESTDIR)$(sessdir)/Xclients.orig; \
fi
$(INSTALL_SCRIPT) Gnome $(DESTDIR)$(sessdir)/Gnome
$(INSTALL_SCRIPT) Xclients.desktop $(DESTDIR)$(sessdir)/Xclients.desktop
-if test -f /usr/bin/switchdesk; then \
if test -f $(DESTDIR)$(sessdir)/Default; then \
cp -f $(DESTDIR)$(sessdir)/Default $(DESTDIR)$(sessdir)/Default.orig; \
fi; \
$(LN_S) -f Xsession $(DESTDIR)$(sessdir)/Default; \
-if test -f $(DESTDIR)$(sessdir)/gnome.desktop; then \
cp -f $(DESTDIR)$(sessdir)/gnome.desktop $(DESTDIR)$(sessdir)/gnome.orig; \
fi
$(INSTALL_SCRIPT) gnome.desktop $(DESTDIR)$(sessdir)/gnome.desktop
if test '!' -d $(DESTDIR)$(initdir); then \
$(mkinstalldirs) $(DESTDIR)$(initdir); \
......@@ -112,11 +108,6 @@ install-data-hook: gdm.conf gnomerc Gnome Xsession
chmod 755 $(DESTDIR)$(gnomercdir); \
fi
-if test -f $(DESTDIR)$(gnomercdir)/gnomerc; then \
cp -f $(DESTDIR)$(gnomercdir)/gnomerc $(DESTDIR)$(gnomercdir)/gnomerc.orig; \
fi
$(INSTALL_SCRIPT) gnomerc $(DESTDIR)$(gnomercdir)/gnomerc
if test '!' -d $(DESTDIR)$(authdir); then \
$(mkinstalldirs) $(DESTDIR)$(authdir); \
chown gdm.gdm $(DESTDIR)$(authdir); \
......
[Desktop Entry]
Encoding=UTF-8
# The names/descriptions should really be better
_Name=Standard Xclients
_Comment=This is the standard Xclients session
Exec=Xclients
# The Xclients Exec is a very special one and is handled specially in
# the Xsession script
Icon=
Type=Application
#!/bin/sh
#
# Note that this is SORT OF LIKE an X session, but not quite. You get a
# .desktop file as the first argument. You must here then parse the
# Exec= line out of this file and use that.
# As a special case, the Exec line can be:
# failsafe - Run an xterm only
# Xclients - Run the appropriate Xclients startup (see the code below)
#
# You should also handle an argument of 'failsafe'
#
# Note that output is ALREADY redirected to .xsession-errors in GDM. This way
# .xsession-errors actually gets more output such as if the PreSession script
# is failing. We wish to be robust don't we?
#
# Also note that this is not run as a login shell, this is just executed.
# This is why we source the profile files below.
#
# based on:
# $XConsortium: Xsession /main/10 1995/12/18 18:21:28 gildea $
case $# in
1)
case $1 in
failsafe)
exec xterm -geometry 80x24+0+0
;;
esac
esac
# First read /etc/profile and .profile
test -f /etc/profile && . /etc/profile
test -f $HOME/.profile && . $HOME/.profile
# Second read /etc/xprofile and .xprofile for X specific setup
test -f /etc/xprofile && . /etc/xprofile
test -f $HOME/.xprofile && . $HOME/.xprofile
zenity=`which zenity`
command=
if [ -z "$1" ] || [ x"$1" = xfailsafe ] ; then
command=failsafe
else
# Here we parse the .desktop file
command=`grep 'Exec=' "$1" | sed 's/^Exec=//'`
fi
if [ -z "$command" ] ; then
command=failsafe
fi
if [ x"$command" = xfailsafe ] ; then
if [ -n "$zenity" ] ; then
$zenity --info --text "This is the failsafe xterm session. Windows now have focus only if you have your cursor above them. To get out of this mode type \"exit\" in the window in the upper left corner"
fi
exec xterm -geometry 80x24+0+0
fi
# Note: ~/.xsession-errors is now done in the daemon so that it
# works for ALL sessions (except ones named 'Failsafe')
......@@ -18,8 +55,6 @@ if which freetemp 2> /dev/null ; then
freetemp
fi
startup=$HOME/.xsession
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
userxkbmap=$HOME/.Xkbmap
......@@ -126,56 +161,30 @@ if [ -d /etc/X11/xinit/xinitrc.d ]; then
done
fi
# now, we see if xdm/gdm/kdm has asked for a specific environment
case $# in
1)
if [ -x "/usr/share/apps/switchdesk/Xclients.$1" ]; then
exec /bin/sh "/usr/share/apps/switchdesk/Xclients.$1";
fi;
case $1 in
failsafe)
exec xterm -geometry 80x24+0+0
;;
gnome)
exec -l $SHELL -c "gnome-session"
if [ -x "$HOME/.gnomerc" ]; then
exec $HOME/.gnomerc
elif [ -x @EXPANDED_SYSCONFDIR@/gdm/gnomerc ]; then
exec @EXPANDED_SYSCONFDIR@/gdm/gnomerc
else
# as fallback in case the config is screwed
exec gnome-session
fi
;;
kde|kde1|kde2)
if [ -x "/usr/share/apps/switchdesk/Xclients.kde" ]; then
exec "/usr/share/apps/switchdesk/Xclients.kde"
else
#fallback for non-redhat
exec startkde
fi
;;
twm)
# fall back to twm
if [ -x "/usr/share/apps/switchdesk/Xclients.twm" ]; then
exec "/usr/share/apps/switchdesk/Xclients.twm"
else
#fallback for non-redhat
exec twm
fi
;;
esac
esac
if [ -x "$startup" ]; then
exec "$startup"
elif [ -x "$HOME/.Xclients" ]; then
exec "$HOME/.Xclients"
elif [ -x /etc/X11/xinit/Xclients ]; then
exec /etc/X11/xinit/Xclients
elif [ -x /etc/X11/Xclients ]; then
exec /etc/X11/Xclients
else
exec xsm
if [ "x$command" = "xXclients" ] ; then
if [ -x "$HOME/.Xclients" ]; then
command="$HOME/.Xclients"
elif [ -x /etc/X11/xinit/Xclients ]; then
command="/etc/X11/xinit/Xclients"
elif [ -x /etc/X11/Xclients ]; then
command="/etc/X11/Xclients"
else
echo "Cannot find Xclients"
fi
fi
# add ssh-agent if found
sshagent=`which ssh-agent`
if [ -n "$sshagent" ] && [ -x "$sshagent" ] && [ -z "$SSH_AUTH_SOCK" ]; then
command="$sshagent -- $command"
fi
exec $command
echo "Executing: $command failed, will run xterm"
if [ -n "$zenity" ] ; then
$zenity --info --text "I could not start your session and so I have started the failsafe xterm session. Windows now have focus only if you have your cursor above them. To get out of this mode type \"exit\" in the window in the upper left corner"
fi
exec xterm -geometry 80x24+0+0
......@@ -33,7 +33,6 @@ AlwaysRestartServer=true
# The gdm configuration program that is run from the login screen, you should
# probably leave this alone
Configurator=@EXPANDED_GDMCONFIGDIR@/gdmsetup --disable-sound --disable-crash-dialog
GnomeDefaultSession=@EXPANDED_DATADIR@/gnome/default.session
# The chooser program. Must output the chosen host on stdout, probably you
# should leave this alone
Chooser=@EXPANDED_BINDIR@/gdmchooser
......@@ -86,7 +85,14 @@ HaltCommand=/usr/bin/poweroff;/sbin/poweroff;/sbin/shutdown -h now;/usr/sbin/shu
SuspendCommand=
# Probably should not touch the below this is the standard setup
ServAuthDir=@EXPANDED_AUTHDIR@
SessionDir=@EXPANDED_SYSCONFDIR@/gdm/Sessions/
# This is our standard startup script. A bit different from a normal
# X session, but it shares a lot of stuff with that. See the provided
# default for more information.
BaseXsession=@EXPANDED_SYSCONFDIR@/gdm/Xsession
# This is a directory where .desktop files describing the sessions live
SessionDesktopDir=@EXPANDED_SYSCONFDIR@/dm/Sessions/
# This is the default .desktop session. One of the ones in SessionDesktopDir
DefaultSession=gnome.desktop
# Better leave this blank and HOME will be used. You can use syntax ~/ below
# to indicate home directory of the user
UserAuthDir=
......@@ -257,8 +263,6 @@ BackgroundProgram=
# if this is true then the background program is run always, otherwise
# it is only run when the BackgroundType is 0 (None)
RunBackgroundProgramAlways=false
# Show the chooser (you can choose a specific saved gnome session) session
ShowGnomeChooserSession=true
# Show the Failsafe sessions. These are much MUCH nicer (focus for xterm for
# example) and more failsafe then those supplied by scripts so distros should
# use this rather then just running an xterm from a script.
......
[Desktop Entry]
Encoding=UTF-8
_Name=GNOME
_Comment=This session logs you into GNOME
Exec=gnome-session
# no icon yet, only the top three are currently used
Icon=
Type=Application
#!/bin/sh
# Do we have gnome-volume-control?
# If so we should run it to load the gnome-volume-control settings
#if command -v gnome-volume-control > /dev/null 2>&1; then
# gnome-volume-control -i
#elif [ -x @EXPANDED_BINDIR@/gnome-volume-control ] ; then
# @EXPANDED_BINDIR@/gnome-volume-control -i
#fi
# path takes precedence
exec gnome-session
exec @EXPANDED_BINDIR@/gnome-session
......@@ -102,8 +102,12 @@ int gdm_in_signal = 0;
gchar *GdmUser = NULL;
gchar *GdmGroup = NULL;
gchar *GdmSessDir = NULL;
gchar *GdmXsession = NULL;
gchar *GdmLocaleFile = NULL;
#if 0
/* FIXME: Maybe just whack this */
gchar *GdmGnomeDefaultSession = NULL;
#endif
gchar *GdmAutomaticLogin = NULL;
gboolean GdmAutomaticLoginEnable = FALSE;
gboolean GdmAlwaysRestartServer = FALSE;
......@@ -270,9 +274,13 @@ gdm_config_parse (void)
GdmRootPath = gnome_config_get_string (GDM_KEY_ROOTPATH);
GdmServAuthDir = gnome_config_get_string (GDM_KEY_SERVAUTH);
GdmSessDir = gnome_config_get_string (GDM_KEY_SESSDIR);
GdmXsession = gnome_config_get_string (GDM_KEY_BASEXSESSION);
GdmSuspend = gnome_config_get_string (GDM_KEY_SUSPEND);
GdmLocaleFile = gnome_config_get_string (GDM_KEY_LOCFILE);
#if 0
/* FIXME: Maybe just whack this */
GdmGnomeDefaultSession = gnome_config_get_string (GDM_KEY_GNOMEDEFAULTSESSION);
#endif
GdmUser = gnome_config_get_string (GDM_KEY_USER);
GdmUserAuthDir = gnome_config_get_string (GDM_KEY_UAUTHDIR);
GdmUserAuthFile = gnome_config_get_string (GDM_KEY_UAUTHFILE);
......
......@@ -89,9 +89,12 @@ enum {
#define GDM_SLANG 'R'
#define GDM_RESET 'A'
#define GDM_QUIT 'P'
/* Well these aren't as nice as above, oh well */
#if 0
/* FIXME: Maybe just whack this */
#define GDM_GNOMESESS '?'
#define GDM_SGNOMESESS '*'
#endif
/* Well these aren't as nice as above, oh well */
#define GDM_STARTTIMER 's'
#define GDM_STOPTIMER 'S'
#define GDM_SETLOGIN 'l' /* this just sets the login to be this, just for
......@@ -145,9 +148,14 @@ enum {
#define GDM_KEY_XKEEPSCRASHING "daemon/XKeepsCrashing=" EXPANDED_SYSCONFDIR "/gdm/XKeepsCrashing"
#define GDM_KEY_REBOOT "daemon/RebootCommand=/usr/bin/reboot;/sbin/reboot;/sbin/shutdown -r now;/usr/sbin/shutdown -r now"
#define GDM_KEY_ROOTPATH "daemon/RootPath=/sbin:/usr/sbin:/bin:/usr/bin:/usr/bin/X11:/usr/local/bin:" EXPANDED_BINDIR
#if 0
/* FIXME: Maybe just whack this */
#define GDM_KEY_GNOMEDEFAULTSESSION "daemon/GnomeDefaultSession=" EXPANDED_DATADIR "/gnome/default.session"
#endif
#define GDM_KEY_SERVAUTH "daemon/ServAuthDir=" EXPANDED_AUTHDIR
#define GDM_KEY_SESSDIR "daemon/SessionDir=" EXPANDED_SYSCONFDIR "/gdm/Sessions/"
#define GDM_KEY_SESSDIR "daemon/SessionDesktopDir=" EXPANDED_SYSCONFDIR "/dm/Sessions/"
#define GDM_KEY_BASEXSESSION "daemon/BaseXsession=" EXPANDED_SYSCONFDIR "/gdm/Xsession"
#define GDM_KEY_DEFAULTSESSION "daemon/DefaultSession=gnome.desktop"
#define GDM_KEY_SUSPEND "daemon/SuspendCommand="
#define GDM_KEY_UAUTHDIR "daemon/UserAuthDir="
......@@ -251,14 +259,20 @@ enum {
#define GDM_KEY_SERVERS "servers"
#if 0
/* FIXME: Maybe just whack this */
#define GDM_KEY_SHOW_GNOME_CHOOSER "greeter/ShowGnomeChooserSession=true"
#endif
#define GDM_KEY_SHOW_GNOME_FAILSAFE "greeter/ShowGnomeFailsafeSession=true"
#define GDM_KEY_SHOW_XTERM_FAILSAFE "greeter/ShowXtermFailsafeSession=true"
#define GDM_KEY_SHOW_LAST_SESSION "greeter/ShowLastSession=true"
#define GDM_SESSION_FAILSAFE_GNOME "GDM_Failsafe.GNOME"
#define GDM_SESSION_FAILSAFE_XTERM "GDM_Failsafe.XTERM"
#if 0
/* FIXME: Maybe just whack this */
#define GDM_SESSION_GNOME_CHOOSER "Gnome Chooser"
#endif
#define GDM_STANDARD "Standard"
......
......@@ -106,8 +106,13 @@ extern int gdm_normal_runlevel;
extern gchar *GdmUser;
extern uid_t GdmUserId;
extern gid_t GdmGroupId;
#if 0
/* FIXME: Maybe just whack this */
extern gchar *GdmGnomeDefaultSession;
#endif
extern gchar *GdmSessDir;
extern gchar *GdmXsession;
extern gchar *GdmDefaultSession;
extern gchar *GdmLocaleFile;
extern gchar *GdmAutomaticLogin;
extern gboolean GdmAllowRemoteAutoLogin;
......@@ -1332,7 +1337,25 @@ run_pictures (void)
}
g_free (cfgdir);
/* Nothing found yet */
if (picfile == NULL) {
picfile = g_strconcat (pwent->pw_dir, "/.face", NULL);
if (access (picfile, R_OK) != 0) {
g_free (picfile);
picfile = NULL;
} else if ( ! gdm_file_check ("run_pictures", pwent->pw_uid,
pwent->pw_dir, ".face", TRUE, TRUE, GdmUserMaxFile,
GdmRelaxPerms)) {
g_free (picfile);
seteuid (0);
setegid (GdmGroupId);
gdm_slave_greeter_ctl_no_ret (GDM_READPIC, "");
continue;
}
}
/* Nothing found yet, try the old location */
if (picfile == NULL) {
picfile = g_strconcat (pwent->pw_dir, "/.gnome2/photo", NULL);
picdir = g_strconcat (pwent->pw_dir, "/.gnome2", NULL);
......@@ -2025,6 +2048,8 @@ gdm_slave_chooser (void)
}
}
#if 0
/* FIXME: Maybe just whack this */
static void
read_sessions (FILE *fp, GString *sessions, const char *def, gboolean *got_def)
{
......@@ -2145,6 +2170,7 @@ gdm_get_sessions (struct passwd *pwent)
return ret;
}
}
#endif
static gboolean
is_session_ok (const char *session_name)
......@@ -2160,7 +2186,7 @@ is_session_ok (const char *session_name)
return FALSE;
file = g_strconcat (GdmSessDir, "/", session_name, NULL);
if (access (file, X_OK) == 0) {
if (access (file, F_OK) == 0) {
g_free (file);
return TRUE;
}
......@@ -2172,14 +2198,14 @@ static char *
find_a_session (void)
{
char *try[] = {
"Gnome",
"gnome",
"GNOME",
"Default",
"default",
"Xsession",
"Failsafe",
"failsafe",
"Xclients.desktop",
"Gnome.desktop",
"gnome.desktop",
"GNOME.desktop",
"kde.desktop",
"KDE.desktop",
"failsafe.desktop",
"Failsafe.desktop",
NULL
};
int i;
......@@ -2193,6 +2219,21 @@ find_a_session (void)
return session;
}
static char *
get_session_exec (const char *desktop)
{
char *file;
VeConfig *cfg;
char *exec;
file = g_strconcat (GdmSessDir, "/", desktop, NULL);
cfg = ve_config_new (file);
g_free (file);
exec = ve_config_get_string (cfg, "Desktop Entry/Exec");
ve_config_destroy (cfg);
return exec;
}
static char *
find_prog (const char *name, const char *args, char **retpath)
{
......@@ -2205,6 +2246,7 @@ find_prog (const char *name, const char *args, char **retpath)
"/opt/X11R6/bin/",
"/usr/bin/",
"/usr/local/bin/",
"/opt/gnome/bin/",
EXPANDED_BINDIR "/",
NULL
};
......@@ -2230,27 +2272,6 @@ find_prog (const char *name, const char *args, char **retpath)
return NULL;
}
static char *
dequote (const char *in)
{
GString *str;
char *out;
const char *p;
str = g_string_new (NULL);
for (p = in; *p != '\0'; p++) {
if (*p == '\'')
g_string_append (str, "'\\''");
else
g_string_append_c (str, *p);
}
out = str->str;
g_string_free (str, FALSE);
return out;
}
static void
session_child_run (struct passwd *pwent,
const char *home_dir,
......@@ -2262,15 +2283,17 @@ session_child_run (struct passwd *pwent,
gboolean usrcfgok,
gboolean savesess,
gboolean savelang,
gboolean sessoptok,
gboolean savegnomesess)
{
int logfd;
gboolean failsafe = FALSE;
char *sesspath, *sessexec;
gboolean need_config_sync = FALSE;
char *exec;
const char *shell = NULL;
VeConfig *dmrc = NULL;
Display *disp;
int argc;
char **argv;
gdm_unset_signals ();
......@@ -2297,7 +2320,8 @@ session_child_run (struct passwd *pwent,
if (strcmp (session, GDM_SESSION_FAILSAFE_GNOME) == 0 ||
strcmp (session, GDM_SESSION_FAILSAFE_XTERM) == 0 ||
/* hack */
g_ascii_strcasecmp (session, "Failsafe") == 0) {
g_ascii_strcasecmp (session, "Failsafe") == 0 ||
g_ascii_strcasecmp (session, "Failsafe.desktop") == 0) {
failsafe = TRUE;
}
......@@ -2314,12 +2338,10 @@ session_child_run (struct passwd *pwent,
uid_t old = geteuid ();
uid_t oldg = getegid ();
/* unlink the filename to be anal (as root to get rid of
* possible old versions with root ownership) */
unlink (filename);
setegid (pwent->pw_gid);
seteuid (pwent->pw_uid);
/* unlink to be anal */
unlink (filename);
logfd = open (filename, O_CREAT|O_TRUNC|O_WRONLY, 0644);
seteuid (old);
setegid (oldg);
......@@ -2442,27 +2464,38 @@ session_child_run (struct passwd *pwent,
/* anality, make sure nothing is in memory for gnome_config
* to write */
gnome_config_drop_all ();
if (usrcfgok && savesess && home_dir_ok) {
gchar *cfgstr = g_strconcat ("=", home_dir,
"/.gnome2/gdm=/session/last", NULL);
gnome_config_set_string (cfgstr, save_session);
need_config_sync = TRUE;
gchar *cfgstr = g_strconcat (home_dir, "/.dmrc", NULL);
if (dmrc == NULL)
dmrc = ve_config_new (cfgstr);
ve_config_set_string (dmrc, "Desktop/Session",
ve_sure_string (save_session));
g_free (cfgstr);
}
if (usrcfgok && savelang && home_dir_ok) {
gchar *cfgstr = g_strconcat ("=", home_dir,
"/.gnome2/gdm=/session/lang", NULL);
/* we chose the system default language so wipe the lang key */
gchar *cfgstr = g_strconcat (home_dir, "/.dmrc", NULL);
if (dmrc == NULL)
dmrc = ve_config_new (cfgstr);
if (ve_string_empty (language))
gnome_config_clean_key (cfgstr);
/* we chose the system default language so wipe the
* lang key */
ve_config_delete_key (dmrc, "Desktop/Language");
else
gnome_config_set_string (cfgstr, language);
need_config_sync = TRUE;
ve_config_set_string (dmrc, "Desktop/Language",
language);