summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2007-11-19 13:38:36 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2007-11-19 13:38:36 (GMT)
commitb1a3e134c1e3127cf3f31cdfa24d784858c9873d (patch) (side-by-side diff)
tree1058a6d8b4a5e9a328ed5356ec94c69f0be72732
parent4b9defbcfe01fb05acf9ecd74a683390d6110872 (diff)
downloadmailfromd-b1a3e134c1e3127cf3f31cdfa24d784858c9873d.tar.gz
mailfromd-b1a3e134c1e3127cf3f31cdfa24d784858c9873d.tar.bz2
* src/mu_dbm.c [WITH_GDBM]: do not bail out if the database does
not exist. * src/mailfromd.h: Add argp.h * src/bi_sa.m4: Minor fixes. * src/main.c: Support for Mailutils CVS HEAD. * configure.ac: Likewise. git-svn-id: file:///svnroot/mailfromd/trunk@1527 7a8a7f39-df28-0410-adc6-e0d955640f24
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ChangeLog9
-rw-r--r--configure.ac25
-rw-r--r--src/bi_sa.m48
-rw-r--r--src/mailfromd.h1
-rw-r--r--src/main.c25
-rw-r--r--src/mu_dbm.c5
6 files changed, 49 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 24ee13f..e57b7c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-11-19 Sergey Poznyakoff <gray@gnu.org.ua>
+
+ * src/mu_dbm.c [WITH_GDBM]: do not bail out if the database does
+ not exist.
+ * src/mailfromd.h: Add argp.h
+ * src/bi_sa.m4: Minor fixes.
+ * src/main.c: Support for Mailutils CVS HEAD.
+ * configure.ac: Likewise.
+
2007-11-11 Sergey Poznyakoff <gray@gnu.org.ua>
* src/engine.c (check_on_host): Wait for an answer to QUIT.
diff --git a/configure.ac b/configure.ac
index e49a654..d25011e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -94,24 +94,25 @@ AC_SUBST(MAILUTILS_VERSION)
AC_SUBST(MAILUTILS_INCLUDES)
AC_SUBST(MAILUTILS_LIBS)
MAILUTILS_VERSION=`$MU_CONFIG --info version|sed 's/VERSION=//'`
+VEX=`echo $MAILUTILS_VERSION | sed 's/\./ \\\\* 1000 + /;s/\./ \\\\* 100 + /'`
+MAILUTILS_VERSION_NUMBER=`eval expr "$VEX"`
+AC_SUBST(MAILUTILS_VERSION_NUMBER)
+AC_DEFINE_UNQUOTED(MAILUTILS_VERSION_NUMBER, $MAILUTILS_VERSION_NUMBER,
+ [Packed Mailutils version number])
case $MAILUTILS_VERSION in
-0.*) AC_MSG_ERROR([Mailutils version too old; at least 1.0 is required]);;
-1.1*) MAILUTILS_LIBS=`$MU_CONFIG --link auth`;;
-*) MAILUTILS_LIBS=`$MU_CONFIG --link auth mailer`;;
+0.*) AC_MSG_ERROR([Mailutils version too old; at least 1.0 is required]);;
+1.1|1.1.*) MAILUTILS_LIBS=`$MU_CONFIG --link auth`;;
+1.2|1.2.[[1-9]]) MAILUTILS_LIBS=`$MU_CONFIG --link auth mailer`;;
+[[0-9]]*) MAILUTILS_LIBS=`$MU_CONFIG --link auth mailer cfg argp`;;
+*) AC_MSG_ERROR([Unrecognized mailutils version: "$MAILUTILS_VERSION"]);;
esac
MAILUTILS_INCLUDES=`$MU_CONFIG --compile`
save_LIBS=$LIBS
LIBS="$LIBS $MAILUTILS_LIBS"
-AC_CHECK_FUNCS([argcv_unescape_char mu_get_auth])
+AC_CHECK_FUNCS([mu_get_auth])
LIBS=$save_LIBS
-AH_BOTTOM([#ifndef HAVE_ARGCV_UNESCAPE_CHAR
-# define argcv_unescape_char argcv_unquote_char
-# define argcv_escape_char argcv_quote_char
-#endif
-])
-
### Check for Emacs site-lisp directory
AM_PATH_LISPDIR
@@ -565,6 +566,7 @@ cat <<EOF
*******************************************************************
Mailfromd configured with the following settings:
+Mailutils version......................... $mu_version
External preprocessor..................... $ext_pp
DBM version............................... $status_dbm
Default user.............................. $user
@@ -580,7 +582,8 @@ Documentation rendition type.............. $rendition
EOF
],
-[if test -z "$DEFAULT_PREPROCESSOR"; then
+[mu_version=$MAILUTILS_VERSION
+if test -z "$DEFAULT_PREPROCESSOR"; then
ext_pp=no
else
ext_pp="$DEFAULT_PREPROCESSOR"
diff --git a/src/bi_sa.m4 b/src/bi_sa.m4
index 0ed7472..3f14adb 100644
--- a/src/bi_sa.m4
+++ b/src/bi_sa.m4
@@ -275,8 +275,8 @@ open_connection(eval_environ_t env, char *urlstr, int *isfile, char **phost)
} else if (strcmp(buffer, "tcp") == 0) {
size_t size;
long n;
-
- if (mu_url_get_port(url, &n)) {
+
+ if (rc = mu_url_get_port(url, &n)) {
mu_url_destroy(&url);
MF_THROW(mf_url,
_("%s: cannot get port: %s"),
@@ -286,8 +286,8 @@ open_connection(eval_environ_t env, char *urlstr, int *isfile, char **phost)
if (n == 0 || (port = n) != n) {
mu_url_destroy(&url);
MF_THROW(mf_range,
- _("Port out of range: %s"),
- mu_strerror(rc));
+ _("Port out of range: %ld"),
+ n);
}
if (rc = mu_url_get_host(url, NULL, 0, &size)) {
diff --git a/src/mailfromd.h b/src/mailfromd.h
index faf96d2..97facee 100644
--- a/src/mailfromd.h
+++ b/src/mailfromd.h
@@ -21,6 +21,7 @@
#include <mfapi.h>
#include <dns.h>
#include <xalloc.h>
+#include <argp.h>
/* Common error codes */
#ifdef HAVE_SYSEXITS_H
diff --git a/src/main.c b/src/main.c
index 938a82b..1fd5194 100644
--- a/src/main.c
+++ b/src/main.c
@@ -35,8 +35,11 @@
#include <netdb.h>
#include <mailutils/mailutils.h>
-#include <mailutils/argp.h>
-
+#if MAILUTILS_VERSION_NUMBER < 1290
+# include <mailutils/argp.h>
+#else
+# include <mailutils/libargp.h>
+#endif
#include "mailfromd.h"
#include "syslog_async.h"
@@ -404,7 +407,7 @@ set_mailfrom(void *value)
rc = mu_address_create(&addr, value);
if (rc) {
mu_error(_("Cannot create address `%s': %s"),
- value, mu_strerror(rc));
+ (char*)value, mu_strerror(rc));
return;
}
mu_address_destroy(&addr);
@@ -1443,13 +1446,13 @@ switch_to_privs(uid_t uid, gid_t gid)
#if defined(HAVE_SETREUID)
if (geteuid() != uid) {
if (setreuid(uid, -1) < 0) {
- mu_error(_("setreuid(%lu,-1) failed"),
+ mu_error(_("setreuid(%lu,-1) failed: %s"),
(unsigned long) uid,
mu_strerror(errno));
rc = 1;
}
if (setuid(uid) < 0) {
- mu_error(_("second setuid(%lu) failed"),
+ mu_error(_("second setuid(%lu) failed: %s"),
(unsigned long) uid,
mu_strerror(errno));
rc = 1;
@@ -1457,7 +1460,7 @@ switch_to_privs(uid_t uid, gid_t gid)
} else
#endif
{
- mu_error(_("setuid(%lu) failed"),
+ mu_error(_("setuid(%lu) failed: %s"),
(unsigned long) uid,
mu_strerror(errno));
rc = 1;
@@ -1756,6 +1759,7 @@ version(FILE *stream, struct argp_state *state)
int
main(int argc, char **argv)
{
+ int rc;
int index;
#ifdef ENABLE_NLS
@@ -1782,8 +1786,15 @@ main(int argc, char **argv)
db_format_setup();
include_path_setup();
save_cmdline(argc, argv);
+
mu_argp_init(program_version, "<" PACKAGE_BUGREPORT ">");
- mu_argp_parse(&argp, &argc, &argv, 0, capa, &index, NULL);
+#if MAILUTILS_VERSION_NUMBER < 1290
+ rc = mu_argp_parse(&argp, &argc, &argv, 0, capa, &index, NULL);
+#else
+ rc = mu_app_init(&argp, capa, NULL, argc, argv, 0, &index, NULL);
+#endif
+ if (rc)
+ exit (EX_CONFIG);
log_setup(log_to_stderr);
diff --git a/src/mu_dbm.c b/src/mu_dbm.c
index f736bc9..8165674 100644
--- a/src/mu_dbm.c
+++ b/src/mu_dbm.c
@@ -85,8 +85,9 @@ mu_dbm_open (char *name, DBM_FILE *db, int flags, int mode, int *ro)
int f;
size_t i;
GDBM_FILE gdbm;
-
- if (mu_check_perm (name, mode))
+
+ rc = mu_check_perm (name, mode);
+ if (rc && rc != ENOENT)
return MU_ERR_UNSAFE_PERMS;
if (ro)

Return to:

Send suggestions and report system problems to the System administrator.