Skip to content

Commit

Permalink
lib-storage: Use getuid() instead of geteuid() for checking if we're …
Browse files Browse the repository at this point in the history
…running as root.

This fixes running multiple doveadm commands for different users. Running
mail_storage_service_init() + _deinit() multiple times left euid non-root,
which dropped the MAIL_STORAGE_SERVICE_FLAG_TEMP_PRIV_DROP flag.
  • Loading branch information
sirainen committed Feb 29, 2016
1 parent 9990080 commit 32223e1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib-storage/mail-storage-service.c
Expand Up @@ -857,7 +857,7 @@ mail_storage_service_init(struct master_service *service,
}

if ((flags & MAIL_STORAGE_SERVICE_FLAG_TEMP_PRIV_DROP) != 0 &&
geteuid() != 0) {
getuid() != 0) {
/* service { user } isn't root. the permission drop can't be
temporary. */
flags &= ~MAIL_STORAGE_SERVICE_FLAG_TEMP_PRIV_DROP;
Expand Down

0 comments on commit 32223e1

Please sign in to comment.