[evolution-kolab/ek-wip-acl] CamelIMAPXExtdServerAcl: validate IMAP ACL string before writing to server



commit 1a049fbb21dd8ab1e5f497e87f758bb445617dbc
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Fri Sep 28 16:43:12 2012 +0200

    CamelIMAPXExtdServerAcl: validate IMAP ACL string before writing to server
    
    * when setting ACL on the server, we validate the ACL string
      argument before actually sending them as IMAP SETACL commands
    * renamed ACL function argument to avoid confusion with the
      hash table vars we store the ACL strings in

 src/libekolab/camel-imapx-extd-server-acl.c |   11 +++++++++--
 src/libekolab/camel-imapx-extd-server-acl.h |    2 +-
 2 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/libekolab/camel-imapx-extd-server-acl.c b/src/libekolab/camel-imapx-extd-server-acl.c
index f22f691..e5033fb 100644
--- a/src/libekolab/camel-imapx-extd-server-acl.c
+++ b/src/libekolab/camel-imapx-extd-server-acl.c
@@ -190,7 +190,7 @@ camel_imapx_extd_server_get_acl (CamelIMAPXServer *is,
 gboolean
 camel_imapx_extd_server_set_acl (CamelIMAPXServer *is,
                                  const gchar *foldername,
-                                 const gchar *acl,
+                                 const gchar *imapacl,
                                  GCancellable *cancellable,
                                  GError **err)
 {
@@ -203,11 +203,18 @@ camel_imapx_extd_server_set_acl (CamelIMAPXServer *is,
 	/* cancellable may be NULL */
 	g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
 
+	ok = camel_imapx_acl_validate_imapacl (imapacl,
+	                                       &tmp_err);
+	if (! ok) {
+		g_propagate_error (err, tmp_err);
+		return FALSE;
+	}
+
 	/* TODO move SETACL string to -acl.[hc] */
 	cmd = g_strdup_printf ("%s \"%s\" \"%s\"",
 	                       IMAPX_IMAP_TOKEN_SETACL,
 	                       foldername,
-	                       acl);
+	                       imapacl);
 
 	/* run SETACL command */
 	ok = camel_imapx_extd_utils_command_run (is,
diff --git a/src/libekolab/camel-imapx-extd-server-acl.h b/src/libekolab/camel-imapx-extd-server-acl.h
index 2749727..5020288 100644
--- a/src/libekolab/camel-imapx-extd-server-acl.h
+++ b/src/libekolab/camel-imapx-extd-server-acl.h
@@ -65,7 +65,7 @@ camel_imapx_extd_server_get_acl (CamelIMAPXServer *self,
 gboolean
 camel_imapx_extd_server_set_acl (CamelIMAPXServer *self,
                                  const gchar *foldername,
-                                 const gchar *acl,
+                                 const gchar *imapacl,
                                  GCancellable *cancellable,
                                  GError **err);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]