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-2.2-159-g6203ae6


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-159-g6203ae6
Date: Mon, 25 Oct 2010 19:52:28 +0000

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=6203ae65f53758a4b893e6e176be7c153a31bef0

The branch, master has been updated
       via  6203ae65f53758a4b893e6e176be7c153a31bef0 (commit)
       via  08f69cc36908f376659369a3c5ee2f63a75f1c73 (commit)
      from  eb3a07ec466ebc923230618d059bdb4c29b170b9 (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 6203ae65f53758a4b893e6e176be7c153a31bef0
Author: Sergey Poznyakoff <address@hidden>
Date:   Mon Oct 25 17:16:55 2010 +0300

    Minor fix.
    
    * mh/mh_init.c (mh_safe_make_file_name): Avoid gcc warnings.

commit 08f69cc36908f376659369a3c5ee2f63a75f1c73
Author: Sergey Poznyakoff <address@hidden>
Date:   Mon Oct 25 16:55:37 2010 +0300

    Improve URL matching code.
    
    * libmailutils/base/url.c (mu_url_matches_ticket): Use different
    weight values, depending on the missing part.
    * libmailutils/base/wicket.c (mu_wicket_stream_match_url): Refuse
    URLs that lack host and password parts.

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

Summary of changes:
 libmailutils/base/url.c    |   21 +++++++++++++--------
 libmailutils/base/wicket.c |    8 ++++++++
 mh/mh_init.c               |    6 +++---
 3 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/libmailutils/base/url.c b/libmailutils/base/url.c
index 49aab4b..96345f0 100644
--- a/libmailutils/base/url.c
+++ b/libmailutils/base/url.c
@@ -966,20 +966,25 @@ mu_url_decode (const char *s)
 
 #define is_wildcard(s) ((s)[0] == '*' && s[1] == 0)
 
+#define WEIGHT_SCHEME 3
+#define WEIGHT_USER   4
+#define WEIGHT_HOST   2
+#define WEIGHT_PORT   1
+
 int
 mu_url_matches_ticket (mu_url_t ticket, mu_url_t url, int *pwc)
 {
   int wcnt = 0;
-
+                                             
   if (is_wildcard (ticket->scheme))
-    wcnt++;
+    wcnt += WEIGHT_SCHEME;
   else if (mu_c_strcasecmp (ticket->scheme, url->scheme))
     return 0;
 
   if (ticket->flags & MU_URL_HOST)
     {
       if (is_wildcard (ticket->host))
-       wcnt++;
+       wcnt += WEIGHT_HOST;
       else if (url->flags & MU_URL_HOST)
        {
          if (mu_c_strcasecmp (ticket->host, url->host))
@@ -990,7 +995,7 @@ mu_url_matches_ticket (mu_url_t ticket, mu_url_t url, int 
*pwc)
        return 0;
     }
   else
-    wcnt++;
+    wcnt += WEIGHT_HOST;
 
   if (ticket->flags & MU_URL_PORT)
     {
@@ -1000,16 +1005,16 @@ mu_url_matches_ticket (mu_url_t ticket, mu_url_t url, 
int *pwc)
          if (ticket->port != url->port)
            return 0;
          else
-           wcnt++;
+           wcnt += WEIGHT_PORT;
        }
     }
   else
-    wcnt++;
+    wcnt += WEIGHT_PORT;
   
   if (ticket->flags & MU_URL_USER)
     {
       if (is_wildcard (ticket->user))
-       wcnt += 2;
+       wcnt += WEIGHT_USER;
       
       /* If ticket has a user or pass, but url doesn't, that's OK, we were
         looking for this info. But if url does have a user/pass, it
@@ -1021,7 +1026,7 @@ mu_url_matches_ticket (mu_url_t ticket, mu_url_t url, int 
*pwc)
        }
     }
   else
-    wcnt++;
+    wcnt += WEIGHT_USER;
   
   /* Guess it matches. */
   if (pwc)
diff --git a/libmailutils/base/wicket.c b/libmailutils/base/wicket.c
index 4d79c2c..3e808c0 100644
--- a/libmailutils/base/wicket.c
+++ b/libmailutils/base/wicket.c
@@ -284,6 +284,14 @@ mu_wicket_stream_match_url (mu_stream_t stream, struct 
mu_debug_locus *loc,
          mu_url_destroy (&u);
          continue;
        }
+
+      if (!mu_url_has_flag (u, MU_URL_USER|MU_URL_SECRET))
+       {
+         mu_error (_("%s:%u: URL is missing required parts"),
+                   loc->file, loc->line);
+         mu_url_destroy (&u);
+         continue;
+       }
       
       if (!mu_url_matches_ticket (u, url, &n))
        {
diff --git a/mh/mh_init.c b/mh/mh_init.c
index ca24686..9153476 100644
--- a/mh/mh_init.c
+++ b/mh/mh_init.c
@@ -1030,13 +1030,13 @@ mh_draft_message (const char *name, const char 
*msgspec, char **pname)
 char *
 mh_safe_make_file_name (const char *dir, const char *file)
 {
-  file = mu_make_file_name (dir, file);
-  if (!file)
+  char *name = mu_make_file_name (dir, file);
+  if (!name)
     {
       mu_diag_funcall (MU_DIAG_ERROR, "mu_make_file_name", NULL, ENOMEM);
       abort ();
     }
-  return file;
+  return name;
 }
 
                          


hooks/post-receive
-- 
GNU Mailutils



reply via email to

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