diff options
author | Dave Olson <olson@cumulusnetworks.com> | 2017-06-21 20:00:05 -0700 |
---|---|---|
committer | Dave Olson <olson@cumulusnetworks.com> | 2017-06-21 20:00:05 -0700 |
commit | 061334771b143b7f47caccba8525be6e041a252f (patch) | |
tree | 20d8460b8cd1abfad513a3c3dcb661046d067522 /pam_script_ses_open | |
parent | 5c6df6ac03f04f195c6f3bb9fe8b1725428de129 (diff) | |
download | libnss-mapuser-061334771b143b7f47caccba8525be6e041a252f.tar.gz libnss-mapuser-061334771b143b7f47caccba8525be6e041a252f.zip |
Fix problem with sudo, su, etc. in pam_script scripts
The flat file was overwritten on su, sudo, etc. Fixed that.
The flat file was removed on exit from su, sudo, etc. I've
temporarily worked around that by not cleaning up. Need to do
a better job, but this will let testing continue.
Diffstat (limited to 'pam_script_ses_open')
-rwxr-xr-x | pam_script_ses_open | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pam_script_ses_open b/pam_script_ses_open index 6bdf57e..731e250 100755 --- a/pam_script_ses_open +++ b/pam_script_ses_open @@ -54,7 +54,10 @@ fi hdir=$(eval echo ~$PAM_USER) [ -d "$hdir" ] || /sbin/mkhomedir_helper $PAM_USER -date +"%FT%T.%N%nuser=$PAM_USER%npid=$$%nauid=$auid%nsession=$sess%nhome=$hdir" \ +# don't overwrite if it already exists. Happens when sudo or su +# is run from an existing mapped session. +[ -s $dbdir/$sess ] || \ + date +"%FT%T.%N%nuser=$PAM_USER%npid=$$%nauid=$auid%nsession=$sess%nhome=$hdir" \ > $dbdir/$sess # always succeed, this should not block sessions on errors |