diff options
Diffstat (limited to 'src/login.c')
-rw-r--r-- | src/login.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/login.c b/src/login.c index 5a97fb6..46bf4e2 100644 --- a/src/login.c +++ b/src/login.c @@ -33,6 +33,27 @@ extern char** environ; /** + * Set the user gid and uid + * + * @param entry The user entry in the password file + */ +void set_user(struct passwd* entry) +{ + if (setgid(entry->pw_gid) && entry->pw_gid) + { + perror("setgid"); + _exit(1); + } + + if (setuid(entry->pw_uid) && entry->pw_uid) + { + perror("setuid"); + _exit(1); + } +} + + +/** * Change directory to the user's home directory * * @param entry The user entry in the password file |