From 2fe800f20f60c9178cf1de855c4816e2e4b47a6a Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 6 Feb 2025 12:18:11 +0200 Subject: [PATCH] lda: Remove check to fail if binary is setuid-root and world-executable It's not safe to use as setuid-root even when not world-executable. Remove the check so people might not get wrong ideas about its safety. --- src/lda/main.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/lda/main.c b/src/lda/main.c index 60dafc84c5..1f824ff727 100644 --- a/src/lda/main.c +++ b/src/lda/main.c @@ -355,24 +355,6 @@ int main(int argc, char *argv[]) bool stderr_rejection = FALSE; int ret, c; - if (getuid() != geteuid() && geteuid() == 0) { - /* running setuid - don't allow this if the binary is - executable by anyone */ - struct stat st; - - if (stat(argv[0], &st) < 0) { - fprintf(stderr, "stat(%s) failed: %s\n", - argv[0], strerror(errno)); - return EX_TEMPFAIL; - } else if ((st.st_mode & 1) != 0 && (st.st_mode & 04000) != 0) { - fprintf(stderr, "%s must not be both world-executable " - "and setuid-root. This allows root exploits. " - "See https://doc.dovecot.org/configuration_manual/protocols/lda/#multiple-uids\n", - argv[0]); - return EX_TEMPFAIL; - } - } - i_set_failure_exit_callback(failure_exit_callback); master_service = master_service_init("lda", -- 2.47.3