** Fix for bug #562228
authorMilan Crha <mcrha@redhat.com>
Tue, 2 Dec 2008 12:17:54 +0000 (12:17 +0000)
committerMilan Crha <mcrha@src.gnome.org>
Tue, 2 Dec 2008 12:17:54 +0000 (12:17 +0000)
2008-12-02  Milan Crha  <mcrha@redhat.com>

** Fix for bug #562228

* lib/e2k-autoconfig.c: (validate): Always store correct owa_path when
validating, without trailing slash and without mailbox name.

svn path=/trunk/; revision=9787

servers/exchange/ChangeLog
servers/exchange/lib/e2k-autoconfig.c

index beaac11..c9bf416 100644 (file)
@@ -1,3 +1,10 @@
+2008-12-02  Milan Crha  <mcrha@redhat.com>
+
+       ** Fix for bug #562228
+
+       * lib/e2k-autoconfig.c: (validate): Always store correct owa_path when
+       validating, without trailing slash and without mailbox name. 
+
 2008-10-19  Milan Crha  <mcrha@redhat.com>
 
        ** Fix for bug #553944
index a8f9c93..3e2bb84 100644 (file)
@@ -1516,6 +1516,8 @@ validate (const char *owa_url, char *user, char *password, ExchangeParams *excha
        }
 
        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 *user, char *password, ExchangeParams *excha
                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 *user, char *password, ExchangeParams *excha
 
                        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);