Set GID, SHELL

This commit is contained in:
Fierelier 2023-12-11 14:30:49 +01:00
parent 94b3887891
commit ec3b4ffc33
1 changed files with 4 additions and 1 deletions

View File

@ -35,10 +35,12 @@ int main(int argc, char **argv) {
setenv("PATH","/usr/local/bin:/usr/bin:/bin",1);
}
// UID, USER, HOME
// UID, GID, USER, HOME, SHELL
char passwStore[sizeof(struct passwd)];
sprintf(passwStore,"%d",euid);
setenv("UID",passwStore,1);
sprintf(passwStore,"%d",egid);
setenv("GID",passwStore,1);
struct passwd * pw = getpwuid(euid);
if (pw == NULL) {
fprintf(stderr,"["APP_NAME"] Error 253: Failed to get user information (errno: %d: %s)\n",errno,strerror(errno));
@ -46,6 +48,7 @@ int main(int argc, char **argv) {
}
setenv("USER",pw -> pw_name,1);
setenv("HOME",pw -> pw_dir,1);
setenv("SHELL",pw -> pw_shell,1);
// Strip first argument, and move them by 1
char **cmd;