ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainen/* Some error strings that should be used everywhere to avoid
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainen permissions checks from revealing mailbox's existence */
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainen#define MAIL_ERRSTR_MAILBOX_NOT_FOUND "Mailbox doesn't exist: %s"
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainen#define MAIL_ERRSTR_NO_PERMISSION "Permission denied"
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainen/* And just for making error strings consistent: */
2ed2459dbd183bb371da4a0aecb2d2b74ae7c815Timo Sirainen#define MAIL_ERRSTR_NO_QUOTA "Not enough disk quota"
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainen#define MAIL_ERRSTR_LOCK_TIMEOUT "Timeout while waiting for lock"
ac4e6609cbdca594db1b1c02afb1e372ab22e060Timo Sirainen/* Message to show to users when critical error occurs */
ac4e6609cbdca594db1b1c02afb1e372ab22e060Timo Sirainen "Internal error occurred. Refer to server log for more information."
ac4e6609cbdca594db1b1c02afb1e372ab22e060Timo Sirainen MAIL_ERRSTR_CRITICAL_MSG " [%Y-%m-%d %H:%M:%S]"
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainen t_strdup_printf(MAIL_ERRSTR_MAILBOX_NOT_FOUND, name)
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainen /* Temporary internal error */
10ac3345fef3976ef573122de2a58a50c2fa63ceJosef 'Jeff' Sipek /* Temporary failure because a subsystem is down */
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainen /* It's not possible to do the wanted operation */
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainen /* Invalid parameters (eg. mailbox name not valid) */
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainen /* No permission to do the request */
2ed2459dbd183bb371da4a0aecb2d2b74ae7c815Timo Sirainen /* Out of disk quota for user */
4321f6c969e7b8f6b243ff5bb6b8d297921676f6Timo Sirainen /* Item (e.g. mailbox) doesn't exist or it's not visible to us */
4321f6c969e7b8f6b243ff5bb6b8d297921676f6Timo Sirainen /* Item (e.g. mailbox) already exists */
910fa4e4204a73d3d24c03f3059dd24e727ca057Timo Sirainen /* Tried to access an expunged message */
4321f6c969e7b8f6b243ff5bb6b8d297921676f6Timo Sirainen /* Operation cannot be done because another session prevents it
4321f6c969e7b8f6b243ff5bb6b8d297921676f6Timo Sirainen (e.g. lock timeout) */
306b3f41b05da642d87e7ca7a1496efce9f5902fTimo Sirainen /* Can't do the requested data conversion (e.g. IMAP BINARY's
306b3f41b05da642d87e7ca7a1496efce9f5902fTimo Sirainen UNKNOWN-CTE code) */
56b134799a457fd55830355f4c8d746d6bb5206fTimo Sirainen /* Can't do the requested data conversion because the original data
56b134799a457fd55830355f4c8d746d6bb5206fTimo Sirainen isn't valid. */
2898ad0028a9b0c30df96dd6b68930fd4dc57527Timo Sirainen /* Operation ran against some kind of a limit. */
a0cd302bcb827678f9c9c2ca1d0a3f0d3c0b3563Timo Sirainen /* Operation couldn't be finished as efficiently as required by
a0cd302bcb827678f9c9c2ca1d0a3f0d3c0b3563Timo Sirainen mail.lookup_abort. */
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainen/* Convert errno to mail_error and an error string. Returns TRUE if successful,
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainen FALSE if we couldn't handle the errno. */
ff7056842f14fd3b30a2d327dfab165b9d15dd30Timo Sirainenbool mail_error_from_errno(enum mail_error *error_r,
7b85f7d35b2192bdff734d7d2891630bc30b2518Timo Sirainen/* Build a helpful error message for a failed EACCES syscall. */
9e9f0cf3cc3ce546e8a433990c92dd9be6665df6Timo Sirainenconst char *mail_error_eacces_msg(const char *func, const char *path);
7b85f7d35b2192bdff734d7d2891630bc30b2518Timo Sirainen/* Build a helpful error message for a failed EACCES syscall that tried to
7b85f7d35b2192bdff734d7d2891630bc30b2518Timo Sirainen write to directory (create, rename, etc). */
7b85f7d35b2192bdff734d7d2891630bc30b2518Timo Sirainenconst char *mail_error_create_eacces_msg(const char *func, const char *path);