File bgo-562228-eds-mailbox-field.patch of Package evolution-data-server

Index: servers/exchange/lib/e2k-autoconfig.c
===================================================================
--- servers/exchange/lib/e2k-autoconfig.c	(revision 9780)
+++ servers/exchange/lib/e2k-autoconfig.c	(working copy)
@@ -1516,6 +1516,8 @@ validate (const char *owa_url, char *use
 	}
 
 	if (*result == E2K_AUTOCONFIG_OK) {
+		int len;
+
 		*result = e2k_autoconfig_check_global_catalog (ac, &op);
 		e2k_operation_free (&op);
 
@@ -1524,6 +1526,13 @@ validate (const char *owa_url, char *use
 		path = g_strdup (euri->path + 1);
 		e2k_uri_free (euri);
 
+		/* no slash at the end of path */
+		len = strlen (path);
+		while (len && path [len - 1] == '/') {
+			path [len - 1] = '\0';
+			len--;
+		}
+
 		/* change a mailbox only if not set by the caller */
 		if (!exchange_params->mailbox || !*exchange_params->mailbox) {
 			mailbox = strrchr (path, '/');
@@ -1536,6 +1545,12 @@ validate (const char *owa_url, char *use
 
 			g_free (exchange_params->mailbox);
 			exchange_params->mailbox  = g_strdup (mailbox);
+		} else {
+			/* always strip the mailbox part from the path */
+			char *slash = strrchr (path, '/');
+
+			if (slash)
+				*slash = '\0';
 		}
 
 		exchange_params->owa_path = g_strdup_printf ("%s%s", "/", path);
openSUSE Build Service is sponsored by