Change base dir to /djumbai instead of /opt/djumbai

This commit is contained in:
Afonso Franco 2024-05-12 16:22:11 +01:00
parent 5c28fe0531
commit 21a222d855
Signed by: afonso
SSH key fingerprint: SHA256:PQTRDHPH3yALEGtHXnXBp3Orfcn21pK20t0tS1kHg54
6 changed files with 22 additions and 23 deletions

View file

@ -42,7 +42,7 @@ int main() {
deserialize_message(buffer, MESSAGE_SIZE, &msg);
if (msg.header.isgroup) {
const char *directory_format = "/opt/djumbai/group/%d/message_box";
const char *directory_format = "/djumbai/group/%d/message_box";
char directory[PATH_MAX];
snprintf(directory, sizeof(directory), directory_format, msg.header.receiver);
@ -58,7 +58,7 @@ int main() {
write_message_to_file(directory, timestamp_str, 0020, buffer);
} else {
const char *directory_format = "/opt/djumbai/user/%d/message_box/%d";
const char *directory_format = "/djumbai/user/%d/message_box/%d";
char directory[PATH_MAX];
snprintf(directory, sizeof(directory), directory_format, msg.header.receiver,
msg.header.sender);

View file

@ -9,10 +9,9 @@
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) {
perror("chroot /opt/djumbai");
chdir("/djumbai");
if (chroot("/djumbai") != 0) {
perror("chroot /djumbai");
return 1;
}
const char *message_queue_path = "fifos/message_queue";

View file

@ -2,7 +2,7 @@
int main() {
//Change the root of the djumbai_enqueue process so it doesn't have access to anything else.
chroot("/opt/djumbai/queue/");
chroot("/djumbai/queue/");
const char *message_queue_path =
"mailqueue";

View file

@ -10,9 +10,9 @@
#include <unistd.h>
int main() {
chdir("/opt/djumbai/");
if (chroot("/opt/djumbai/") != 0) {
perror("chroot /opt/djumbai");
chdir("/djumbai/");
if (chroot("/djumbai/") != 0) {
perror("chroot /djumbai");
return 1;
}
const char *send_fifo_path = "fifos/send_fifo";