diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-05-07 15:17:34 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-05-07 15:17:34 +0300 |
commit | 05a8bb0ca988f41f016420ffc7dde427e423c187 (patch) | |
tree | fff58297f073bec8148c2d5468a45d592eab0379 | |
parent | 9f8f65324491b4186f4fd3c2580a8e0b14a248d9 (diff) | |
download | mailfromd-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.texi | 8 | ||||
-rw-r--r-- | doc/mtasim.texi | 33 | ||||
-rw-r--r-- | gacopyz/Makefile.am | 1 | ||||
-rw-r--r-- | gacopyz/context.c | 4 | ||||
-rw-r--r-- | gacopyz/gacopyz.c | 71 | ||||
-rw-r--r-- | gacopyz/gacopyz.h | 58 | ||||
-rw-r--r-- | gacopyz/gacopyz_priv.h | 4 | ||||
-rw-r--r-- | gacopyz/server.c | 121 | ||||
-rw-r--r-- | gacopyz/smfi.c | 17 | ||||
-rw-r--r-- | gacopyz/stagenames.c | 27 | ||||
-rw-r--r-- | mfd/engine.c | 4 | ||||
-rw-r--r-- | mfd/gram.y | 44 | ||||
-rw-r--r-- | mfd/mailfromd.h | 2 | ||||
-rw-r--r-- | mtasim/mtasim.c | 111 |
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 | |||
@@ -12297,2 +12297,3 @@ errors}, for more information on this feature. | |||
12297 | 12297 | ||
12298 | @anchor{gacopyz-log option} | ||
12298 | @opsummary{gacopyz-log} | 12299 | @opsummary{gacopyz-log} |
@@ -12328,3 +12329,6 @@ This level can be useful for debugging your scripts. | |||
12328 | @item debug | 12329 | @item debug |
12329 | Log debugging information. This level prints huge amounts of | 12330 | Log debugging information. |
12331 | |||
12332 | @item proto | ||
12333 | Log Milter protocol interactions. This level prints huge amounts of | ||
12330 | information, in particular it displays dumps of each Milter packet | 12334 | information, in particular it displays dumps of each Milter packet |
@@ -12341,3 +12345,3 @@ default. If you need to trace each subprocess startup and shutdown, | |||
12341 | set @option{--gacopyz-log=info}. Setting the logging level to | 12345 | set @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 |
12343 | debug the protocol. | 12347 | debug the protocol. |
diff --git a/doc/mtasim.texi b/doc/mtasim.texi index a8849fea..513d045d 100644 --- a/doc/mtasim.texi +++ b/doc/mtasim.texi | |||
@@ -456,2 +456,10 @@ similar to the @code{\D} administrative command (@pxref{D command}) | |||
456 | 456 | ||
457 | @mtasimopt{gacopyz-log, summary} | ||
458 | @item --gacopyz-log=@var{level} | ||
459 | Set desired logging level for @command{gacopyz} library | ||
460 | (@pxref{Gacopyz}). @xref{gacopyz-log option}, for a detailed | ||
461 | description of @var{level}. Notice, that unless this option is used, | ||
462 | the @option{--verbose} (@option{-v}) command line option implies | ||
463 | @option{--gacopyz-log=debug}. | ||
464 | |||
457 | @mtasimopt{group, summary} | 465 | @mtasimopt{group, summary} |
@@ -478,4 +486,10 @@ privileges. | |||
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 | ||
490 | a version string in form @samp{@var{major}.@var{minor}[.@var{patch}]}, | ||
491 | where 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 | ||
494 | version are set automatically. This option | ||
481 | is intended for development and testing of the Gacopyz library | 495 | is intended for development and testing of the Gacopyz library |
@@ -483,2 +497,14 @@ is intended for development and testing of the Gacopyz library | |||
483 | 497 | ||
498 | @mtasimopt{milter-proto, summary} | ||
499 | @item --milter-proto=@var{bitmask} | ||
500 | Set Milter protocol capabilities. See @file{gacopyz/gacopyz.h} for | ||
501 | the meaning of various bits in the @var{bitmask}. Look for the C | ||
502 | macros with the prefix @samp{SMFIP_}. | ||
503 | |||
504 | @mtasimopt{milter-actions, summary} | ||
505 | @item --milter-actions=@var{bitmask} | ||
506 | Set Milter actions. See @file{gacopyz/gacopyz.h} for | ||
507 | the meaning of various bits in the @var{bitmask}. Look for the C | ||
508 | macros with the prefix @samp{SMFIF_}. | ||
509 | |||
484 | @mtasimopt{no-interactive, summary} | 510 | @mtasimopt{no-interactive, summary} |
@@ -522,3 +548,4 @@ is the default mode for @command{mtasim}. @xref{interactive mode}. | |||
522 | @itemx -v | 548 | @itemx -v |
523 | Increase verbosity level. | 549 | Increase verbosity level. Implies @option{--gacopyz-log=debug}, |
550 | unless that option is used explicitly. | ||
524 | 551 | ||
diff --git a/gacopyz/Makefile.am b/gacopyz/Makefile.am index 7d8c012b..d658b3e7 100644 --- a/gacopyz/Makefile.am +++ b/gacopyz/Makefile.am | |||
@@ -29,2 +29,3 @@ libgacopyz_a_SOURCES = \ | |||
29 | server.c\ | 29 | server.c\ |
30 | stagenames.c\ | ||
30 | trans.h | 31 | trans.h |
diff --git a/gacopyz/context.c b/gacopyz/context.c index 41d64c44..12094fdf 100644 --- a/gacopyz/context.c +++ b/gacopyz/context.c | |||
@@ -1,3 +1,3 @@ | |||
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 | ||
@@ -52,3 +52,3 @@ gacopyz_getsymval(SMFICTX *ctx, const char *name) | |||
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) { |
diff --git a/gacopyz/gacopyz.c b/gacopyz/gacopyz.c index f29681be..e26f7e2e 100644 --- a/gacopyz/gacopyz.c +++ b/gacopyz/gacopyz.c | |||
@@ -766,3 +766,3 @@ make_optneg_buf(SMFICTX *ctx, gacopyz_uint32_t *vbuf, | |||
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]) |
@@ -791,3 +791,3 @@ make_optneg_buf(SMFICTX *ctx, gacopyz_uint32_t *vbuf, | |||
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]) { |
@@ -903,3 +903,3 @@ clear_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]); |
@@ -964,3 +964,3 @@ shan_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; |
@@ -972,3 +972,3 @@ shan_macro(SMFICTX *ctx, union state_arg *arg, unsigned char *cmd) | |||
972 | case SMFIC_CONNECT: | 972 | case SMFIC_CONNECT: |
973 | ind = maci_conn; | 973 | ind = gacopyz_stage_conn; |
974 | break; | 974 | break; |
@@ -976,3 +976,3 @@ shan_macro(SMFICTX *ctx, union state_arg *arg, unsigned char *cmd) | |||
976 | case SMFIC_HELO: | 976 | case SMFIC_HELO: |
977 | ind = maci_helo; | 977 | ind = gacopyz_stage_helo; |
978 | break; | 978 | break; |
@@ -980,3 +980,3 @@ shan_macro(SMFICTX *ctx, union state_arg *arg, unsigned char *cmd) | |||
980 | case SMFIC_MAIL: | 980 | case SMFIC_MAIL: |
981 | ind = maci_mail; | 981 | ind = gacopyz_stage_mail; |
982 | break; | 982 | break; |
@@ -984,3 +984,3 @@ shan_macro(SMFICTX *ctx, union state_arg *arg, unsigned char *cmd) | |||
984 | case SMFIC_RCPT: | 984 | case SMFIC_RCPT: |
985 | ind = maci_rcpt; | 985 | ind = gacopyz_stage_rcpt; |
986 | break; | 986 | break; |
@@ -988,3 +988,3 @@ shan_macro(SMFICTX *ctx, union state_arg *arg, unsigned char *cmd) | |||
988 | case SMFIC_DATA: | 988 | case SMFIC_DATA: |
989 | ind = maci_data; | 989 | ind = gacopyz_stage_data; |
990 | break; | 990 | break; |
@@ -992,3 +992,3 @@ shan_macro(SMFICTX *ctx, union state_arg *arg, unsigned char *cmd) | |||
992 | case SMFIC_BODYEOB: | 992 | case SMFIC_BODYEOB: |
993 | ind = maci_eom; | 993 | ind = gacopyz_stage_eom; |
994 | break; | 994 | break; |
@@ -996,3 +996,3 @@ shan_macro(SMFICTX *ctx, union state_arg *arg, unsigned char *cmd) | |||
996 | case SMFIC_EOH: | 996 | case SMFIC_EOH: |
997 | ind = maci_eoh; | 997 | ind = gacopyz_stage_eoh; |
998 | break; | 998 | break; |
@@ -1348,29 +1348,29 @@ static struct state_disp disp[] = { | |||
1348 | { SMFIC_ABORT, "abort", | 1348 | { SMFIC_ABORT, "abort", |
1349 | arg_no_args, shan_abort, st_abrt, CT_CNT, maci_none }, | 1349 | arg_no_args, shan_abort, st_abrt, CT_CNT, gacopyz_stage_none }, |
1350 | { SMFIC_MACRO, "macro", | 1350 | { SMFIC_MACRO, "macro", |
1351 | arg_argvc, shan_macro, st_none, CT_CNT, maci_none }, | 1351 | arg_argvc, shan_macro, st_none, CT_CNT, gacopyz_stage_none }, |
1352 | { SMFIC_BODY, "body", | 1352 | { SMFIC_BODY, "body", |
1353 | arg_one_string, shan_body, st_body, CT_CNT, maci_none }, | 1353 | arg_one_string, shan_body, st_body, CT_CNT, gacopyz_stage_none }, |
1354 | { SMFIC_CONNECT, "connect", | 1354 | { SMFIC_CONNECT, "connect", |
1355 | arg_two_strings, shan_connect, st_conn, CT_CLR, maci_conn }, | 1355 | arg_two_strings, shan_connect, st_conn, CT_CLR, gacopyz_stage_conn }, |
1356 | { SMFIC_BODYEOB, "endm", | 1356 | { SMFIC_BODYEOB, "endm", |
1357 | arg_one_string, shan_endm, st_endm, CT_CNT, maci_eom }, | 1357 | arg_one_string, shan_endm, st_endm, CT_CNT, gacopyz_stage_eom }, |
1358 | { SMFIC_HELO, "helo", | 1358 | { SMFIC_HELO, "helo", |
1359 | arg_one_string, shan_helo, st_helo, CT_CLR, maci_helo }, | 1359 | arg_one_string, shan_helo, st_helo, CT_CLR, gacopyz_stage_helo }, |
1360 | { SMFIC_HEADER, "header", | 1360 | { SMFIC_HEADER, "header", |
1361 | arg_two_strings, shan_header, st_hdrs, CT_CNT, maci_none }, | 1361 | arg_two_strings, shan_header, st_hdrs, CT_CNT, gacopyz_stage_none }, |
1362 | { SMFIC_MAIL, "mail", | 1362 | { SMFIC_MAIL, "mail", |
1363 | arg_argv, shan_mail, st_mail, CT_CLR, maci_mail }, | 1363 | arg_argv, shan_mail, st_mail, CT_CLR, gacopyz_stage_mail }, |
1364 | { SMFIC_OPTNEG, "optneg", | 1364 | { SMFIC_OPTNEG, "optneg", |
1365 | arg_ints, shan_optneg, st_opts, CT_CNT, maci_none }, | 1365 | arg_ints, shan_optneg, st_opts, CT_CNT, gacopyz_stage_none }, |
1366 | { SMFIC_EOH, "eoh", | 1366 | { SMFIC_EOH, "eoh", |
1367 | arg_no_args, shan_eoh, st_eohs, CT_CNT, maci_none }, | 1367 | arg_no_args, shan_eoh, st_eohs, CT_CNT, gacopyz_stage_none }, |
1368 | { SMFIC_QUIT, "quit", | 1368 | { SMFIC_QUIT, "quit", |
1369 | arg_no_args, shan_quit, st_quit, CT_END, maci_none }, | 1369 | arg_no_args, shan_quit, st_quit, CT_END, gacopyz_stage_none }, |
1370 | { SMFIC_DATA, "data", | 1370 | { SMFIC_DATA, "data", |
1371 | arg_no_args, shan_data, st_data, CT_CNT, maci_none }, | 1371 | arg_no_args, shan_data, st_data, CT_CNT, gacopyz_stage_non |