After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 677931 - gdm ignores error status of PostLogin scripts and allows login
gdm ignores error status of PostLogin scripts and allows login
Status: RESOLVED FIXED
Product: gdm
Classification: Core
Component: general
3.0.x
Other Linux
: Normal normal
: ---
Assigned To: GDM maintainers
GDM maintainers
Depends on:
Blocks:
 
 
Reported: 2012-06-12 09:38 UTC by Paul van Tilburg
Modified: 2012-09-05 02:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fixes responding to non-zero return codes of PostLogin scripts (3.48 KB, patch)
2012-06-12 09:40 UTC, Paul van Tilburg
needs-work Details | Review
Updated patch to fix responding to non-zero return codes of PostLogin scripts (1.50 KB, patch)
2012-07-03 09:16 UTC, Paul van Tilburg
committed Details | Review
slave: respond to non-zero edit codes of PostLogin (2.06 KB, patch)
2012-09-05 02:01 UTC, Ray Strode [halfline]
committed Details | Review
slave: fix run_script return value confusion (4.02 KB, patch)
2012-09-05 02:01 UTC, Ray Strode [halfline]
committed Details | Review

Description Paul van Tilburg 2012-06-12 09:38:31 UTC
According to the documentation (see http://library.gnome.org/admin/gdm/stable/configuration.html.en#scripting), logins should be aborted if a PostLogin script exits with a non-zero return code.

However, at the moment it doesn't and proceeds with logging the user in.
Comment 1 Paul van Tilburg 2012-06-12 09:40:23 UTC
Created attachment 216183 [details] [review]
Fixes responding to non-zero return codes of PostLogin scripts

This patch applies against GDM 3.0.4.
Comment 2 André Klapper 2012-06-13 15:50:29 UTC
(In reply to comment #1)
> This patch applies against GDM 3.0.4.

Is this still an issue in a supported recent version?
3.0.4 is not supported anymore in upstream - you might want to offer that patch also to your distribution if they still support that version.
Comment 3 Paul van Tilburg 2012-06-13 15:57:36 UTC
Yes, it is still an issue in the 3.4 versions.  I plan to send an updated patch soon.

Do note that the patch only addresses PostLogin exit values (the most important IMO), but not all scripts.
Comment 4 Ray Strode [halfline] 2012-06-25 16:50:42 UTC
Review of attachment 216183 [details] [review]:

Thanks for the patch.  Do you mind getting it working against master?

::: gdm3-3.0.4.orig/daemon/gdm-simple-slave.c
@@ +459,3 @@
 }
 
+static gboolean

I don't think we'll need this in current head since stop_greeter finishes asynchronously, and that second half won't get queued up now if this fails.

@@ +484,3 @@
+        postlogin_script_ran = gdm_slave_run_script (GDM_SLAVE (slave), GDMCONFDIR "/PostLogin", username);
+        g_debug ("GdmSimpleSlave: PostLogin: %d", postlogin_script_ran);
+        if (postlogin_script_ran) {

shouldn't this be if (!postlogin_script_ran) ?
Comment 5 Paul van Tilburg 2012-07-03 09:16:24 UTC
Created attachment 217914 [details] [review]
Updated patch to fix responding to non-zero return codes of PostLogin scripts

We have updated the patch for 3.4.1 and master.  We are running gdm3 3.4.1 under Debian with this patch applied and it works fine.
Comment 6 Paul van Tilburg 2012-07-03 09:18:31 UTC
The only gripe I have with the patch, that if no PostLogin script exists, the call returns an error.

So, at the moment I have renamed /etc/gdm3/PostLogin/Default.sample to Default, although it is empty.
Comment 7 Ray Strode [halfline] 2012-09-05 02:01:10 UTC
The following fixes have been pushed:
e9dd704 slave: respond to non-zero edit codes of PostLogin
63f4990 slave: fix run_script return value confusion
Comment 8 Ray Strode [halfline] 2012-09-05 02:01:15 UTC
Created attachment 223492 [details] [review]
slave: respond to non-zero edit codes of PostLogin

According to the documentation (see
http://library.gnome.org/admin/gdm/stable/configuration.html.en#scripting),
logins should be aborted if a PostLogin script exits with a non-zero
return code.

However, at the moment it doesn't and proceeds with logging the user in.
Comment 9 Ray Strode [halfline] 2012-09-05 02:01:18 UTC
Created attachment 223493 [details] [review]
slave: fix run_script return value confusion

run_script should return TRUE when succeeding and FALSE
when failing.
Comment 10 Ray Strode [halfline] 2012-09-05 02:01:52 UTC
Thanks for the work on this! appreciated.