commit-mailutils
[Top][All Lists]
Advanced

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

[SCM] GNU Mailutils branch, master, updated. release-3.1.1-52-gaa0a620


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. release-3.1.1-52-gaa0a620
Date: Tue, 24 Jan 2017 06:42:45 +0000 (UTC)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Mailutils".

http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=aa0a6207b162bf8a8f6ba959f2a9ebae598d78a4

The branch, master has been updated
       via  aa0a6207b162bf8a8f6ba959f2a9ebae598d78a4 (commit)
       via  e192fdc478dabf22e2b0aa29e5014d3f6bae8960 (commit)
      from  588c225b3eb45872f7978c0d7e3d79cdd397a933 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit aa0a6207b162bf8a8f6ba959f2a9ebae598d78a4
Author: Sergey Poznyakoff <address@hidden>
Date:   Tue Jan 24 08:14:04 2017 +0200

    Simplify the namespace interface
    
    * imap4d/namespace.c (prefix_translate_name): Remove the url
    parameter. All uses changed.
    (namespace_translate_name): Likewise.
    (i_translate_name): Rename to translate_name. Remove the url
    and ns parameters. All uses changed.
    * imap4d/imap4d.h (namespace_translate_name): Change signature.

commit e192fdc478dabf22e2b0aa29e5014d3f6bae8960
Author: Sergey Poznyakoff <address@hidden>
Date:   Tue Jan 24 08:06:46 2017 +0200

    imap4d: uniformly use mailbox name and record for opening mailboxes
    
    This avoids problems with escaping pathnames that contain characters
    specific for URLs
    
    * imap4d/select.c (imap4d_select0): Don't use mailbox URL.
    * lib/manlock.c (manlock_open_mailbox_from_record): New function.
    * lib/muaux.h (manlock_open_mailbox_from_record): New proto.

-----------------------------------------------------------------------

Summary of changes:
 imap4d/imap4d.h    |    2 +-
 imap4d/list.c      |    4 ++--
 imap4d/namespace.c |   30 ++++++++----------------------
 imap4d/select.c    |   10 ++++++----
 lib/manlock.c      |   27 ++++++++++++++++++++++++++-
 lib/muaux.h        |    3 +++
 6 files changed, 46 insertions(+), 30 deletions(-)

diff --git a/imap4d/imap4d.h b/imap4d/imap4d.h
index 6135fa4..eb7074f 100644
--- a/imap4d/imap4d.h
+++ b/imap4d/imap4d.h
@@ -411,7 +411,7 @@ struct namespace
 void namespace_init (void);
 struct namespace *namespace_lookup (char const *name);
 
-char *namespace_translate_name (char const *name, int url,
+char *namespace_translate_name (char const *name, 
                                struct namespace_prefix const **pfx);
 char *namespace_get_name (char const *name, mu_record_t *rec, int *mode);
 
diff --git a/imap4d/list.c b/imap4d/list.c
index e69aa55..54a9059 100644
--- a/imap4d/list.c
+++ b/imap4d/list.c
@@ -241,7 +241,7 @@ imap4d_list (struct imap4d_session *session,
       
       if (ref[0] == 0)
        {
-         cwd = namespace_translate_name (wcard, 0, &pfx);
+         cwd = namespace_translate_name (wcard, &pfx);
          if (cwd)
            {
              char *p = wcard + strlen (pfx->prefix);
@@ -275,7 +275,7 @@ imap4d_list (struct imap4d_session *session,
            }
        }
 
-      cwd = namespace_translate_name (ref, 0, &pfx);
+      cwd = namespace_translate_name (ref, &pfx);
       if (cwd)
        status = list_ref (ref, wcard, cwd, pfx);
       else
diff --git a/imap4d/namespace.c b/imap4d/namespace.c
index 8422ac2..b280536 100644
--- a/imap4d/namespace.c
+++ b/imap4d/namespace.c
@@ -158,7 +158,7 @@ namespace_init (void)
       
 static char *
 prefix_translate_name (struct namespace_prefix const *pfx, char const *name,
-                      size_t namelen, int url)
+                      size_t namelen)
 {
   size_t pfxlen = strlen (pfx->prefix);
   int delim = 0;
@@ -174,8 +174,6 @@ prefix_translate_name (struct namespace_prefix const *pfx, 
char const *name,
     {
       char *tmpl, *p;
 
-      if (!pfx->scheme)
-       url = 0;
       name += pfxlen;
 
       if (pfx->ns == NS_PERSONAL && strcmp (name, "INBOX") == 0)
@@ -184,16 +182,8 @@ prefix_translate_name (struct namespace_prefix const *pfx, 
char const *name,
          return tmpl;//FIXME
        }
       
-      tmpl = mu_alloc (namelen - pfxlen + strlen (pfx->dir)
-                      + (url ? strlen (pfx->scheme) + 3 : 0)
-                      + 2);
-      if (url)
-       {
-         p = mu_stpcpy (tmpl, pfx->scheme);
-         p = mu_stpcpy (p, "://");
-       }
-      else
-       p = tmpl;
+      tmpl = mu_alloc (namelen - pfxlen + strlen (pfx->dir) + 2);
+      p = tmpl;
       
       p = mu_stpcpy (p, pfx->dir);
       if (*name)
@@ -215,8 +205,7 @@ prefix_translate_name (struct namespace_prefix const *pfx, 
char const *name,
 }
 
 static char *
-i_translate_name (char const *name, int url, int ns,
-                 struct namespace_prefix const **return_pfx)
+translate_name (char const *name, struct namespace_prefix const **return_pfx)
 {
   mu_iterator_t itr;
   int rc;
@@ -241,10 +230,7 @@ i_translate_name (char const *name, int url, int ns,
          continue;
        }
 
-      if (ns != NS_MAX && ns != pfx->ns)
-       continue;
-      
-      res = prefix_translate_name (pfx, name, namelen, url);
+      res = prefix_translate_name (pfx, name, namelen);
       if (res)
        {
          if (return_pfx)
@@ -280,7 +266,7 @@ extract_username (char const *name, struct namespace_prefix 
const *pfx)
 }
 
 char *
-namespace_translate_name (char const *name, int url,
+namespace_translate_name (char const *name,
                          struct namespace_prefix const **return_pfx)
 {
   char *res = NULL;
@@ -292,7 +278,7 @@ namespace_translate_name (char const *name, int url,
       pfx = mu_assoc_get (prefixes, "");
     }
   else
-    res = i_translate_name (name, url, NS_MAX, &pfx);
+    res = translate_name (name, &pfx);
 
   if (res)
     {
@@ -365,7 +351,7 @@ char *
 namespace_get_name (char const *name, mu_record_t *rec, int *mode)
 {
   struct namespace_prefix const *pfx;
-  char *path = namespace_translate_name (name, 0, &pfx);
+  char *path = namespace_translate_name (name, &pfx);
   if (rec)
     *rec = pfx->record;
   if (mode)
diff --git a/imap4d/select.c b/imap4d/select.c
index f81b8a0..4e34a87 100644
--- a/imap4d/select.c
+++ b/imap4d/select.c
@@ -38,6 +38,7 @@ imap4d_select0 (struct imap4d_command *command, const char 
*mboxname,
 {
   int status;
   char *mailbox_name;
+  mu_record_t record;
   
   /* FIXME: Check state.  */
 
@@ -59,24 +60,25 @@ imap4d_select0 (struct imap4d_command *command, const char 
*mboxname,
 
   if (strcmp (mboxname, "INBOX") == 0)
     flags |= MU_STREAM_CREAT;
-  mailbox_name = namespace_translate_name (mboxname, 1, NULL);
+  mailbox_name = namespace_get_name (mboxname, &record, NULL);
 
   if (!mailbox_name)
     return io_completion_response (command, RESP_NO, "Couldn't open mailbox");
 
   if (flags & MU_STREAM_WRITE)
     {
-      status = manlock_open_mailbox (&mbox, mailbox_name, 1, flags);
+      status = manlock_open_mailbox_from_record (&mbox, record,
+                                                mailbox_name, flags);
       if (status)
        flags &= ~MU_STREAM_WRITE;
     }
 
   if (!(flags & MU_STREAM_WRITE))
     {
-      status = mu_mailbox_create_default (&mbox, mailbox_name);
+      status = mu_mailbox_create_from_record (&mbox, record, mailbox_name);
 
       if (status)
-       mu_diag_funcall (MU_DIAG_ERROR, "mu_mailbox_create_default",
+       mu_diag_funcall (MU_DIAG_ERROR, "mu_mailbox_create_from_record",
                         mailbox_name,
                         status);
       else
diff --git a/lib/manlock.c b/lib/manlock.c
index a4966f4..431a1af 100644
--- a/lib/manlock.c
+++ b/lib/manlock.c
@@ -182,8 +182,33 @@ manlock_open_mailbox (mu_mailbox_t *pmbox, const char 
*mailbox_name, int def,
   
   return status;
 }
-
 
+int
+manlock_open_mailbox_from_record (mu_mailbox_t *pmbox, mu_record_t record,
+                                 const char *mailbox_name, int flags)
+{
+  mu_mailbox_t mbox;
+  int status;
+
+  status = mu_mailbox_create_from_record (&mbox, record, mailbox_name);
+  if (status)
+    {
+      mu_diag_funcall (MU_DIAG_ERROR, "mu_mailbox_create_from_record",
+                      mailbox_name,
+                      status);
+      return 1;
+    }
+
+  status = mailbox_open_and_lock (mbox, flags);
+  
+  if (status == 0)
+    *pmbox = mbox;
+  else
+    mu_mailbox_destroy (&mbox);
+  
+  return status;
+}
+
 struct mu_cfg_param manlock_param[] = {
   { "enable", mu_c_bool, &manlock_mandatory_locking, 0, NULL,
     N_("Enable mandatory locking.") },
diff --git a/lib/muaux.h b/lib/muaux.h
index 30d3971..b4c15a0 100644
--- a/lib/muaux.h
+++ b/lib/muaux.h
@@ -24,6 +24,9 @@ extern char *manlock_lock_dir;
 
 int manlock_open_mailbox (mu_mailbox_t *pmbox, const char *mailbox_name,
                          int def, int flags);
+int manlock_open_mailbox_from_record (mu_mailbox_t *pmbox, mu_record_t record,
+                                     const char *mailbox_name, int flags);
+
 int manlock_lock (mu_mailbox_t mbox);
 int manlock_touchlock (mu_mailbox_t mbox);
 int manlock_unlock (mu_mailbox_t mbox);


hooks/post-receive
-- 
GNU Mailutils



reply via email to

[Prev in Thread] Current Thread [Next in Thread]