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-574-gb4d7b1a


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. release-2.2-574-gb4d7b1a
Date: Sun, 11 Mar 2012 10:43:58 +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=b4d7b1a6cb3f17fdce8759ded4ade0188e86d20d

The branch, master has been updated
       via  b4d7b1a6cb3f17fdce8759ded4ade0188e86d20d (commit)
       via  c21495784ae7f9551311a09e5d24d40df2354e48 (commit)
      from  ca898e17e779eed5ca95f603767d91f298c33159 (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 b4d7b1a6cb3f17fdce8759ded4ade0188e86d20d
Author: Sergey Poznyakoff <address@hidden>
Date:   Sun Mar 11 12:42:20 2012 +0200

    Fix the use of struct utmp/utmpx in comsatd.
    
    * am/utmp.m4: Check if struct utmp has ut_user or ut_name members.
    * comsat/comsat.c [HAVE_UTMPX_H]: Define UTMP as a typedef of
    struct utmpx.
    Define ut_user, if necessary.
    (find_user): Use ut_user instead of (backward-compatible) ut_name.

commit c21495784ae7f9551311a09e5d24d40df2354e48
Author: Sergey Poznyakoff <address@hidden>
Date:   Fri Mar 9 13:19:18 2012 +0200

    Fix compilation of pop3d and maidag without DBM.
    
    * maidag/Makefile.am: Load libmu_dbm.la if MU_COND_DBM is true.
    * pop3d/apop.c (pop3d_apopuser): Set owner, if specified in the
    config.
    * pop3d/pop3d.c (apop_database_owner)
    (apop_database_owner_set): New globals.
    (pop3d_cfg_param) <apop-database-owner>: New keyword.
    * pop3d/pop3d.h (apop_database_owner)
    (apop_database_owner_set): New declarations.

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

Summary of changes:
 am/utmp.m4         |   10 ++++++++--
 comsat/comsat.c    |   15 ++++++++++-----
 maidag/Makefile.am |    6 +++++-
 pop3d/apop.c       |    5 ++++-
 pop3d/pop3d.c      |   31 +++++++++++++++++++++++++++++++
 pop3d/pop3d.h      |    2 ++
 6 files changed, 60 insertions(+), 9 deletions(-)

diff --git a/am/utmp.m4 b/am/utmp.m4
index ce9406a..7319c33 100644
--- a/am/utmp.m4
+++ b/am/utmp.m4
@@ -2,7 +2,7 @@ dnl MU_CHECK_UTMP -- Check for the presence of utmp.h, 
setutent, getutent
 dnl                  and endutent calls.
 AC_DEFUN([MU_CHECK_UTMP],
 [
-  AC_CHECK_HEADERS([utmp.h])
+  AC_CHECK_HEADERS([utmp.h utmpx.h])
   # The three functions setutent,getutent and endutent depend on each other,
   # so it seems reasonable to provide replacements for all three if getutent
   # is not present.
@@ -11,4 +11,10 @@ AC_DEFUN([MU_CHECK_UTMP],
          [Define if your system has the three ???utent functions]),
                  [if test "$ac_cv_header_utmp_h" = "yes"; then
                   AC_LIBOBJ([utmp])
-                fi])])
+                fi])
+  if test "$ac_cv_header_utmp_h" = "yes"; then
+    AC_CHECK_MEMBERS([struct utmp.ut_user, struct utmp.ut_name],,,
+                     [#include <sys/types.h>
+#include <utmp.h>])
+  fi
+])
diff --git a/comsat/comsat.c b/comsat/comsat.c
index 555c51c..593311f 100644
--- a/comsat/comsat.c
+++ b/comsat/comsat.c
@@ -36,10 +36,8 @@ extern void setutent (void);
 extern struct utmp *getutent (void);
 #endif
 
-#ifdef UTMPX
-# ifdef HAVE_UTMPX_H
-#  include <utmpx.h>
-# endif
+#ifdef HAVE_UTMPX_H
+# include <utmpx.h>
 typedef struct utmpx UTMP;
 # define SETUTENT() setutxent()
 # define GETUTENT() getutxent()
@@ -49,6 +47,13 @@ typedef struct utmp UTMP;
 # define SETUTENT() setutent()
 # define GETUTENT() getutent()
 # define ENDUTENT() endutent()
+# if !HAVE_STRUCT_UTMP_UT_USER
+#  if HAVE_STRUCT_UTMP_UT_NAME
+#   define ut_user ut_name
+#  else
+#   error "Neither ut_user nor ut_name found in struct utmp. Please report."
+#  endif
+# endif
 #endif
 
 #define MAX_TTY_SIZE (sizeof (PATH_TTY_PFX) + sizeof (((UTMP*)0)->ut_line))
@@ -462,7 +467,7 @@ find_user (const char *name, char *tty)
       if (uptr->ut_type != USER_PROCESS)
        continue;
 #endif
-      if (!strncmp (uptr->ut_name, name, sizeof(uptr->ut_name)))
+      if (!strncmp (uptr->ut_user, name, sizeof(uptr->ut_user)))
        {
          /* no particular tty was requested */
          strncpy (ftty + sizeof(PATH_DEV),
diff --git a/maidag/Makefile.am b/maidag/Makefile.am
index 0f622ae..8efbf96 100644
--- a/maidag/Makefile.am
+++ b/maidag/Makefile.am
@@ -29,6 +29,10 @@ maidag_SOURCES=\
  script.c\
  util.c
 
+if MU_COND_DBM
+ LIBMU_DBM=../libmu_dbm/libmu_dbm.la
+endif
+
 maidag_LDADD = \
  @LIBMU_SCM@ @address@hidden
  @address@hidden
@@ -46,7 +50,7 @@ maidag_LDADD = \
  @address@hidden
  ${MU_LIB_MAILUTILS} \
  @address@hidden
- ../libmu_dbm/libmu_dbm.la\
+ $(LIBMU_DBM)\
  @address@hidden
  @TCPWRAP_LIBRARIES@
 
diff --git a/pop3d/apop.c b/pop3d/apop.c
index 7f06a7c..a4f4e12 100644
--- a/pop3d/apop.c
+++ b/pop3d/apop.c
@@ -57,6 +57,9 @@ pop3d_apopuser (const char *user)
        return NULL;
       }
 
+    if (apop_database_owner_set)
+      mu_dbm_safety_set_owner (db, apop_database_owner);
+    
     rc = mu_dbm_safety_check (db);
     if (rc)
       {
@@ -116,7 +119,7 @@ pop3d_apopuser (const char *user)
     FILE *apop_file;
 
     rc = mu_file_safety_check (apop_database_name, apop_database_safety,
-                              apop_database_uid, NULL);
+                              apop_database_owner, NULL);
     if (rc)
       {
        mu_diag_output (MU_DIAG_ERROR,
diff --git a/pop3d/pop3d.c b/pop3d/pop3d.c
index 17b59e1..3fe6c4e 100644
--- a/pop3d/pop3d.c
+++ b/pop3d/pop3d.c
@@ -33,6 +33,8 @@ int tls_required;
 int pop3d_xlines;
 char *apop_database_name = APOP_PASSFILE;
 int apop_database_safety = MU_FILE_SAFETY_ALL;
+uid_t apop_database_owner;
+int apop_database_owner_set;
 
 #ifdef WITH_TLS
 int tls_available;
@@ -94,6 +96,33 @@ cb_apop_safety_checks (void *data, mu_config_value_t *arg)
                                 &apop_database_safety);
 }
 
+static int
+cb_apop_database_owner (void *data, mu_config_value_t *val)
+{
+  struct passwd *pw;
+  
+  if (mu_cfg_assert_value_type (val, MU_CFG_STRING))
+    return 1;
+  pw = getpwnam (val->v.string);
+  if (!pw)
+    {
+      char *p;
+      unsigned long n;
+    
+      n = strtoul (val->v.string, &p, 10);
+      if (*p)
+       {
+         mu_error (_("no such user: %s"), val->v.string);
+         return 1;
+       }
+      apop_database_owner = n;
+    }
+  else
+    apop_database_owner = pw->pw_uid;
+  apop_database_owner_set = 1;
+  return 0;
+}
+
 #ifdef ENABLE_DBM
 static int
 cb_bulletin_db (void *data, mu_config_value_t *val)
@@ -130,6 +159,8 @@ static struct mu_cfg_param pop3d_cfg_param[] = {
     N_("Output the number of lines in the message in its scan listing.") },
   { "apop-database-file", mu_cfg_string, &apop_database_name, 0, NULL,
     N_("set APOP database file name or URL") },
+  { "apop-database-owner", mu_cfg_callback, NULL, 0, cb_apop_database_owner,
+    N_("Name or UID of the APOP database owner") },
   { "apop-database-safety", mu_cfg_callback, NULL, 0, cb_apop_safety_checks,
     N_("Configure safety checks for APOP database files.  Argument is a list 
or "
        "sequence of check names optionally prefixed with '+' to enable or "
diff --git a/pop3d/pop3d.h b/pop3d/pop3d.h
index d9d4206..aa99ea4 100644
--- a/pop3d/pop3d.h
+++ b/pop3d/pop3d.h
@@ -198,6 +198,8 @@ extern size_t pop3d_output_bufsize;
 extern int pop3d_xlines;
 extern char *apop_database_name;
 extern int apop_database_safety;
+extern uid_t apop_database_owner;
+extern int apop_database_owner_set;
 
 /* Safety checks for group-rw database files, such as stat and bulletin
    databases */


hooks/post-receive
-- 
GNU Mailutils



reply via email to

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