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.h60
-rw-r--r--gacopyz/gacopyz_priv.h4
-rw-r--r--gacopyz/server.c121
-rw-r--r--gacopyz/smfi.c15
-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.c105
14 files changed, 380 insertions, 119 deletions
<
diff --git a/doc/mailfromd.texi b/doc/mailfromd.texi
index 3f8f893b..fd270c1a 100644
--- a/doc/mailfromd.texi
+++ b/doc/mailfromd.texi
@@ -12295,6 +12295,7 @@ Overrides @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
@@ -12326,7 +12327,10 @@ Apr 28 09:00:11 host mailfromd[9411]: finishing
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
@@ -12339,7 +12343,7 @@ other, it is seldom practical. Therefore, the option
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}.
diff --git a/doc/mtasim.texi b/doc/mtasim.texi
index a8849fea..513d045d 100644
--- a/doc/mtasim.texi
+++ b/doc/mtasim.texi
@@ -454,6 +454,14 @@ cases.
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}
@@ -476,11 +484,29 @@ privileges.
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, ,
@@ -520,7 +546,8 @@ is the default mode for @command{mtasim}. @xref{interactive mode}.
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
diff --git a/gacopyz/Makefile.am b/gacopyz/Makefile.am
index 7d8c012b..d658b3e7 100644
--- a/gacopyz/Makefile.am
+++ b/gacopyz/Makefile.am
@@ -27,6 +27,7 @@ libgacopyz_a_SOURCES = \
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
diff --git a/gacopyz/context.c b/gacopyz/context.c
index 41d64c44..12094fdf 100644
--- a/gacopyz/context.c
+++ b/gacopyz/context.c
@@ -1,5 +1,5 @@
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
@@ -50,7 +50,7 @@ gacopyz_getsymval(SMFICTX *ctx, const char *name)
50 if (name[len-1] == '}') 50 if (name[len-1] == '}')
51 len--; 51 len--;
52 52
53 for (i = maci_max - 1; i >= 0; i--) { 53 for (i = gacopyz_stage_max - 1; i >= 0; i--) {
54 if (ctx->macros[i].argv) { 54 if (ctx->macros[i].argv) {
55 char **p; 55 char **p;
56 56
diff --git a/gacopyz/gacopyz.c b/gacopyz/gacopyz.c
index f29681be..e26f7e2e 100644
--- a/gacopyz/gacopyz.c
+++ b/gacopyz/gacopyz.c
@@ -764,7 +764,7 @@ make_optneg_buf(SMFICTX *ctx, gacopyz_uint32_t *vbuf,
764 size_t bufsize = 0; 764 size_t bufsize = 0;
765 int i; 765 int i;
766 766
767 for (i = 0; i < maci_max; i++) { 767 for (i = 0; i < gacopyz_stage_max; i++) {
768 if (ctx->req_macros[i]) 768 if (ctx->req_macros[i])
769 bufsize += strlen(ctx->req_macros[i]) + 1 + 769 bufsize += strlen(ctx->req_macros[i]) + 1 +
770 sizeof(gacopyz_uint32_t); 770 sizeof(gacopyz_uint32_t);
@@ -789,7 +789,7 @@ make_optneg_buf(SMFICTX *ctx, gacopyz_uint32_t *vbuf,
789 *pbuf = buf; 789 *pbuf = buf;
790 790
791 buf += OPTLEN; 791 buf += OPTLEN;
792 for (i = 0; i < maci_max; i++) { 792 for (i = 0; i < gacopyz_stage_max; i++) {
793 if (ctx->req_macros[i]) { 793 if (ctx->req_macros[i]) {
794 gacopyz_uint32_t v; 794 gacopyz_uint32_t v;
795 size_t len; 795 size_t len;
@@ -901,7 +901,7 @@ macro_assoc_free(macro_assoc_t *p)
901static void 901static void
902clear_macros(SMFICTX *ctx, int i) 902clear_macros(SMFICTX *ctx, int i)
903{ 903{
904 for (; i < maci_max; i++) 904 for (; i < gacopyz_stage_max; i++)
905 macro_assoc_free(&ctx->macros[i]); 905 macro_assoc_free(&ctx->macros[i]);
906} 906}
907 907
@@ -962,7 +962,7 @@ shan_abort(SMFICTX *ctx, union state_arg *arg, unsigned char *cmd)
962static state_ret_type 962static state_ret_type
963shan_macro(SMFICTX *ctx, union state_arg *arg, unsigned char *cmd) 963shan_macro(SMFICTX *ctx, union state_arg *arg, unsigned char *cmd)
964{ 964{
965 enum macro_index ind; 965 enum gacopyz_stage ind;
966 char **p; 966 char **p;
967 967
968 if (!arg->argv.v) 968 if (!arg->argv.v)
@@ -970,31 +970,31 @@ shan_macro(SMFICTX *ctx, union state_arg *arg, unsigned char *cmd)
970 970
971 switch (arg->argv.cmd) { 971 switch (arg->argv.cmd) {
972 case SMFIC_CONNECT: 972 case SMFIC_CONNECT:
973 ind = maci_conn; 973 ind = gacopyz_stage_conn;
974 break; 974