aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2007-04-28 09:48:40 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2007-04-28 09:48:40 +0000
commit22bf9913a1831690504a0ff1c43c209c5f258cea (patch)
treea37de21a742386bdf4a4f9a1d585520aa9171149 /src
parentb49ef04125f27858ffafd8be38f1e73d81fb1c27 (diff)
downloadmailfromd-22bf9913a1831690504a0ff1c43c209c5f258cea.tar.gz
mailfromd-22bf9913a1831690504a0ff1c43c209c5f258cea.tar.bz2
Bugfixes
git-svn-id: file:///svnroot/mailfromd/trunk@1389 7a8a7f39-df28-0410-adc6-e0d955640f24
Diffstat (limited to 'src')
-rw-r--r--src/engine.c5
-rw-r--r--src/gram.y19
-rw-r--r--src/main.c22
-rw-r--r--src/mu_dbm.c19
4 files changed, 37 insertions, 28 deletions
diff --git a/src/engine.c b/src/engine.c
index c4d28a2a..de567272 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -90,6 +90,7 @@ priv_get(SMFICTX *ctx)
test_data = md;
else
gacopyz_setpriv(ctx, md);
+ env_init(md->env);
xeval(md->env, smtp_state_begin);
}
}
@@ -868,6 +869,7 @@ filter_cleanup(SMFICTX *ctx)
struct message_data *md = priv_get(ctx);
debug(100,"cleaning up");
if (md) {
+ env_init(md->env);
xeval(md->env, smtp_state_end);
free(md->helostr);
destroy_environment(md->env);
@@ -1169,7 +1171,7 @@ static int
child_start()
{
signal(SIGPIPE, SIG_IGN);
- signal(SIGUSR1, SIG_IGN);
+ signal(SIGALRM, SIG_IGN);
return 0;
}
@@ -1364,7 +1366,6 @@ mailfromd_daemon()
signal(SIGQUIT, sig_stop);
signal(SIGHUP, sig_stop);
signal(SIGINT, sig_stop);
- signal(SIGUSR1, SIG_IGN);
if (!foreground) {
if (daemon(0, 0) == -1) {
diff --git a/src/gram.y b/src/gram.y
index afe12291..fe3c0504 100644
--- a/src/gram.y
+++ b/src/gram.y
@@ -439,6 +439,7 @@ decl : PROG state_ident DO stmtlist DONE
$$->v.progdecl.tree = $4.head;
outer_context = inner_context = context_none;
+ state_tag = smtp_state_none;
}
| progspecial DO stmtlist DONE
{
@@ -463,6 +464,7 @@ decl : PROG state_ident DO stmtlist DONE
np->v.progdecl.auto_count = forget_autos(PARMCOUNT(),
np->v.progdecl.auto_count);
outer_context = inner_context = context_none;
+ state_tag = smtp_state_none;
}
| FUNC fundecl DO stmtlist DONE
{
@@ -765,16 +767,19 @@ autodcl : TYPE IDENTIFIER
action : sendmail_action
{
- if (state_tag == smtp_state_begin)
- parse_error("sendmail action is not allowed "
- "in a begin block");
- else if (state_tag == smtp_state_end)
- parse_error("sendmail action is not allowed "
- "in an end block");
+ if (outer_context == context_handler) {
+ if (state_tag == smtp_state_begin)
+ parse_error("sendmail action is not "
+ "allowed in a begin block");
+ else if (state_tag == smtp_state_end)
+ parse_error("sendmail action is not "
+ "allowed in an end block");
+ }
}
| header_action
{
- if (state_tag == smtp_state_end)
+ if (outer_context == context_handler
+ && state_tag == smtp_state_end)
parse_error("header action is not allowed "
"in an end block");
}
diff --git a/src/main.c b/src/main.c
index 56aa2af2..d389ec46 100644
--- a/src/main.c
+++ b/src/main.c
@@ -805,7 +805,7 @@ enum mailfromd_option {
OPTION_DUMP_XREF,
OPTION_EXPIRE,
OPTION_FOREGROUND,
- OPTION_DEBUG_GACOPYZ,
+ OPTION_GACOPYZ_LOG,
OPTION_IGNORE_FAILED_READS,
OPTION_LINT,
OPTION_LOG_TAG,
@@ -958,8 +958,8 @@ static struct argp_option options[] = {
{ "xref", OPTION_DUMP_XREF, NULL, 0,
N_("Produce a cross-reference listing"), GRP+1 },
{ "dump-xref", 0, NULL, OPTION_ALIAS, NULL, GRP+1 },
- { "gacopyz-debug", OPTION_DEBUG_GACOPYZ, NULL, 0,
- N_("Milter protocol trace"), GRP+1 },
+ { "gacopyz-log", OPTION_GACOPYZ_LOG, N_("LEVEL"), 0,
+ N_("Set Gacopyz log level"), GRP+1 },
{ "stderr", 's', NULL, 0,
N_("Log to stderr"), GRP+1 },
{ "syslog", OPTION_SYSLOG, NULL, 0,
@@ -1201,9 +1201,15 @@ parse_opt (int key, char *arg, struct argp_state *state)
foreground = 1;
break;
- case OPTION_DEBUG_GACOPYZ:
- smfi_setdbg(1);
+ case OPTION_GACOPYZ_LOG:
+ {
+ int lev = gacopyz_string_to_log_level(arg);
+ if (lev == -1)
+ argp_error(state, "%s: invalid Gacopyz log level",
+ arg);
+ smfi_setlogmask(SMI_LOG_FROM(lev));
break;
+ }
case OPTION_LIST:
need_config = 0;
@@ -1259,7 +1265,11 @@ parse_opt (int key, char *arg, struct argp_state *state)
case OPTION_TRACE_PROGRAM:
enable_prog_trace(arg ? arg: "all");
break;
-
+
+ case ARGP_KEY_INIT:
+ smfi_setlogmask(SMI_LOG_FROM(SMI_LOG_WARN));
+ break;
+
case ARGP_KEY_FINI:
if (validate_options())
exit(EX_USAGE);
diff --git a/src/mu_dbm.c b/src/mu_dbm.c
index 2d7e23c9..4977ae43 100644
--- a/src/mu_dbm.c
+++ b/src/mu_dbm.c
@@ -219,21 +219,15 @@ int mu_dbm_errno;
static int
try_lock (int fd, int type, struct flock *fl)
{
- int i;
-#if 0
- signal(SIGALRM, SIG_IGN);
- alarm(lock_retry_count_option);
- i = fcntl (fd, F_SETLKW, fl);
- alarm(0);
- return i ? errno : 0;
-#endif
+ int i, rc;
+
for (i = 0; i < lock_retry_count_option; i++)
{
- if (fcntl (fd, F_SETLK, fl) == 0)
+ alarm (lock_retry_timeout_option);
+ rc = fcntl (fd, F_SETLKW, fl);
+ alarm (0);
+ if (rc == 0)
return 0;
- if (!(errno == EAGAIN || errno == EACCES))
- break;
- sleep (lock_retry_timeout_option);
}
return errno;
}
@@ -268,7 +262,6 @@ lock_file (const char *name, int fd, int type)
rc = try_lock (fd, type, &fl);
if (rc == 0)
{
- kill(0, SIGUSR1);
if (type == F_UNLCK)
yield (0, 100);
}

Return to:

Send suggestions and report system problems to the System administrator.