From f7548d6d28c313cf80e6f3ef89aed16a19815df1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 11:51:24 +0200 Subject: Adding upstream version 1:2.3.19.1+dfsg1. Signed-off-by: Daniel Baumann --- src/lib-storage/mail-error.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/lib-storage/mail-error.c (limited to 'src/lib-storage/mail-error.c') diff --git a/src/lib-storage/mail-error.c b/src/lib-storage/mail-error.c new file mode 100644 index 0000000..a3c6e00 --- /dev/null +++ b/src/lib-storage/mail-error.c @@ -0,0 +1,34 @@ +/* Copyright (c) 2007-2018 Dovecot authors, see the included COPYING file */ + +#include "lib.h" +#include "eacces-error.h" +#include "mail-error.h" + +bool mail_error_from_errno(enum mail_error *error_r, + const char **error_string_r) +{ + if (ENOACCESS(errno)) { + *error_r = MAIL_ERROR_PERM; + *error_string_r = MAIL_ERRSTR_NO_PERMISSION; + } else if (ENOQUOTA(errno)) { + *error_r = MAIL_ERROR_NOQUOTA; + *error_string_r = MAIL_ERRSTR_NO_QUOTA; + } else if (ENOTFOUND(errno)) { + *error_r = MAIL_ERROR_NOTFOUND; + *error_string_r = errno != ELOOP ? "Not found" : + "Directory structure is broken"; + } else { + return FALSE; + } + return TRUE; +} + +const char *mail_error_eacces_msg(const char *func, const char *path) +{ + return eacces_error_get(func, path); +} + +const char *mail_error_create_eacces_msg(const char *func, const char *path) +{ + return eacces_error_get_creating(func, path); +} -- cgit v1.2.3