aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-05-07 15:17:34 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2009-05-07 15:17:34 +0300
commit05a8bb0ca988f41f016420ffc7dde427e423c187 (patch)
treefff58297f073bec8148c2d5468a45d592eab0379
parent9f8f65324491b4186f4fd3c2580a8e0b14a248d9 (diff)
downloadmailfromd-05a8bb0ca988f41f016420ffc7dde427e423c187.tar.gz
mailfromd-05a8bb0ca988f41f016420ffc7dde427e423c187.tar.bz2
Implement v6 negotiation on the server side.
* gacopyz/stagenames.c: New file. * gacopyz/Makefile.am (libgacopyz_a_SOURCES): Add stagenames.c. * gacopyz/gacopyz.c (gacopyz_context_loop): Free req_macros. (gacopyz_addrcpt_par): rename to gacopyz_add_rcpt_par. * gacopyz/gacopyz.h (SM_LM_VRS_MAJOR, SM_LM_VRS_MAJOR) (SM_LM_VRS_PLVL, GACOPYZ_SM_MKVER): New macros. (macro_index): Rename to gacopyz_stage. All uses updated. (smfi_version): New proto. (gacopyz_addrcpt_par): rename to gacopyz_add_rcpt_par. (gacopyz_stage_name): New declaration. (gacopyz_srv_get_required_macros): New proto. (gacopyz_srv_set_version, gacopyz_srv_set_protocol) (gacopyz_srv_set_actions): 2nd argument is unsigned long. * gacopyz/server.c (struct gacopyz_srv): New member req_macros. (gacopyz_srv_get_required_macros): New function. (gacopyz_srv_destroy): Free req_macros. (gacopyz_srv_negotiate): Read macros. * mfd/gram.y (milter_state_name): Removed. Use gacopyz_stage_name instead. * mtasim/mtasim.c: New options: --gacopyz-log, --milter-proto, --milter-acts. * doc/mtasim.texi, doc/mailfromd.texi: Update.
-rw-r--r--doc/mailfromd.texi8
-rw-r--r--doc/mtasim.texi33
-rw-r--r--gacopyz/Makefile.am1
-rw-r--r--gacopyz/context.c4
-rw-r--r--gacopyz/gacopyz.c71
-rw-r--r--gacopyz/gacopyz.h58
-rw-r--r--gacopyz/gacopyz_priv.h4
-rw-r--r--gacopyz/server.c121
-rw-r--r--gacopyz/smfi.c17
-rw-r--r--gacopyz/stagenames.c27
-rw-r--r--mfd/engine.c4
-rw-r--r--mfd/gram.y44
-rw-r--r--mfd/mailfromd.h2
-rw-r--r--mtasim/mtasim.c111
14 files changed, 383 insertions, 122 deletions
diff --git a/doc/mailfromd.texi b/doc/mailfromd.texi
index 3f8f893b..fd270c1a 100644
--- a/doc/mailfromd.texi
+++ b/doc/mailfromd.texi
@@ -12292,12 +12292,13 @@ else but for debugging, as it terribly degrades performance!
12292@item --stack-trace 12292@item --stack-trace
12293Add @acronym{MFL} stack trace information to runtime error output. 12293Add @acronym{MFL} stack trace information to runtime error output.
12294Overrides @code{#pragma option stack-trace}, which you are advised to 12294Overrides @code{#pragma option stack-trace}, which you are advised to
12295use instead (@pxref{pragma stack-trace}). @xref{tracing runtime 12295use instead (@pxref{pragma stack-trace}). @xref{tracing runtime
12296errors}, for more information on this feature. 12296errors}, for more information on this feature.
12297 12297
12298@anchor{gacopyz-log option}
12298@opsummary{gacopyz-log} 12299@opsummary{gacopyz-log}
12299@item --gacopyz-log=@var{level} 12300@item --gacopyz-log=@var{level}
12300Set desired logging level for @command{gacopyz} library 12301Set desired logging level for @command{gacopyz} library
12301(@pxref{Gacopyz}). There are five logging levels. The following 12302(@pxref{Gacopyz}). There are five logging levels. The following
12302table lists them in order of decreasing priority: 12303table lists them in order of decreasing priority:
12303 12304
@@ -12323,26 +12324,29 @@ Apr 28 09:00:11 host mailfromd[9411]: finishing
12323 connection 12324 connection
12324@end smallexample 12325@end smallexample
12325 12326
12326This level can be useful for debugging your scripts. 12327This level can be useful for debugging your scripts.
12327 12328
12328@item debug 12329@item debug
12329Log debugging information. This level prints huge amounts of 12330Log debugging information.
12331
12332@item proto
12333Log Milter protocol interactions. This level prints huge amounts of
12330information, in particular it displays dumps of each Milter packet 12334information, in particular it displays dumps of each Milter packet
12331sent and received. 12335sent and received.
12332 12336
12333@end table 12337@end table
12334 12338
12335Although it is possible to set these levels independently of each 12339Although it is possible to set these levels independently of each
12336other, it is seldom practical. Therefore, the option 12340other, it is seldom practical. Therefore, the option
12337@option{--gacopyz-log=@var{level}} enables all logging levels from 12341@option{--gacopyz-log=@var{level}} enables all logging levels from
12338@var{level} up. For example, @option{--gacopyz-log=warn} enables 12342@var{level} up. For example, @option{--gacopyz-log=warn} enables
12339log levels @samp{warn}, @samp{err} and @samp{fatal}. It is the 12343log levels @samp{warn}, @samp{err} and @samp{fatal}. It is the
12340default. If you need to trace each subprocess startup and shutdown, 12344default. If you need to trace each subprocess startup and shutdown,
12341set @option{--gacopyz-log=info}. Setting the logging level to 12345set @option{--gacopyz-log=info}. Setting the logging level to
12342@samp{debug} can be needed only for @command{Gacopyz} developers, to 12346@samp{proto} can be needed only for @command{Gacopyz} developers, to
12343debug the protocol. 12347debug the protocol.
12344 12348
12345@xref{Testing Filter Scripts}. 12349@xref{Testing Filter Scripts}.
12346 12350
12347@opsummary{log-facility} 12351@opsummary{log-facility}
12348@item --log-facility=@var{facility} 12352@item --log-facility=@var{facility}
diff --git a/doc/mtasim.texi b/doc/mtasim.texi
index a8849fea..513d045d 100644
--- a/doc/mtasim.texi
+++ b/doc/mtasim.texi
@@ -451,12 +451,20 @@ cases.
451@mtindex D, -D, @command{mtasim} option, summary 451@mtindex D, -D, @command{mtasim} option, summary
452@item --define=@var{macro}=@var{value} 452@item --define=@var{macro}=@var{value}
453@itemx -D @var{macro}=@var{value} 453@itemx -D @var{macro}=@var{value}
454 Define Sendmail macro @var{macro} to the given @var{value}. It is 454 Define Sendmail macro @var{macro} to the given @var{value}. It is
455similar to the @code{\D} administrative command (@pxref{D command}) 455similar to the @code{\D} administrative command (@pxref{D command})
456 456
457@mtasimopt{gacopyz-log, summary}
458@item --gacopyz-log=@var{level}
459Set desired logging level for @command{gacopyz} library
460(@pxref{Gacopyz}). @xref{gacopyz-log option}, for a detailed
461description of @var{level}. Notice, that unless this option is used,
462the @option{--verbose} (@option{-v}) command line option implies
463@option{--gacopyz-log=debug}.
464
457@mtasimopt{group, summary} 465@mtasimopt{group, summary}
458@mtindex g, -g, @command{mtasim} option, summary 466@mtindex g, -g, @command{mtasim} option, summary
459@item --group=@var{name} 467@item --group=@var{name}
460@itemx -g @var{name} 468@itemx -g @var{name}
461When switching to user's privileges as requested by the 469When switching to user's privileges as requested by the
462@option{--user} command line option, retain the additional group 470@option{--user} command line option, retain the additional group
@@ -473,17 +481,35 @@ privileges.
473 481
474@item --help 482@item --help
475@itemx -? 483@itemx -?
476 Display a short help summary 484 Display a short help summary
477 485
478@mtasimopt{milter-version, summary} 486@mtasimopt{milter-version, summary}
479@item --milter-version=@var{number} 487@item --milter-version=@var{version}
480 Force using the given Milter protocol version number. This option 488 Force using the given Milter protocol version number. The
489@var{version} argument is either a numeric version (e.g. @samp{2}), or
490a version string in form @samp{@var{major}.@var{minor}[.@var{patch}]},
491where square brackets indicate optional part. The default is
492@samp{1.0.0}. If @var{version} is any of @samp{2}, @samp{3} or
493@samp{1.0.0}, the default protocol capabilities and actions for that
494version are set automatically. This option
481is intended for development and testing of the Gacopyz library 495is intended for development and testing of the Gacopyz library
482(@pxref{Gacopyz}). 496(@pxref{Gacopyz}).
483 497
498@mtasimopt{milter-proto, summary}
499@item --milter-proto=@var{bitmask}
500Set Milter protocol capabilities. See @file{gacopyz/gacopyz.h} for
501the meaning of various bits in the @var{bitmask}. Look for the C
502macros with the prefix @samp{SMFIP_}.
503
504@mtasimopt{milter-actions, summary}
505@item --milter-actions=@var{bitmask}
506Set Milter actions. See @file{gacopyz/gacopyz.h} for
507the meaning of various bits in the @var{bitmask}. Look for the C
508macros with the prefix @samp{SMFIF_}.
509
484@mtasimopt{no-interactive, summary} 510@mtasimopt{no-interactive, summary}
485@item --no-interactive 511@item --no-interactive
486 Not-interactive mode (disable readline). @xref{Command Line Editing, , 512 Not-interactive mode (disable readline). @xref{Command Line Editing, ,
487Command Line Editing, readline, GNU Readline Library}. 513Command Line Editing, readline, GNU Readline Library}.
488 514
489@mtasimopt{port, summary} 515@mtasimopt{port, summary}
@@ -517,13 +543,14 @@ is the default mode for @command{mtasim}. @xref{interactive mode}.
517 Display option summary 543 Display option summary
518 544
519@mtasimopt{verbose, summary} 545@mtasimopt{verbose, summary}
520@mtindex v, -v, @command{mtasim} option, summary 546@mtindex v, -v, @command{mtasim} option, summary
521@item --verbose 547@item --verbose
522@itemx -v 548@itemx -v
523 Increase verbosity level. 549 Increase verbosity level. Implies @option{--gacopyz-log=debug},
550unless that option is used explicitly.
524 551
525@item --version 552@item --version
526@itemx -V 553@itemx -V
527 Print program version 554 Print program version
528 555
529@end table 556@end table
diff --git a/gacopyz/Makefile.am b/gacopyz/Makefile.am
index 7d8c012b..d658b3e7 100644
--- a/gacopyz/Makefile.am
+++ b/gacopyz/Makefile.am
@@ -24,12 +24,13 @@ libgacopyz_a_SOURCES = \
24 context.c\ 24 context.c\
25 io.c\ 25 io.c\
26 log.c\ 26 log.c\
27 mfapi.h\ 27 mfapi.h\
28 proc.c\ 28 proc.c\
29 server.c\ 29 server.c\
30 stagenames.c\
30 trans.h 31 trans.h
31 32
32EXTRA_DIST=trans.tab trans.awk 33EXTRA_DIST=trans.tab trans.awk
33BUILT_SOURCES=trans.h 34BUILT_SOURCES=trans.h
34INCLUDES=-I$(top_srcdir)/gnu -I../gnu 35INCLUDES=-I$(top_srcdir)/gnu -I../gnu
35 36
diff --git a/gacopyz/context.c b/gacopyz/context.c
index 41d64c44..12094fdf 100644
--- a/gacopyz/context.c
+++ b/gacopyz/context.c
@@ -1,8 +1,8 @@
1/* This file is part of gacopyz. 1/* This file is part of gacopyz.
2 Copyright (C) 2006, 2007 Sergey Poznyakoff 2 Copyright (C) 2006, 2007, 2009 Sergey Poznyakoff
3 3
4 This program is free software; you can redistribute it and/or modify 4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3, or (at your option) 6 the Free Software Foundation; either version 3, or (at your option)
7 any later version. 7 any later version.
8 8
@@ -47,13 +47,13 @@ gacopyz_getsymval(SMFICTX *ctx, const char *name)