From 5c28fe0531756f1e15e1e7587db1353e01bb8335 Mon Sep 17 00:00:00 2001 From: afonso Date: Sun, 12 May 2024 16:05:31 +0100 Subject: [PATCH] fix dumb mistake --- src/djumbai_dequeue/djumbai_dequeue.c | 4 ++-- src/djumbai_send/djumbai_send.c | 22 ---------------------- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/src/djumbai_dequeue/djumbai_dequeue.c b/src/djumbai_dequeue/djumbai_dequeue.c index 1484cd0..fef724a 100644 --- a/src/djumbai_dequeue/djumbai_dequeue.c +++ b/src/djumbai_dequeue/djumbai_dequeue.c @@ -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; } diff --git a/src/djumbai_send/djumbai_send.c b/src/djumbai_send/djumbai_send.c index 212c0e3..9e1258c 100644 --- a/src/djumbai_send/djumbai_send.c +++ b/src/djumbai_send/djumbai_send.c @@ -10,23 +10,6 @@ #include 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