fix dumb mistake
This commit is contained in:
parent
5612d1adca
commit
5c28fe0531
2 changed files with 2 additions and 24 deletions
|
@ -10,8 +10,8 @@
|
|||
int main() {
|
||||
// Change the root of the process so it doesn't have access to anything else.
|
||||
|
||||
chdir("/opt/djumbai/");
|
||||
if (chroot("/opt/djumbai/") != 0) {
|
||||
chdir("/opt/djumbai");
|
||||
if (chroot("/opt/djumbai") != 0) {
|
||||
perror("chroot /opt/djumbai");
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -10,23 +10,6 @@
|
|||
#include <unistd.h>
|
||||
|
||||
int main() {
|
||||
// Get the UID of the djumbaid user.
|
||||
const char *djumbaid_username = "djumbaid";
|
||||
|
||||
struct passwd *pw = getpwnam(djumbaid_username);
|
||||
if (pw == NULL) {
|
||||
fprintf(stderr, "User %s not found\n", djumbaid_username);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
//Store previous UID
|
||||
uid_t original_euid = geteuid();
|
||||
// Set UID to djumbaid
|
||||
if (seteuid(pw->pw_uid) == -1) {
|
||||
perror("setuid");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
chdir("/opt/djumbai/");
|
||||
if (chroot("/opt/djumbai/") != 0) {
|
||||
perror("chroot /opt/djumbai");
|
||||
|
@ -60,11 +43,6 @@ int main() {
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
//Restore previous UID
|
||||
if (seteuid(original_euid) == -1) {
|
||||
perror("Restore original euid");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
while (1) {
|
||||
// Read message from the send_fifo
|
||||
|
|
Loading…
Reference in a new issue