This repository has been archived by the owner on Dec 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a bug with PCDM where the PAM session isn't closed fully at logout,
this fixes and issue with PEFS not removing homedir keys. The file /usr/local/share/PCDM/pcdm-session is now used to drop priv and execute the target desktop at login, leaving the parent PCDM process running as root and able to do cleanup.
- Loading branch information
Kris Moore
committed
May 8, 2014
1 parent
3ff724e
commit fb13c77
Showing
4 changed files
with
102 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
Name: pcdm-session | ||
Desc: Small executable to drop priv and execute the desktop | ||
License: BSD (2 Clause) | ||
Author: Kris Moore | ||
*/ | ||
#include <sys/param.h> | ||
#include <sys/types.h> | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include <unistd.h> | ||
|
||
int main(int argc, char ** argv) | ||
{ | ||
|
||
// Load the CLI args | ||
uid_t my_gid; | ||
uid_t my_uid; | ||
char username[MAXPATHLEN]; | ||
char cmd[MAXPATHLEN]; | ||
char xcmd[MAXPATHLEN]; | ||
char xlog[MAXPATHLEN]; | ||
if ( argc != 6 ) { | ||
exit(1); | ||
} | ||
|
||
char output[MAXPATHLEN]; | ||
|
||
// Set our values | ||
strcpy(username, argv[1]); | ||
my_uid = atoi(argv[2]); | ||
my_gid = atoi(argv[3]); | ||
strcpy(xcmd, argv[4]); | ||
strcpy(xlog, argv[5]); | ||
|
||
// Set the GID | ||
if (setgid(my_gid) < 0) { | ||
exit(1); | ||
} | ||
|
||
// Setup our other groups | ||
if (initgroups(username, my_gid) < 0) { | ||
exit(1); | ||
} | ||
|
||
// Lets drop to user privs | ||
if (setuid(my_uid) < 0) { | ||
exit(1); | ||
} | ||
|
||
// Run the app now | ||
strcpy(cmd, "sh "); | ||
strcat(cmd, xcmd); | ||
strcat(cmd, " >"); | ||
strcat(cmd, xlog); | ||
strcat(cmd, " 2>"); | ||
strcat(cmd, xlog); | ||
int ret = system(cmd); | ||
exit(ret); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters