aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2007-12-12 12:22:30 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2007-12-12 12:22:30 +0000
commit60fbc52f285b19ccbc9723cdae135cbb22acfe98 (patch)
treea5dc6c946b27627d5c3eb3906512f4728c6ea3b9
parent080cc8f1c899f91f143694f3a3399a159239496b (diff)
downloadmailfromd-60fbc52f285b19ccbc9723cdae135cbb22acfe98.tar.gz
mailfromd-60fbc52f285b19ccbc9723cdae135cbb22acfe98.tar.bz2
Reflect recent changes to Mailutils.
git-svn-id: file:///svnroot/mailfromd/trunk@1534 7a8a7f39-df28-0410-adc6-e0d955640f24
-rw-r--r--ChangeLog4
-rw-r--r--gacopyz/gacopyz.c18
-rw-r--r--gacopyz/server.c18
-rw-r--r--src/main.c129
4 files changed, 86 insertions, 83 deletions
diff --git a/ChangeLog b/ChangeLog
index 08f55f73..ea8e7586 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-12-12 Sergey Poznyakoff <gray@gnu.org.ua>
+
+ * src/main.c: Reflect recent changes to Mailutils.
+
2007-11-22 Sergey Poznyakoff <gray@gnu.org.ua>
* src/main.c: Implement MU configuration statements.
diff --git a/gacopyz/gacopyz.c b/gacopyz/gacopyz.c
index 1fff7edb..24f694e8 100644
--- a/gacopyz/gacopyz.c
+++ b/gacopyz/gacopyz.c
@@ -152,8 +152,8 @@ do_connect(gacopyz_conn_t conn,
{
union {
struct sockaddr sa;
- struct sockaddr_in sin;
- struct sockaddr_un sun;
+ struct sockaddr_in s_in;
+ struct sockaddr_un s_un;
} addr;
int socklen;
int fd, flags;
@@ -171,7 +171,7 @@ do_connect(gacopyz_conn_t conn,
return -1;
}
- if (strlen(path) > sizeof addr.sun.sun_path) {
+ if (strlen(path) > sizeof addr.s_un.sun_path) {
errno = EINVAL;
gacopyz_log(conn, SMI_LOG_ERR,
_("%s: %s: UNIX socket name too long"),
@@ -180,8 +180,8 @@ do_connect(gacopyz_conn_t conn,
}
addr.sa.sa_family = PF_UNIX;
- socklen = sizeof(addr.sun);
- strcpy(addr.sun.sun_path, path);
+ socklen = sizeof(addr.s_un);
+ strcpy(addr.s_un.sun_path, path);
if (stat(path, &st)) {
if (errno == ENOENT) {
@@ -217,7 +217,7 @@ do_connect(gacopyz_conn_t conn,
char *p;
addr.sa.sa_family = PF_INET;
- socklen = sizeof(addr.sin);
+ socklen = sizeof(addr.s_in);
if (!port) {
gacopyz_log(conn, SMI_LOG_ERR,
@@ -250,7 +250,7 @@ do_connect(gacopyz_conn_t conn,
}
if (!path)
- addr.sin.sin_addr.s_addr = INADDR_ANY;
+ addr.s_in.sin_addr.s_addr = INADDR_ANY;
else {
struct hostent *hp = gethostbyname(path);
if (!hp) {
@@ -262,8 +262,8 @@ do_connect(gacopyz_conn_t conn,
addr.sa.sa_family = hp->h_addrtype;
switch (hp->h_addrtype) {
case AF_INET:
- memmove(&addr.sin.sin_addr, hp->h_addr, 4);
- addr.sin.sin_port = pnum;
+ memmove(&addr.s_in.sin_addr, hp->h_addr, 4);
+ addr.s_in.sin_port = pnum;
break;
default:
diff --git a/gacopyz/server.c b/gacopyz/server.c
index 401854b2..a4a05e49 100644
--- a/gacopyz/server.c
+++ b/gacopyz/server.c
@@ -648,8 +648,8 @@ srv_connect(gacopyz_srv_t srv, char *proto, char *port, char *path)
{
union {
struct sockaddr sa;
- struct sockaddr_in sin;
- struct sockaddr_un sun;
+ struct sockaddr_in s_in;
+ struct sockaddr_un s_un;
} addr;
int socklen;
int fd = -1;
@@ -666,7 +666,7 @@ srv_connect(gacopyz_srv_t srv, char *proto, char *port, char *path)
return -1;
}
- if (strlen(path) > sizeof addr.sun.sun_path) {
+ if (strlen(path) > sizeof addr.s_un.sun_path) {
errno = EINVAL;
gacopyz_io_log(&srv->iod, SMI_LOG_ERR,
_("%s: UNIX socket name too long"),
@@ -675,8 +675,8 @@ srv_connect(gacopyz_srv_t srv, char *proto, char *port, char *path)
}
addr.sa.sa_family = PF_UNIX;
- socklen = sizeof(addr.sun);
- strcpy(addr.sun.sun_path, path);
+ socklen = sizeof(addr.s_un);
+ strcpy(addr.s_un.sun_path, path);
if (stat(path, &st)) {
gacopyz_io_log(&srv->iod, SMI_LOG_ERR,
@@ -699,7 +699,7 @@ srv_connect(gacopyz_srv_t srv, char *proto, char *port, char *path)
char *p;
addr.sa.sa_family = PF_INET;
- socklen = sizeof(addr.sin);
+ socklen = sizeof(addr.s_in);
if (!port) {
gacopyz_io_log(&srv->iod, SMI_LOG_ERR,
@@ -732,7 +732,7 @@ srv_connect(gacopyz_srv_t srv, char *proto, char *port, char *path)
}
if (!path)
- addr.sin.sin_addr.s_addr = INADDR_ANY;
+ addr.s_in.sin_addr.s_addr = INADDR_ANY;
else {
struct hostent *hp = gethostbyname(path);
if (!hp) {
@@ -744,8 +744,8 @@ srv_connect(gacopyz_srv_t srv, char *proto, char *port, char *path)
addr.sa.sa_family = hp->h_addrtype;
switch (hp->h_addrtype) {
case AF_INET:
- memmove(&addr.sin.sin_addr, hp->h_addr, 4);
- addr.sin.sin_port = pnum;
+ memmove(&addr.s_in.sin_addr, hp->h_addr, 4);
+ addr.s_in.sin_port = pnum;
break;
default:
diff --git a/src/main.c b/src/main.c
index 3798ca3f..f09f34ec 100644
--- a/src/main.c
+++ b/src/main.c
@@ -37,10 +37,6 @@
#include <mailutils/mailutils.h>
#if MAILUTILS_VERSION_NUMBER < 1290
# include <mailutils/argp.h>
-typedef struct {
- char *file;
- int line;
-} mu_cfg_locus_t;
#else
# include <mailutils/libargp.h>
#endif
@@ -242,16 +238,17 @@ log_status(sfsistat status, SMFICTX *ctx)
}
static void
-mf_error_on_locus(mu_cfg_locus_t *locus, const char *fmt, ...)
+mf_error_on_locus(mu_debug_t err, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
- if (locus) {
- char *newfmt = NULL;
- asprintf(&newfmt, "%s:%d: %s", locus->file, locus->line, fmt);
- mu_verror(newfmt, ap);
+#if MAILUTILS_VERSION_NUMBER >= 1290
+ if (err) {
+ mu_debug_vprintf(err, 0, fmt, ap);
+ mu_debug_printf(err, 0, "\n");
} else
+#endif
mu_verror(fmt, ap);
va_end(ap);
}
@@ -270,7 +267,7 @@ compare_string(const void *item, const void *value)
/* Read domains from sendmail-style domain file NAME and store them in
DOMAIN_LIST */
int
-read_domain_file(mu_cfg_locus_t *locus, char *name)
+read_domain_file(mu_debug_t err, char *name)
{
FILE *fp;
char buf[256];
@@ -278,7 +275,7 @@ read_domain_file(mu_cfg_locus_t *locus, char *name)
fp = fopen(name, "r");
if (!fp) {
- mf_error_on_locus(locus, _("Cannot open file `%s': %s"),
+ mf_error_on_locus(err, _("Cannot open file `%s': %s"),
name, mu_strerror(errno));
return 1;
}
@@ -384,14 +381,14 @@ gid_comp(const void *item, const void *data)
}
static int
-mf_option_group(mu_cfg_locus_t *locus, char *arg)
+mf_option_group(mu_debug_t err, char *arg)
{
struct group *group = getgrnam(arg);
if (group) {
if (!retain_groups) {
int rc = mu_list_create(&retain_groups);
if (rc) {
- mf_error_on_locus(locus,
+ mf_error_on_locus(err,
_("Cannot create list: %s"),
mu_strerror(rc));
return 1;
@@ -400,21 +397,21 @@ mf_option_group(mu_cfg_locus_t *locus, char *arg)
}
mu_list_append(retain_groups, (void*)group->gr_gid);
} else {
- mf_error_on_locus(locus, _("Unknown group: %s"), arg);
+ mf_error_on_locus(err, _("Unknown group: %s"), arg);
return 1;
}
return 0;
}
static int
-mf_option_mailfrom(mu_cfg_locus_t *locus, char *arg)
+mf_option_mailfrom(mu_debug_t err, char *arg)
{
int rc;
mu_address_t addr;
rc = mu_address_create(&addr, arg);
if (rc) {
- mf_error_on_locus(locus, _("Cannot create address `%s': %s"),
+ mf_error_on_locus(err, _("Cannot create address `%s': %s"),
arg, mu_strerror(rc));
return 1;
}
@@ -424,21 +421,21 @@ mf_option_mailfrom(mu_cfg_locus_t *locus, char *arg)
}
static int
-mf_option_state_directory(mu_cfg_locus_t *locus, char *arg)
+mf_option_state_directory(mu_debug_t err, char *arg)
{
struct stat st;
if (stat(arg, &st)) {
- mf_error_on_locus(locus, _("Cannot stat file `%s': %s"),
+ mf_error_on_locus(err, _("Cannot stat file `%s': %s"),
arg,
mu_strerror(errno));
return 1;
}
if (!S_ISDIR(st.st_mode)) {
- mf_error_on_locus(locus, _("`%s' is not a directory"), arg);
+ mf_error_on_locus(err, _("`%s' is not a directory"), arg);
return 1;
}
if (arg[0] != '/') {
- mf_error_on_locus(locus,
+ mf_error_on_locus(err,
_("State directory `%s' is not an absolute file name"),
arg);
return 1;
@@ -448,13 +445,13 @@ mf_option_state_directory(mu_cfg_locus_t *locus, char *arg)
}
static int
-mf_option_source_ip(mu_cfg_locus_t *locus, char *arg, unsigned long *pval)
+mf_option_source_ip(mu_debug_t err, char *arg, unsigned long *pval)
{
unsigned long address = inet_addr(arg);
if (address == INADDR_NONE) {
struct hostent *phe = gethostbyname(arg);
if (!phe) {
- mf_error_on_locus(locus, _("Cannot resolve `%s'"),
+ mf_error_on_locus(err, _("Cannot resolve `%s'"),
arg);
return 1;
}
@@ -1458,11 +1455,11 @@ static struct argp argp = {
/* Mailutils-2.0 configuration */
#if MAILUTILS_VERSION_NUMBER >= 1290
int
-cb_timeout(time_t *pinterval, mu_cfg_locus_t *locus, void *data, char *arg)
+cb_timeout(time_t *pinterval, mu_debug_t err, void *data, char *arg)
{
const char *endp;
if (parse_time_interval(arg, pinterval, &endp)) {
- mf_error_on_locus(locus,
+ mf_error_on_locus(err,
_("unrecognized time format (near `%s')"),
endp);
return 1;
@@ -1471,14 +1468,14 @@ cb_timeout(time_t *pinterval, mu_cfg_locus_t *locus, void *data, char *arg)
}
int
-cb_milter_timeout(mu_cfg_locus_t *locus, void *data, char *arg)
+cb_milter_timeout(mu_debug_t err, void *data, char *arg)
{
time_t interval;
- if (cb_timeout(&interval, locus, data, arg))
+ if (cb_timeout(&interval, err, data, arg))
return 1;
if (smfi_settimeout(interval) == MI_FAILURE) {
- mf_error_on_locus(locus,
+ mf_error_on_locus(err,
_("%s:%d: Invalid milter timeout: %lu"),
(unsigned long) interval);
exit(EX_USAGE);
@@ -1488,52 +1485,52 @@ cb_milter_timeout(mu_cfg_locus_t *locus, void *data, char *arg)
}
int
-cb_io_timeout(mu_cfg_locus_t *locus, void *data, char *arg)
+cb_io_timeout(mu_debug_t err, void *data, char *arg)
{
- if (cb_timeout(&io_timeout, locus, data, arg))
+ if (cb_timeout(&io_timeout, err, data, arg))
return 1;
return 0;
}
int
-cb_connect_timeout(mu_cfg_locus_t *locus, void *data, char *arg)
+cb_connect_timeout(mu_debug_t err, void *data, char *arg)
{
- if (cb_timeout(&connect_timeout, locus, data, arg))
+ if (cb_timeout(&connect_timeout, err, data, arg))
return 1;
return 0;
}
int
-cb_initial_response_timeout(mu_cfg_locus_t *locus, void *data, char *arg)
+cb_initial_response_timeout(mu_debug_t err, void *data, char *arg)
{
- if (cb_timeout(&response_timeout, locus, data, arg))
+ if (cb_timeout(&response_timeout, err, data, arg))
return 1;
return 0;
}
int
-cb_lock_retry_timeout(mu_cfg_locus_t *locus, void *data, char *arg)
+cb_lock_retry_timeout(mu_debug_t err, void *data, char *arg)
{
- if (cb_timeout(&lock_retry_timeout_option, locus, data, arg))
+ if (cb_timeout(&lock_retry_timeout_option, err, data, arg))
return 1;
return 0;
}
int
-cb_set_variable(mu_cfg_locus_t *locus, void *data, char *arg)
+cb_set_variable(mu_debug_t err, void *data, char *arg)
{
char *p, *value;
char *tmp = NULL;
for (p = arg; !(*p == ' ' || *p == '\t'); p++)
if (!*p) {
- mf_error_on_locus(locus, _("missing value"));
+ mf_error_on_locus(err, _("missing value"));
return 1;
}
for (; *p == ' ' || *p == '\t'; p++)
if (!*p) {
- mf_error_on_locus(locus, _("missing value"));
+ mf_error_on_locus(err, _("missing value"));
return 1;
}
@@ -1551,20 +1548,20 @@ cb_set_variable(mu_cfg_locus_t *locus, void *data, char *arg)
}
int
-cb_ehlo_domain(mu_cfg_locus_t *locus, void *data, char *arg)
+cb_ehlo_domain(mu_debug_t err, void *data, char *arg)
{
defer_initialize_variable("ehlo_domain", arg);
return 0;
}
int
-cb_mail_from_address(mu_cfg_locus_t *locus, void *data, char *arg)
+cb_mail_from_address(mu_debug_t err, void *data, char *arg)
{
- return mf_option_mailfrom(locus, arg);
+ return mf_option_mailfrom(err, arg);
}
int
-cb_debug(mu_cfg_locus_t *locus, void *data, char *arg)
+cb_debug(mu_debug_t err, void *data, char *arg)
{
debug_parse_spec(arg);
return 0;
@@ -1572,31 +1569,31 @@ cb_debug(mu_cfg_locus_t *locus, void *data, char *arg)
/* See also option_group. */
int
-cb_group(mu_cfg_locus_t *locus, void *data, char *arg)
+cb_group(mu_debug_t err, void *data, char *arg)
{
- return mf_option_group(locus, arg);
+ return mf_option_group(err, arg);
}
int
-cb_state_directory(mu_cfg_locus_t *locus, void *data, char *arg)
+cb_state_directory(mu_debug_t err, void *data, char *arg)
{
- return mf_option_state_directory(locus, arg);
+ return mf_option_state_directory(err, arg);
}
int
-cb_relay_file(mu_cfg_locus_t *locus, void *data, char *arg)
+cb_relay_file(mu_debug_t err, void *data, char *arg)
{
- return read_domain_file(locus, arg);
+ return read_domain_file(err, arg);
}
int
-cb_source_ip(mu_cfg_locus_t *locus, void *data, char *arg)
+cb_source_ip(mu_debug_t err, void *data, char *arg)
{
- return mf_option_source_ip(locus, arg, &source_address);
+ return mf_option_source_ip(err, arg, &source_address);
}
int
-cb_include_path(mu_cfg_locus_t *locus, void *data, char *arg)
+cb_include_path(mu_debug_t err, void *data, char *arg)
{
char *p, *sp;
@@ -1607,28 +1604,30 @@ cb_include_path(mu_cfg_locus_t *locus, void *data, char *arg)
/* Keep alphabetical ordering of statements */
struct mu_cfg_param mf_cfg_param[] = {
- { "connect-timeout", mu_cfg_callback, NULL, cb_connect_timeout },
- { "debug", mu_cfg_callback, NULL, cb_debug },
- { "ehlo-domain", mu_cfg_callback, NULL, cb_ehlo_domain },
- { "group", mu_cfg_callback, NULL, cb_group },
- { "include-path", mu_cfg_callback, NULL, cb_include_path },
- { "initial-response-timeout", mu_cfg_callback, NULL,
+ { "connect-timeout", mu_cfg_callback, NULL, 0, cb_connect_timeout },
+ { "debug", mu_cfg_callback, NULL, 0, cb_debug },
+ { "ehlo-domain", mu_cfg_callback, NULL, 0, cb_ehlo_domain },
+ { "group", mu_cfg_callback, NULL, 0, cb_group },
+ { "include-path", mu_cfg_callback, NULL, 0, cb_include_path },
+ { "initial-response-timeout", mu_cfg_callback, NULL, 0,
cb_initial_response_timeout },
- { "io-timeout", mu_cfg_callback, NULL, cb_io_timeout },
+ { "io-timeout", mu_cfg_callback, NULL, 0, cb_io_timeout },
{ "lock-retry-count", mu_cfg_size, &lock_retry_count_option },
- { "lock-retry-timeout", mu_cfg_callback, NULL,
+ { "lock-retry-timeout", mu_cfg_callback, NULL, 0,
cb_lock_retry_timeout },
- { "mail-from-address", mu_cfg_callback, NULL, cb_mail_from_address },
- { "milter-timeout", mu_cfg_callback, NULL, cb_milter_timeout },
+ { "mail-from-address", mu_cfg_callback, NULL, 0,
+ cb_mail_from_address },
+ { "milter-timeout", mu_cfg_callback, NULL, 0,
+ cb_milter_timeout },
{ "pidfile", mu_cfg_string, &pidfile },
- { "relay-file", mu_cfg_callback, NULL, cb_relay_file },
- { "setvar", mu_cfg_callback, NULL, cb_set_variable },
+ { "relay-file", mu_cfg_callback, NULL, 0, cb_relay_file },
+ { "setvar", mu_cfg_callback, NULL, 0, cb_set_variable },
{ "script-file", mu_cfg_string, &script_file },
{ "source-info", mu_cfg_bool, &source_info_option },
/* FIXME: Could have used mu_cfg_ipv4 here, but... */
- { "source-ip", mu_cfg_callback, NULL, cb_source_ip },
+ { "source-ip", mu_cfg_callback, NULL, 0, cb_source_ip },
{ "stack-trace", mu_cfg_bool, &stack_trace_option },
- { "state-directory", mu_cfg_callback, NULL, cb_state_directory },
+ { "state-directory", mu_cfg_callback, NULL, 0, cb_state_directory },
{ "user", mu_cfg_string, &user },
{ NULL }
};

Return to:

Send suggestions and report system problems to the System administrator.