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 627530 - Maintain environment with PAM (with patch)
Maintain environment with PAM (with patch)
Status: RESOLVED FIXED
Product: gdm
Classification: Core
Component: general
2.31.x
Other Linux
: Normal enhancement
: ---
Assigned To: GDM maintainers
GDM maintainers
Depends on:
Blocks:
 
 
Reported: 2010-08-20 19:25 UTC by Tyson Whitehead
Modified: 2011-03-04 18:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to maintain the target environment solely in PAM (6.91 KB, patch)
2010-08-20 19:25 UTC, Tyson Whitehead
none Details | Review
Maintain the target environment solely in PAM (fixed pam_getenv argument and related free issues) (6.75 KB, patch)
2010-08-28 20:02 UTC, Tyson Whitehead
committed Details | Review

Description Tyson Whitehead 2010-08-20 19:25:29 UTC
Created attachment 168431 [details] [review]
Patch to maintain the target environment solely in PAM

This patch gets gdm-session-worker to build the target environment using the pam_env* functions instead of in a g_hash_table.  This was suggested in a comment in the gdm_session_worker_set_environment

  /* FIXME: maybe we should use use pam_putenv instead of our
   * own hash table, so pam can override our choices if it knows
   * better?
   */

As comment says, the advantage is it gives PAM access to the environment.

Note that this isn't currently as useful as it could be because gdm-simple-slave sends nearly all of the environment variables right at the very end.  It would be nice if it would send them as soon as their value was established.

For environment variables set after (at least some of) PAM has run, it might also be nice to have gdm-simple-slave pass along a default flag to tell gdm-session-worker whether it should override a PAM setting or not.

Nonetheless, it is an improvement on the current situation as at least PAM gets access to some of the environment variables, and a necessary step in any further work to this regard.

Cheers!  -Tyson

PS:  This is an update of the patch (so it applies against HEAD) for the one I sent back in March to the mail list.
Comment 1 Brian Cameron 2010-08-20 21:55:13 UTC
Looks sensible to me.
Comment 2 Tyson Whitehead 2010-08-28 20:02:06 UTC
Created attachment 168960 [details] [review]
Maintain the target environment solely in PAM (fixed pam_getenv argument and related free issues)

Turns out there was a bug in that first patch.  I had accidentally passed the wrong variable to pam_getenv, which was also masking two freeing issues.

Please find attached an updated patch.

Cheers!  -Tyson
Comment 3 Ray Strode [halfline] 2010-09-15 18:22:40 UTC
I definitely appreciate the time that went into this patch. It's a useful contribution and we should consider pushing it.  I am a little hesitant to push it without it fixing a problem in a specific PAM module though.  This area of the code is a bit finicky and I'm worried a change here could potentially break existing setups.

My thoughts are we hold off for now, but add a comment to the code pointing to this bug.  If there's a problem in the future then we land the patch.

We couldn't potentially land it sooner, but probably not for 2.32 since we're already at code freeze after the up coming release.
Comment 4 Tyson Whitehead 2010-09-15 20:34:57 UTC
Thanks for looking at this Ray and Brian.

I don't know if it is strictly required by any PAM modules, but it can be quite useful in conjunction with the pam_env module.

Specifically, in our system, due to some interactions between ssh and pam_mount, we used pam_env to override/provide early defaults for some environment variables.

This caused problems with GDM maintaining a separate environment.

Cheers!  -Tyson
Comment 5 Ray Strode [halfline] 2010-09-23 21:14:59 UTC
Comment on attachment 168960 [details] [review]
Maintain the target environment solely in PAM (fixed pam_getenv argument and related free issues)

alright, let's land this after free.  There's a few spacing issues we make sure we mop up before committing this though.
Comment 6 André Klapper 2011-01-22 14:15:03 UTC
(In reply to comment #5)
> (From update of attachment 168960 [details] [review])
> alright, let's land this after free.  There's a few spacing issues we make sure
> we mop up before committing this though.

Ping - as the patch has the status "accepted-commit_after_freeze", can this get a commit now in either gtk3 or master or both, please?
Comment 7 André Klapper 2011-03-04 12:06:05 UTC
(In reply to comment #5)
> (From update of attachment 168960 [details] [review] [details])
> alright, let's land this after free.  There's a few spacing issues we make sure
> we mop up before committing this though.

Ping - as the patch has the status "accepted-commit_after_freeze", can this get
a commit now in either gtk3 or master or both, please?
Comment 8 Ray Strode [halfline] 2011-03-04 18:34:33 UTC
Comment on attachment 168960 [details] [review]
Maintain the target environment solely in PAM (fixed pam_getenv argument and related free issues)

In now.