changeset 8755:2579345e877f HEAD

imap-acl: Handle obsolete 'c' and 'd' rights. Patch by Sascha Wilde.
author Timo Sirainen <tss@iki.fi>
date Fri, 20 Feb 2009 15:47:39 -0500
parents ed352de284be
children be1d1c722c92
files src/plugins/imap-acl/imap-acl-plugin.c
diffstat 1 files changed, 20 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/imap-acl/imap-acl-plugin.c	Fri Feb 20 15:38:42 2009 -0500
+++ b/src/plugins/imap-acl/imap-acl-plugin.c	Fri Feb 20 15:47:39 2009 -0500
@@ -305,6 +305,10 @@
 imap_acl_letters_parse(const char *letters, const char *const **rights_r,
 		       const char **error_r)
 {
+	static const char *acl_k = MAIL_ACL_CREATE;
+	static const char *acl_x = MAIL_ACL_DELETE;
+	static const char *acl_e = MAIL_ACL_EXPUNGE;
+	static const char *acl_t = MAIL_ACL_WRITE_DELETED;
 	ARRAY_TYPE(const_string) rights;
 	unsigned int i;
 
@@ -318,9 +322,22 @@
 			}
 		}
 		if (imap_acl_letter_map[i].name == NULL) {
-			*error_r = t_strdup_printf("Invalid ACL right: %c",
-						   *letters);
-			return -1;
+			/* Handling of obsolete rights as virtual
+			   rights according to RFC 4314 */
+			switch (*letters) {
+			case 'c':
+				array_append(&rights, &acl_k, 1);
+				array_append(&rights, &acl_x, 1);
+				break;
+			case 'd':
+				array_append(&rights, &acl_e, 1);
+				array_append(&rights, &acl_t, 1);
+				break;
+			default:
+				*error_r = t_strdup_printf(
+					"Invalid ACL right: %c", *letters);
+				return -1;
+			}
 		}
 	}
 	(void)array_append_space(&rights);