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-458-gc6ed0db


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-458-gc6ed0db
Date: Mon, 21 Nov 2011 17:38:16 +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=c6ed0dbaefd47e4eb961162e6ed103b143f73929

The branch, master has been updated
       via  c6ed0dbaefd47e4eb961162e6ed103b143f73929 (commit)
       via  a9e36974c11d4a4c429867a63bc0814917985089 (commit)
      from  d2207485610080f7f3c60b2a435c57fe5edb4ade (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 c6ed0dbaefd47e4eb961162e6ed103b143f73929
Author: Sergey Poznyakoff <address@hidden>
Date:   Mon Nov 21 15:07:13 2011 +0200

    Version 2.99.95

commit a9e36974c11d4a4c429867a63bc0814917985089
Author: Sergey Poznyakoff <address@hidden>
Date:   Mon Nov 21 14:58:23 2011 +0200

    libmu_dbm: Functions for DB creation take default safety flags in their 
last argument.
    
    * configure.ac (check_dbm_impl): Fix improper usage of expr in BDB=* case.
    * include/mailutils/dbm.h (mu_dbm_create_from_url)
    (mu_dbm_create): Take default safety flags as the last argument.
    * libmailutils/base/filesafety.c (_check_linkwrdir): Check for both
    hard and symbolic links.  Fix the latter check.
    * libmailutils/tests/fsaf.at: Add check for softlink in a writable dir.
    * libmu_dbm/create.c (mu_dbm_create): Take default file safety as the
    last argument.
    * libmu_dbm/dbm.c (mu_dbm_create_from_url): Likewise.
    * maidag/mailquota.c (dbm_retrieve_quota): Update call to mu_dbm_create.
    Impose MU_FILE_SAFETY_ALL by default.
    * mu/dbm.c (open_db_file): Update call to mu_dbm_create.  No checks
    by default.
    * pop3d/apop.c (pop3d_apopuser): Update call to mu_dbm_create.  Use
    apop_database_safety as the default checks.
    * pop3d/bulletin.c (read_bulletin_db,write_bulletin_db): Update calls to
    mu_dbm_create.  Use DEFAULT_GROUP_DB_SAFETY as default.
    * pop3d/logindelay.c (open_stat_db): Update call to mu_dbm_create.
    Use DEFAULT_GROUP_DB_SAFETY as default.
    * pop3d/pop3d.c (apop_database_safety): Initialize to MU_FILE_SAFETY_ALL.
    (apop_database_safety_set): Remove.
    * pop3d/pop3d.h (apop_database_safety_set): Remove.
    * pop3d/popauth.c (open_db_file): Update call to mu_dbm_create.  Use
    safety_flags by default.

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

Summary of changes:
 NEWS                           |    8 ++------
 configure.ac                   |    4 ++--
 include/mailutils/dbm.h        |    4 ++--
 libmailutils/base/filesafety.c |    7 ++++---
 libmailutils/tests/fsaf.at     |    9 +++++++++
 libmu_dbm/create.c             |    4 ++--
 libmu_dbm/dbm.c                |   10 +++++++---
 maidag/mailquota.c             |    2 +-
 mu/dbm.c                       |    2 +-
 pop3d/apop.c                   |    5 +----
 pop3d/bulletin.c               |    6 ++----
 pop3d/logindelay.c             |    4 +---
 pop3d/pop3d.c                  |    4 +---
 pop3d/pop3d.h                  |    1 -
 pop3d/popauth.c                |   20 +++++++++-----------
 15 files changed, 44 insertions(+), 46 deletions(-)

diff --git a/NEWS b/NEWS
index 7c974dc..bbdf090 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-GNU mailutils NEWS -- history of user-visible changes. 2011-11-06
+GNU mailutils NEWS -- history of user-visible changes. 2011-11-21
 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 Free Software Foundation, Inc.
 See the end of file for copying conditions.
@@ -6,7 +6,7 @@ See the end of file for copying conditions.
 Please send mailutils bug reports to <address@hidden>.
 
 
-Version 2.99.94 (Git)
+Version 2.99.95 (Git)
 
 This version is a major rewrite of GNU Mailutils.  Quite a few parts
 of the basic framework were rewritten from scratch, while some others
@@ -25,7 +25,6 @@ experimental.  Not currently implemented are:
 
  - imap client
  - nntp client
- - Tokyocabinet support
  
 Experimental features are:
 
@@ -146,9 +145,6 @@ It is normally not needed to specify --with-gdbm, 
--with-berkeley-db
 or --with-ndbm explicitly.  Configuration will automatically pick up
 all available DBM libraries it can use.
 
-The Tokyocabinet support (--with-tokyocabinet) is temporarily not
-available.
-
 ** Imap and nntp clients are not yet implemented
 
 ** Experimental features
diff --git a/configure.ac b/configure.ac
index f28c42b..ca89212 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,7 +17,7 @@ dnl You should have received a copy of the GNU General Public 
License along
 dnl with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>.
 
 AC_PREREQ(2.63)
-AC_INIT([GNU Mailutils], [2.99.94], address@hidden, [mailutils])
+AC_INIT([GNU Mailutils], [2.99.95], address@hidden, [mailutils])
 AC_CONFIG_SRCDIR([libmailutils/mailbox/mailbox.c])
 AC_CONFIG_AUX_DIR([build-aux])
 AM_INIT_AUTOMAKE([gnits 1.11 dist-bzip2 dist-xz std-options silent-rules])
@@ -518,7 +518,7 @@ check_dbm_impl() {
          done;;
 
   BDB=*)
-         name=`expr $use_dbm : 'BDB=\(.*\)'`
+         name=`expr $1 : 'BDB=\(.*\)'`
          case $name in
          [[0-9]]*)  check_slackware_bdb $name;;
          *)         for version in 4 3 2
diff --git a/include/mailutils/dbm.h b/include/mailutils/dbm.h
index ad04359..b651345 100644
--- a/include/mailutils/dbm.h
+++ b/include/mailutils/dbm.h
@@ -53,8 +53,8 @@ void mu_dbm_init (void);
 mu_url_t mu_dbm_get_hint (void);
 
 int mu_dbm_register (struct mu_dbm_impl *impl);
-int mu_dbm_create_from_url (mu_url_t url, mu_dbm_file_t *db);
-int mu_dbm_create (char *name, mu_dbm_file_t *db);
+int mu_dbm_create_from_url (mu_url_t url, mu_dbm_file_t *db, int defsafety);
+int mu_dbm_create (char *name, mu_dbm_file_t *db, int defsafety);
 int mu_dbm_close (mu_dbm_file_t db);
 void mu_dbm_datum_free (struct mu_dbm_datum *datum);
 int mu_dbm_delete (mu_dbm_file_t db, struct mu_dbm_datum const *key);
diff --git a/libmailutils/base/filesafety.c b/libmailutils/base/filesafety.c
index ca075b4..262f194 100644
--- a/libmailutils/base/filesafety.c
+++ b/libmailutils/base/filesafety.c
@@ -68,8 +68,9 @@ _check_awrfil (struct file_check_buffer *fb)
 static int
 _check_linkwrdir (struct file_check_buffer *fb)
 {
-  return (fb->filst.st_mode & S_IFLNK) &&
-         (fb->dirst.st_mode & (S_IWGRP | S_IWOTH));
+  return ((((fb->filst.st_mode & S_IFMT) == S_IFLNK) ||
+          fb->filst.st_nlink > 1) &&
+         (fb->dirst.st_mode & (S_IWGRP | S_IWOTH)));
 }
 
 static int
@@ -199,7 +200,7 @@ mu_file_safety_check (const char *filename, int mode,
   if (!filename)
     return EFAULT;
   memset (&buf, 0, sizeof (buf));
-  if (stat (filename, &buf.filst) == 0)
+  if (lstat (filename, &buf.filst) == 0)
     {
       struct safety_checker *pck;
 
diff --git a/libmailutils/tests/fsaf.at b/libmailutils/tests/fsaf.at
index 3d6b530..d27364c 100644
--- a/libmailutils/tests/fsaf.at
+++ b/libmailutils/tests/fsaf.at
@@ -59,6 +59,15 @@ ln ../data file
 ],
 [Linked file in a writable directory])
 
+FSAFCODE([+linkwrdir],
+[mkdir dir
+chmod g+w dir
+> data
+cd dir
+ln -s ../data file
+],
+[Linked file in a writable directory])
+
 FSAFCODE([+awrdir],
 [mkdir dir
 chmod o+w dir
diff --git a/libmu_dbm/create.c b/libmu_dbm/create.c
index b3e9340..44c161d 100644
--- a/libmu_dbm/create.c
+++ b/libmu_dbm/create.c
@@ -29,7 +29,7 @@
 #include "mudbm.h"
 
 int
-mu_dbm_create (char *name, mu_dbm_file_t *db)
+mu_dbm_create (char *name, mu_dbm_file_t *db, int defsafety)
 {
   int rc;
   mu_url_t url;
@@ -38,7 +38,7 @@ mu_dbm_create (char *name, mu_dbm_file_t *db)
   rc = mu_url_create_hint (&url, name, 0, mu_dbm_hint);
   if (rc)
     return rc;
-  rc = mu_dbm_create_from_url (url, db);
+  rc = mu_dbm_create_from_url (url, db, defsafety);
   mu_url_destroy (&url);
   return rc;
 }
diff --git a/libmu_dbm/dbm.c b/libmu_dbm/dbm.c
index 80df67a..2f3256c 100644
--- a/libmu_dbm/dbm.c
+++ b/libmu_dbm/dbm.c
@@ -132,7 +132,7 @@ mu_dbm_register (struct mu_dbm_impl *impl)
 }
 
 int
-mu_dbm_create_from_url (mu_url_t url, mu_dbm_file_t *db)
+mu_dbm_create_from_url (mu_url_t url, mu_dbm_file_t *db, int defsafety)
 {
   mu_dbm_file_t p;
   int flags;
@@ -142,6 +142,7 @@ mu_dbm_create_from_url (mu_url_t url, mu_dbm_file_t *db)
   struct mu_dbm_impl *impl;
   struct mu_auth_data *auth;
   int safety_flags = 0;
+  int safety_flags_set = 0;
   uid_t owner_uid = getuid ();
 
   mu_dbm_init ();
@@ -183,7 +184,8 @@ mu_dbm_create_from_url (mu_url_t url, mu_dbm_file_t *db)
            }
          else if (*name == '+')
            name++;
-
+         
+         safety_flags_set = 1;
          if (strncmp (name, "owner", 5) == 0)
            {
              val = MU_FILE_SAFETY_OWNER_MISMATCH;
@@ -243,7 +245,8 @@ mu_dbm_create_from_url (mu_url_t url, mu_dbm_file_t *db)
       free (p);
       return ENOMEM;
     }
-  p->db_safety_flags = safety_flags;
+
+  p->db_safety_flags = safety_flags_set ? safety_flags : defsafety;
   p->db_owner = owner_uid;
   p->db_sys = impl;
 
@@ -257,3 +260,4 @@ mu_dbm_impl_iterator (mu_iterator_t *itr)
   mu_dbm_init ();
   return mu_list_get_iterator (implist, itr);
 }
+
diff --git a/maidag/mailquota.c b/maidag/mailquota.c
index 216cc11..de14368 100644
--- a/maidag/mailquota.c
+++ b/maidag/mailquota.c
@@ -77,7 +77,7 @@ dbm_retrieve_quota (char *name, mu_off_t *quota)
   if (!quotadbname)
     return RETR_FAILURE;
 
-  rc = mu_dbm_create (quotadbname, &db);
+  rc = mu_dbm_create (quotadbname, &db, MU_FILE_SAFETY_ALL);
   if (rc)
     {
       mu_error (_("unable to create quota db"));
diff --git a/mu/dbm.c b/mu/dbm.c
index 1408d58..212768d 100644
--- a/mu/dbm.c
+++ b/mu/dbm.c
@@ -106,7 +106,7 @@ open_db_file (int mode)
       exit (EX_USAGE);
     }
   
-  rc = mu_dbm_create (db_name, &db);
+  rc = mu_dbm_create (db_name, &db, 0);
   if (rc)
     {
       mu_diag_output (MU_DIAG_ERROR, _("unable to create database %s: %s"),
diff --git a/pop3d/apop.c b/pop3d/apop.c
index ac9fbd7..5f27ff8 100644
--- a/pop3d/apop.c
+++ b/pop3d/apop.c
@@ -50,16 +50,13 @@ pop3d_apopuser (const char *user)
     mu_dbm_file_t db;
     struct mu_dbm_datum key, data;
 
-    rc = mu_dbm_create (apop_database_name, &db);
+    rc = mu_dbm_create (apop_database_name, &db, apop_database_safety);
     if (rc)
       {
        mu_diag_output (MU_DIAG_ERROR, _("unable to create APOP db"));
        return NULL;
       }
 
-    if (apop_database_safety_set)
-      mu_dbm_safety_set_flags (db, apop_database_safety);
-    
     rc = mu_dbm_safety_check (db);
     if (rc)
       {
diff --git a/pop3d/bulletin.c b/pop3d/bulletin.c
index 47efe61..5efd777 100644
--- a/pop3d/bulletin.c
+++ b/pop3d/bulletin.c
@@ -126,7 +126,7 @@ read_bulletin_db (size_t *pnum)
   size_t s;
   char *p;
 
-  rc = mu_dbm_create (bulletin_db_name, &db);
+  rc = mu_dbm_create (bulletin_db_name, &db, DEFAULT_GROUP_DB_SAFETY);
   if (rc)
     {
       mu_diag_output (MU_DIAG_ERROR, _("unable to create bulletin db"));
@@ -220,15 +220,13 @@ write_bulletin_db (size_t num)
   int rc;
   const char *p;
   
-  rc = mu_dbm_create (bulletin_db_name, &db);
+  rc = mu_dbm_create (bulletin_db_name, &db, DEFAULT_GROUP_DB_SAFETY);
   if (rc)
     {
       mu_diag_output (MU_DIAG_ERROR, _("unable to create bulletin db"));
       return rc;
     }
 
-  mu_dbm_safety_set_flags (db, DEFAULT_GROUP_DB_SAFETY);
-
   rc = mu_dbm_safety_check (db);
   if (rc && rc != ENOENT)
     {
diff --git a/pop3d/logindelay.c b/pop3d/logindelay.c
index f61d6d2..1fc93d1 100644
--- a/pop3d/logindelay.c
+++ b/pop3d/logindelay.c
@@ -25,15 +25,13 @@ open_stat_db (int mode)
   mu_dbm_file_t db;
   int rc;
 
-  rc = mu_dbm_create (login_stat_file, &db);
+  rc = mu_dbm_create (login_stat_file, &db, DEFAULT_GROUP_DB_SAFETY);
   if (rc)
     {
       mu_diag_output (MU_DIAG_ERROR, _("unable to create statistics db"));
       return NULL;
     }
 
-  mu_dbm_safety_set_flags (db, DEFAULT_GROUP_DB_SAFETY);
-  
   rc = mu_dbm_safety_check (db);
   if (rc && rc != ENOENT)
     {
diff --git a/pop3d/pop3d.c b/pop3d/pop3d.c
index 2639bd6..776b059 100644
--- a/pop3d/pop3d.c
+++ b/pop3d/pop3d.c
@@ -33,8 +33,7 @@ int debug_mode;
 int tls_required;
 int pop3d_xlines;
 char *apop_database_name = APOP_PASSFILE;
-int apop_database_safety;
-int apop_database_safety_set;
+int apop_database_safety = MU_FILE_SAFETY_ALL;
 
 #ifdef WITH_TLS
 int tls_available;
@@ -92,7 +91,6 @@ cb2_file_safety_checks (const char *name, void *data)
 static int
 cb_apop_safety_checks (void *data, mu_config_value_t *arg)
 {
-  apop_database_safety_set = 1;
   return mu_cfg_string_value_cb (arg, cb2_file_safety_checks,
                                 &apop_database_safety);
 }
diff --git a/pop3d/pop3d.h b/pop3d/pop3d.h
index d61f248..978ab59 100644
--- a/pop3d/pop3d.h
+++ b/pop3d/pop3d.h
@@ -199,7 +199,6 @@ extern size_t pop3d_output_bufsize;
 extern int pop3d_xlines;
 extern char *apop_database_name;
 extern int apop_database_safety;
-extern int apop_database_safety_set;
 
 /* Safety checks for group-rw database files, such as stat and bulletin
    databases */
diff --git a/pop3d/popauth.c b/pop3d/popauth.c
index 8ae7c95..827116b 100644
--- a/pop3d/popauth.c
+++ b/pop3d/popauth.c
@@ -273,15 +273,6 @@ open_db_file (int action, struct action_data *ap, int 
*my_file)
 
   uid = getuid ();
 
-  rc = mu_dbm_create (db_name, &db);
-  if (rc)
-    {
-      mu_diag_output (MU_DIAG_ERROR, _("unable to create database %s: %s"),
-                     db_name, mu_strerror (rc));
-      exit (EX_SOFTWARE);
-    }
-
-  //  mu_dbm_safety_set_owner (db, uid);
   /* Adjust safety flags */
   if (permissions & 0002)
     safety_flags &= ~MU_FILE_SAFETY_WORLD_WRITABLE;
@@ -291,8 +282,15 @@ open_db_file (int action, struct action_data *ap, int 
*my_file)
     safety_flags &= ~MU_FILE_SAFETY_GROUP_WRITABLE;
   if (permissions & 0040)
     safety_flags &= ~MU_FILE_SAFETY_GROUP_READABLE;
-  
-  mu_dbm_safety_set_flags (db, safety_flags);
+
+  rc = mu_dbm_create (db_name, &db, safety_flags);
+  if (rc)
+    {
+      mu_diag_output (MU_DIAG_ERROR, _("unable to create database %s: %s"),
+                     db_name, mu_strerror (rc));
+      exit (EX_SOFTWARE);
+    }
+
   rc = mu_dbm_safety_check (db);
   if (rc && rc != ENOENT)
     {


hooks/post-receive
-- 
GNU Mailutils



reply via email to

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