Improve maidag, add testsuite.
* configure.ac: Add maidag/tests * maidag/Makefile.am (SUBDIRS): Add tests. * maidag/deliver.c (make_tmp): Write a message delimiter. (is_remote_url, is_mailer_url): Remove. (deliver_url): Allow for URLs without user name. * maidag/lmtp.c (lmtp_set_privs): Empty group list means do not switch to any groups. * maidag/maidag.c (mda_mode): New variable. (options): New option --mda. (cb_group, cb2_group): Create the list even if it is empty. (main): Handle --mda. * maidag/tests/.gitignore: New file. * maidag/tests/Makefile.am: New file. * maidag/tests/atlocal.in: New file. * maidag/tests/input.msg: New file. * maidag/tests/lmtp.at: New file. * maidag/tests/mda.at: New file. * maidag/tests/testsuite.at: New file. * maidag/tests/url-mbox.at: New file. * maidag/tests/input.msg: New file.
Showing
13 changed files
with
337 additions
and
43 deletions
... | @@ -1214,6 +1214,7 @@ AC_ARG_WITH([mh-bindir], | ... | @@ -1214,6 +1214,7 @@ AC_ARG_WITH([mh-bindir], |
1214 | AC_CONFIG_TESTDIR(libmailutils/tests) | 1214 | AC_CONFIG_TESTDIR(libmailutils/tests) |
1215 | AC_CONFIG_TESTDIR(testsuite) | 1215 | AC_CONFIG_TESTDIR(testsuite) |
1216 | AC_CONFIG_TESTDIR(frm/tests) | 1216 | AC_CONFIG_TESTDIR(frm/tests) |
1217 | AC_CONFIG_TESTDIR(maidag/tests) | ||
1217 | AC_CONFIG_TESTDIR(messages/tests) | 1218 | AC_CONFIG_TESTDIR(messages/tests) |
1218 | AC_CONFIG_TESTDIR(readmsg/tests) | 1219 | AC_CONFIG_TESTDIR(readmsg/tests) |
1219 | AC_CONFIG_TESTDIR(sieve/tests) | 1220 | AC_CONFIG_TESTDIR(sieve/tests) |
... | @@ -1224,6 +1225,8 @@ AC_CONFIG_FILES([libmailutils/tests/Makefile | ... | @@ -1224,6 +1225,8 @@ AC_CONFIG_FILES([libmailutils/tests/Makefile |
1224 | testsuite/atlocal | 1225 | testsuite/atlocal |
1225 | frm/tests/Makefile | 1226 | frm/tests/Makefile |
1226 | frm/tests/atlocal | 1227 | frm/tests/atlocal |
1228 | maidag/tests/Makefile | ||
1229 | maidag/tests/atlocal | ||
1227 | messages/tests/Makefile | 1230 | messages/tests/Makefile |
1228 | messages/tests/atlocal | 1231 | messages/tests/atlocal |
1229 | readmsg/tests/Makefile | 1232 | readmsg/tests/Makefile | ... | ... |
... | @@ -15,8 +15,7 @@ | ... | @@ -15,8 +15,7 @@ |
15 | # Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA | 15 | # Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA |
16 | # 02110-1301 USA | 16 | # 02110-1301 USA |
17 | 17 | ||
18 | INCLUDES = -I${top_srcdir} @MU_APP_COMMON_INCLUDES@ @GUILE_INCLUDES@ \ | 18 | SUBDIRS = . tests |
19 | @PYTHON_INCLUDES@ | ||
20 | 19 | ||
21 | sbin_PROGRAMS=maidag | 20 | sbin_PROGRAMS=maidag |
22 | maidag_SOURCES=\ | 21 | maidag_SOURCES=\ |
... | @@ -51,6 +50,9 @@ maidag_LDADD = \ | ... | @@ -51,6 +50,9 @@ maidag_LDADD = \ |
51 | @MU_COMMON_LIBRARIES@\ | 50 | @MU_COMMON_LIBRARIES@\ |
52 | @TCPWRAP_LIBRARIES@ | 51 | @TCPWRAP_LIBRARIES@ |
53 | 52 | ||
53 | INCLUDES = -I${top_srcdir} @MU_APP_COMMON_INCLUDES@ @GUILE_INCLUDES@ \ | ||
54 | @PYTHON_INCLUDES@ | ||
55 | |||
54 | install-exec-hook: | 56 | install-exec-hook: |
55 | for i in $(sbin_PROGRAMS); do\ | 57 | for i in $(sbin_PROGRAMS); do\ |
56 | chown root:mail $(DESTDIR)$(sbindir)/$$i;\ | 58 | chown root:mail $(DESTDIR)$(sbindir)/$$i;\ | ... | ... |
... | @@ -90,7 +90,9 @@ make_tmp (const char *from) | ... | @@ -90,7 +90,9 @@ make_tmp (const char *from) |
90 | free (buf); | 90 | free (buf); |
91 | 91 | ||
92 | rc = mu_stream_copy (out, in, 0, NULL); | 92 | rc = mu_stream_copy (out, in, 0, NULL); |
93 | 93 | if (rc == 0) | |
94 | /* Write out message delimiter */ | ||
95 | mu_stream_write (out, "\n", 1, NULL); | ||
94 | mu_stream_destroy (&in); | 96 | mu_stream_destroy (&in); |
95 | if (rc) | 97 | if (rc) |
96 | { | 98 | { |
... | @@ -347,26 +349,6 @@ deliver_to_user (mu_mailbox_t mbox, mu_message_t msg, | ... | @@ -347,26 +349,6 @@ deliver_to_user (mu_mailbox_t mbox, mu_message_t msg, |
347 | return failed ? exit_code : 0; | 349 | return failed ? exit_code : 0; |
348 | } | 350 | } |
349 | 351 | ||
350 | static int | ||
351 | is_remote_url (mu_url_t url) | ||
352 | { | ||
353 | const char *scheme; | ||
354 | int rc = mu_url_sget_scheme (url, &scheme); | ||
355 | return rc == 0 && strncmp (scheme, "remote+", 7) == 0; | ||
356 | } | ||
357 | |||
358 | static int | ||
359 | is_mailer_url (mu_url_t url) | ||
360 | { | ||
361 | mu_record_t record = NULL; | ||
362 | int (*pfn) (mu_mailer_t) = NULL; | ||
363 | |||
364 | return mu_registrar_lookup_url (url, MU_FOLDER_ATTRIBUTE_FILE, | ||
365 | &record, NULL) == 0 | ||
366 | && mu_record_get_mailer (record, &pfn) == 0 | ||
367 | && pfn; | ||
368 | } | ||
369 | |||
370 | int | 352 | int |
371 | deliver_url (mu_url_t url, mu_message_t msg, const char *name, char **errp) | 353 | deliver_url (mu_url_t url, mu_message_t msg, const char *name, char **errp) |
372 | { | 354 | { |
... | @@ -491,18 +473,7 @@ deliver (mu_message_t msg, char *dest_id, char **errp) | ... | @@ -491,18 +473,7 @@ deliver (mu_message_t msg, char *dest_id, char **errp) |
491 | } | 473 | } |
492 | status = mu_url_sget_user (url, &name); | 474 | status = mu_url_sget_user (url, &name); |
493 | if (status == MU_ERR_NOENT) | 475 | if (status == MU_ERR_NOENT) |
494 | { | ||
495 | if (!is_mailer_url (url) && !is_remote_url (url)) | ||
496 | { | ||
497 | maidag_error (_("no user name")); | ||
498 | if (errp) | ||
499 | asprintf (errp, "no such user"); | ||
500 | exit_code = EX_NOUSER; | ||
501 | return EX_NOUSER; | ||
502 | } | ||
503 | else | ||
504 | name = NULL; | 476 | name = NULL; |
505 | } | ||
506 | else if (status) | 477 | else if (status) |
507 | { | 478 | { |
508 | maidag_error (_("%s: cannot get user name from url: %s"), | 479 | maidag_error (_("%s: cannot get user name from url: %s"), | ... | ... |
... | @@ -607,7 +607,14 @@ lmtp_set_privs () | ... | @@ -607,7 +607,14 @@ lmtp_set_privs () |
607 | mu_iterator_t itr; | 607 | mu_iterator_t itr; |
608 | int rc; | 608 | int rc; |
609 | 609 | ||
610 | mu_list_count (lmtp_groups, &size); | 610 | rc = mu_list_count (lmtp_groups, &size); |
611 | if (rc) | ||
612 | { | ||
613 | mu_diag_funcall (MU_DIAG_ERROR, "mu_list_count", NULL, rc); | ||
614 | return EX_UNAVAILABLE; | ||
615 | } | ||
616 | if (size == 0) | ||
617 | return 0; /* nothing to do */ | ||
611 | gidset = calloc (size, sizeof (gidset[0])); | 618 | gidset = calloc (size, sizeof (gidset[0])); |
612 | if (!gidset) | 619 | if (!gidset) |
613 | { | 620 | { | ... | ... |
... | @@ -18,6 +18,8 @@ | ... | @@ -18,6 +18,8 @@ |
18 | 18 | ||
19 | #include "maidag.h" | 19 | #include "maidag.h" |
20 | 20 | ||
21 | int mda_mode; /* Force local MDA mode even if not started as | ||
22 | root */ | ||
21 | int multiple_delivery; /* Don't return errors when delivering to multiple | 23 | int multiple_delivery; /* Don't return errors when delivering to multiple |
22 | recipients */ | 24 | recipients */ |
23 | int ex_quota_tempfail; /* Return temporary failure if mailbox quota is | 25 | int ex_quota_tempfail; /* Return temporary failure if mailbox quota is |
... | @@ -74,6 +76,7 @@ static char args_doc[] = N_("[recipient...]"); | ... | @@ -74,6 +76,7 @@ static char args_doc[] = N_("[recipient...]"); |
74 | #define FOREGROUND_OPTION 260 | 76 | #define FOREGROUND_OPTION 260 |
75 | #define URL_OPTION 261 | 77 | #define URL_OPTION 261 |
76 | #define TRANSCRIPT_OPTION 262 | 78 | #define TRANSCRIPT_OPTION 262 |
79 | #define MDA_OPTION 263 | ||
77 | 80 | ||
78 | static struct argp_option options[] = | 81 | static struct argp_option options[] = |
79 | { | 82 | { |
... | @@ -87,6 +90,8 @@ static struct argp_option options[] = | ... | @@ -87,6 +90,8 @@ static struct argp_option options[] = |
87 | { "daemon", 'd', N_("NUMBER"), OPTION_ARG_OPTIONAL, | 90 | { "daemon", 'd', N_("NUMBER"), OPTION_ARG_OPTIONAL, |
88 | N_("runs in daemon mode with a maximum of NUMBER children"), GRID + 1 }, | 91 | N_("runs in daemon mode with a maximum of NUMBER children"), GRID + 1 }, |
89 | { "url", URL_OPTION, 0, 0, N_("deliver to given URLs"), GRID + 1 }, | 92 | { "url", URL_OPTION, 0, 0, N_("deliver to given URLs"), GRID + 1 }, |
93 | { "mda", MDA_OPTION, 0, 0, N_("force MDA mode even if not started as root"), | ||
94 | GRID + 1 }, | ||
90 | { "from", 'f', N_("EMAIL"), 0, | 95 | { "from", 'f', N_("EMAIL"), 0, |
91 | N_("specify the sender's name"), GRID + 1 }, | 96 | N_("specify the sender's name"), GRID + 1 }, |
92 | { NULL, 'r', NULL, OPTION_ALIAS, NULL }, | 97 | { NULL, 'r', NULL, OPTION_ALIAS, NULL }, |
... | @@ -216,6 +221,10 @@ parse_opt (int key, char *arg, struct argp_state *state) | ... | @@ -216,6 +221,10 @@ parse_opt (int key, char *arg, struct argp_state *state) |
216 | mu_argp_node_list_new (lst, "listen", arg); | 221 | mu_argp_node_list_new (lst, "listen", arg); |
217 | break; | 222 | break; |
218 | 223 | ||
224 | case MDA_OPTION: | ||
225 | mda_mode = 1; | ||
226 | break; | ||
227 | |||
219 | case TRANSCRIPT_OPTION: | 228 | case TRANSCRIPT_OPTION: |
220 | maidag_transcript = 1; | 229 | maidag_transcript = 1; |
221 | break; | 230 | break; |
... | @@ -292,23 +301,25 @@ cb_debug (mu_debug_t debug, void *data, mu_config_value_t *val) | ... | @@ -292,23 +301,25 @@ cb_debug (mu_debug_t debug, void *data, mu_config_value_t *val) |
292 | static int | 301 | static int |
293 | cb2_group (mu_debug_t debug, const char *gname, void *data) | 302 | cb2_group (mu_debug_t debug, const char *gname, void *data) |
294 | { | 303 | { |
295 | mu_list_t *plist = data; | 304 | mu_list_t list = data; |
296 | struct group *group; | 305 | struct group *group; |
297 | 306 | ||
298 | if (!*plist) | ||
299 | mu_list_create (plist); | ||
300 | group = getgrnam (gname); | 307 | group = getgrnam (gname); |
301 | if (!group) | 308 | if (!group) |
302 | mu_cfg_format_error (debug, MU_DEBUG_ERROR, _("unknown group: %s"), gname); | 309 | mu_cfg_format_error (debug, MU_DEBUG_ERROR, _("unknown group: %s"), gname); |
303 | else | 310 | else |
304 | mu_list_append (*plist, (void*)group->gr_gid); | 311 | mu_list_append (list, (void*)group->gr_gid); |
305 | return 0; | 312 | return 0; |
306 | } | 313 | } |
307 | 314 | ||
308 | static int | 315 | static int |
309 | cb_group (mu_debug_t debug, void *data, mu_config_value_t *arg) | 316 | cb_group (mu_debug_t debug, void *data, mu_config_value_t *arg) |
310 | { | 317 | { |
311 | return mu_cfg_string_value_cb (debug, arg, cb2_group, data); | 318 | mu_list_t *plist = data; |
319 | |||
320 | if (!*plist) | ||
321 | mu_list_create (plist); | ||
322 | return mu_cfg_string_value_cb (debug, arg, cb2_group, *plist); | ||
312 | } | 323 | } |
313 | 324 | ||
314 | static struct mu_kwd forward_checks[] = { | 325 | static struct mu_kwd forward_checks[] = { |
... | @@ -540,9 +551,11 @@ main (int argc, char *argv[]) | ... | @@ -540,9 +551,11 @@ main (int argc, char *argv[]) |
540 | exit (EX_CONFIG); | 551 | exit (EX_CONFIG); |
541 | 552 | ||
542 | current_uid = getuid (); | 553 | current_uid = getuid (); |
554 | if (!lmtp_mode && current_uid == 0) | ||
555 | mda_mode = 1; | ||
543 | 556 | ||
544 | if (log_to_stderr == -1) | 557 | if (log_to_stderr == -1) |
545 | log_to_stderr = url_option || (!lmtp_mode && (current_uid != 0)); | 558 | log_to_stderr = url_option || (!lmtp_mode && !mda_mode); |
546 | 559 | ||
547 | mu_diag_get_debug (&debug); | 560 | mu_diag_get_debug (&debug); |
548 | if (!log_to_stderr) | 561 | if (!log_to_stderr) |
... | @@ -571,7 +584,7 @@ main (int argc, char *argv[]) | ... | @@ -571,7 +584,7 @@ main (int argc, char *argv[]) |
571 | } | 584 | } |
572 | else | 585 | else |
573 | { | 586 | { |
574 | if (current_uid) | 587 | if (!mda_mode) |
575 | { | 588 | { |
576 | if (url_option) | 589 | if (url_option) |
577 | { | 590 | { |
... | @@ -582,7 +595,7 @@ main (int argc, char *argv[]) | ... | @@ -582,7 +595,7 @@ main (int argc, char *argv[]) |
582 | static char *s_argv[2]; | 595 | static char *s_argv[2]; |
583 | struct mu_auth_data *auth = mu_get_auth_by_uid (current_uid); | 596 | struct mu_auth_data *auth = mu_get_auth_by_uid (current_uid); |
584 | 597 | ||
585 | if (!current_uid) | 598 | if (!auth) |
586 | { | 599 | { |
587 | mu_error (_("cannot get username")); | 600 | mu_error (_("cannot get username")); |
588 | return EX_UNAVAILABLE; | 601 | return EX_UNAVAILABLE; | ... | ... |
maidag/tests/.gitignore
0 → 100644
maidag/tests/Makefile.am
0 → 100644
1 | # This file is part of GNU Mailutils. | ||
2 | # Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. | ||
3 | # | ||
4 | # GNU Mailutils is free software; you can redistribute it and/or | ||
5 | # modify it under the terms of the GNU General Public License as | ||
6 | # published by the Free Software Foundation; either version 3, or (at | ||
7 | # your option) any later version. | ||
8 | # | ||
9 | # This program is distributed in the hope that it will be useful, but | ||
10 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | # General Public License for more details. | ||
13 | # | ||
14 | # You should have received a copy of the GNU General Public License | ||
15 | # along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. | ||
16 | |||
17 | EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4 input.msg | ||
18 | DISTCLEANFILES = atconfig $(check_SCRIPTS) | ||
19 | MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE) | ||
20 | |||
21 | ## ------------ ## | ||
22 | ## package.m4. ## | ||
23 | ## ------------ ## | ||
24 | |||
25 | $(srcdir)/package.m4: $(top_srcdir)/configure.ac | ||
26 | $(AM_V_GEN){ \ | ||
27 | echo '# Signature of the current package.'; \ | ||
28 | echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \ | ||
29 | echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \ | ||
30 | echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \ | ||
31 | echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \ | ||
32 | echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \ | ||
33 | } >$(srcdir)/package.m4 | ||
34 | |||
35 | # | ||
36 | |||
37 | ## ------------ ## | ||
38 | ## Test suite. ## | ||
39 | ## ------------ ## | ||
40 | |||
41 | TESTSUITE_AT = \ | ||
42 | lmtp.at\ | ||
43 | mda.at\ | ||
44 | testsuite.at\ | ||
45 | url-mbox.at | ||
46 | |||
47 | TESTSUITE = $(srcdir)/testsuite | ||
48 | M4=m4 | ||
49 | |||
50 | AUTOTEST = $(AUTOM4TE) --language=autotest | ||
51 | $(TESTSUITE): package.m4 $(TESTSUITE_AT) $(top_srcdir)/testsuite/testsuite.inc | ||
52 | $(AM_V_GEN)$(AUTOTEST) -I $(srcdir) -I $(top_srcdir)/testsuite testsuite.at -o $@.tmp | ||
53 | $(AM_V_at)mv $@.tmp $@ | ||
54 | |||
55 | atconfig: $(top_builddir)/config.status | ||
56 | cd $(top_builddir) && ./config.status tests/$@ | ||
57 | |||
58 | clean-local: | ||
59 | @test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean | ||
60 | |||
61 | check-local: atconfig atlocal $(TESTSUITE) | ||
62 | @$(SHELL) $(TESTSUITE) | ||
63 | |||
64 | # Run the test suite on the *installed* tree. | ||
65 | #installcheck-local: | ||
66 | # $(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin | ||
67 | |||
68 |
maidag/tests/atlocal.in
0 → 100644
maidag/tests/input.msg
0 → 100644
1 | From: "Lemuel Gulliver, esq." <gulliver@example.net> | ||
2 | To: root | ||
3 | Subject: Travels into several remote Nations of the World | ||
4 | |||
5 | A LETTER from Capt. Gulliver, to his Cousin Sympson | ||
6 | |||
7 | I HOPE you will be ready to own publickly, whenever you shall be called | ||
8 | to it, that by your great and frequent Urgency you prevailed on me to | ||
9 | publish a very loose and uncorrect Account of my Travels; with Direction | ||
10 | to hire some young Gentlemen of either University to put them in Order, | ||
11 | and correct the Style, as my Cousin Dampier did by my Advice, in his | ||
12 | Book called A Voyage round the World. But I do not remember I gave you | ||
13 | Power to consent that any thing should be omitted, and much less that any | ||
14 | thing should be inserted: therefore, as to the latter, I do here renounce | ||
15 | every thing of that Kind; particularly a Paragraph about her Majesty the | ||
16 | late Queen Anne, of most pious and glorious Memory; although I did | ||
17 | reverence and esteem her more than any of human Species. But you, or | ||
18 | your Interpolator, ought to have considered, that as it was not my | ||
19 | Inclination, so was it not decent to praise any Animal of our Composition | ||
20 | before my Master Houyhnhnm: And besides the Fact was altogether false; | ||
21 | for to my Knowledge, being in England during some Part of her Majesty's | ||
22 | Reign, she did govern by a chief Minister; nay, even by two successively; | ||
23 | the first whereof was the Lord of Godolphin, and the second the Lord of | ||
24 | Oxford; so that you have made me say the thing that was not. Likewise, in | ||
25 | the Account of the Academy of Projectors, and several Passages of my | ||
26 | Discourse to my Master Houyhnhnm, you have either omitted some | ||
27 | material Circumstances, or minced or changed them in such a Manner, that | ||
28 | I do hardly know mine own Work. When I formerly hinted to you | ||
29 | something of this in a Letter, you were pleased to answer that you were | ||
30 | afraid of giving Offense; that People in Power were very watchful over the | ||
31 | Press, and apt not only to interpret, but to punish every thing which looked | ||
32 | like an Innuendo (as I think you called it.) But pray, how could that which | ||
33 | I spoke so many Years ago, and at about five Thousand leagues distance, in | ||
34 | another Reign, be applied to any of the Yahoos who now are said to govern | ||
35 | the Herd; especially at a time when I little thought on or feared the | ||
36 | Unhappiness of living under them. Have not I the most reason to complain, | ||
37 | when I see these very Yahoos carried by Houyhnhnms in a Vehicle, as if | ||
38 | these were Brutes, and those the rational Creatures? And indeed, to avoid | ||
39 | so monstrous and detestable a Sight was one principal Motive of my | ||
40 | Retirement hither. | ||
41 | |||
42 | Thus much I thought proper to tell you in Relation to yourself, and to the | ||
43 | Trust I reposed in you. | ||
44 |
maidag/tests/lmtp.at
0 → 100644
1 | # This file is part of GNU Mailutils. -*- Autotest -*- | ||
2 | # Copyright (C) 2010 Free Software Foundation, Inc. | ||
3 | # | ||
4 | # GNU Mailutils is free software; you can redistribute it and/or | ||
5 | # modify it under the terms of the GNU General Public License as | ||
6 | # published by the Free Software Foundation; either version 3, or (at | ||
7 | # your option) any later version. | ||
8 | # | ||
9 | # GNU Mailutils is distributed in the hope that it will be useful, but | ||
10 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | # General Public License for more details. | ||
13 | # | ||
14 | # You should have received a copy of the GNU General Public License | ||
15 | # along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. | ||
16 | |||
17 | AT_SETUP([LMTP mode]) | ||
18 | AT_KEYWORDS([maidag lmtp]) | ||
19 | |||
20 | m4_pushdef([tocrlf],[dnl | ||
21 | $abs_top_builddir/libmailutils/tests/fltst crlf encode read]) | ||
22 | |||
23 | AT_CHECK([ | ||
24 | AT_DATA([session_start],[LHLO localhost | ||
25 | MAIL FROM:<gulliver@example.net> | ||
26 | RCPT TO:<root@localhost> | ||
27 | DATA | ||
28 | ]) | ||
29 | AT_DATA([session_end],[. | ||
30 | QUIT | ||
31 | ]) | ||
32 | |||
33 | echo ENVELOPE > expout | ||
34 | cat $abs_top_srcdir/maidag/tests/input.msg >> expout | ||
35 | echo "" >> expout | ||
36 | |||
37 | cat session_start $abs_top_srcdir/maidag/tests/input.msg session_end | tocrlf > session || exit $? | ||
38 | |||
39 | mkdir spool | ||
40 | maidag MAIDAG_OPTIONS --set 'group=()' --lmtp < session >transcript || exit $? | ||
41 | |||
42 | sed '1s/From gulliver@example.net.*/ENVELOPE/' spool/root | ||
43 | cat transcript | tr -d '\r' | sed '/...-/d;s/ .*//' >&2 | ||
44 | ], | ||
45 | [0], | ||
46 | [expout], | ||
47 | [220 | ||
48 | 250 | ||
49 | 250 | ||
50 | 250 | ||
51 | 354 | ||
52 | 250 | ||
53 | 221 | ||
54 | ]) | ||
55 | |||
56 | AT_CLEANUP | ||
57 | |||
58 | m4_popdef([tocrlf]) |
maidag/tests/mda.at
0 → 100644
1 | # This file is part of GNU Mailutils. -*- Autotest -*- | ||
2 | # Copyright (C) 2010 Free Software Foundation, Inc. | ||
3 | # | ||
4 | # GNU Mailutils is free software; you can redistribute it and/or | ||
5 | # modify it under the terms of the GNU General Public License as | ||
6 | # published by the Free Software Foundation; either version 3, or (at | ||
7 | # your option) any later version. | ||
8 | # | ||
9 | # GNU Mailutils is distributed in the hope that it will be useful, but | ||
10 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | # General Public License for more details. | ||
13 | # | ||
14 | # You should have received a copy of the GNU General Public License | ||
15 | # along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. | ||
16 | |||
17 | AT_SETUP([MDA mode]) | ||
18 | AT_KEYWORDS([maidag mda0]) | ||
19 | |||
20 | AT_CHECK([ | ||
21 | echo ENVELOPE > expout | ||
22 | cat $abs_top_srcdir/maidag/tests/input.msg >> expout | ||
23 | echo "" >> expout | ||
24 | mkdir spool | ||
25 | maidag MAIDAG_OPTIONS --mda --from gulliver@example.net root < dnl | ||
26 | $abs_top_srcdir/maidag/tests/input.msg || exit $? | ||
27 | sed '1s/From gulliver@example.net.*/ENVELOPE/' spool/root | ||
28 | ], | ||
29 | [0], | ||
30 | [expout]) | ||
31 | |||
32 | AT_CLEANUP | ||
33 | |||
34 | # | ||
35 | AT_SETUP([MDA mode, explicit envelope]) | ||
36 | AT_KEYWORDS([maidag mda1]) | ||
37 | |||
38 | AT_CHECK([ | ||
39 | echo "From gulliver Thu Oct 7 19:10:57 2010" > expout | ||
40 | cat $abs_top_srcdir/maidag/tests/input.msg >> expout | ||
41 | mkdir spool | ||
42 | maidag MAIDAG_OPTIONS --mda --from gulliver@example.net root < expout || exit $? | ||
43 | echo "" >> expout | ||
44 | cat spool/root | ||
45 | ], | ||
46 | [0], | ||
47 | [expout]) | ||
48 | |||
49 | AT_CLEANUP | ||
50 |
maidag/tests/testsuite.at
0 → 100644
1 | # This file is part of GNU Mailutils. -*- Autotest -*- | ||
2 | # Copyright (C) 2010 Free Software Foundation, Inc. | ||
3 | # | ||
4 | # GNU Mailutils is free software; you can redistribute it and/or | ||
5 | # modify it under the terms of the GNU General Public License as | ||
6 | # published by the Free Software Foundation; either version 3, or (at | ||
7 | # your option) any later version. | ||
8 | # | ||
9 | # GNU Mailutils is distributed in the hope that it will be useful, but | ||
10 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | # General Public License for more details. | ||
13 | # | ||
14 | # You should have received a copy of the GNU General Public License | ||
15 | # along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. | ||
16 | |||
17 | m4_include([testsuite.inc]) | ||
18 | |||
19 | m4_define([MAIDAG_OPTIONS],[dnl | ||
20 | --no-site-config dnl | ||
21 | --no-user-config dnl | ||
22 | --set '|mailbox|mailbox-pattern='`pwd`/spool/'${user}' dnl | ||
23 | --set .auth.authorization=system dnl | ||
24 | --stderr]) | ||
25 | |||
26 | AT_INIT | ||
27 | AT_TESTED([maidag]) | ||
28 | MUT_VERSION(maidag) | ||
29 | m4_include([mda.at]) | ||
30 | m4_include([lmtp.at]) | ||
31 | m4_include([url-mbox.at]) | ||
32 |
maidag/tests/url-mbox.at
0 → 100644
1 | # This file is part of GNU Mailutils. -*- Autotest -*- | ||
2 | # Copyright (C) 2010 Free Software Foundation, Inc. | ||
3 | # | ||
4 | # GNU Mailutils is free software; you can redistribute it and/or | ||
5 | # modify it under the terms of the GNU General Public License as | ||
6 | # published by the Free Software Foundation; either version 3, or (at | ||
7 | # your option) any later version. | ||
8 | # | ||
9 | # GNU Mailutils is distributed in the hope that it will be useful, but | ||
10 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | # General Public License for more details. | ||
13 | # | ||
14 | # You should have received a copy of the GNU General Public License | ||
15 | # along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. | ||
16 | |||
17 | AT_SETUP([URL mode]) | ||
18 | AT_KEYWORDS([maidag url-mbox url]) | ||
19 | |||
20 | AT_CHECK([ | ||
21 | echo ENVELOPE > expout | ||
22 | cat $abs_top_srcdir/maidag/tests/input.msg >> expout | ||
23 | echo "" >> expout | ||
24 | mkdir spool | ||
25 | |||
26 | maidag MAIDAG_OPTIONS --from 'gulliver@example.net' --url mbox:spool/out < dnl | ||
27 | $abs_top_srcdir/maidag/tests/input.msg || exit $? | ||
28 | sed '1s/From gulliver@example.net.*/ENVELOPE/' spool/out | ||
29 | ], | ||
30 | [0], | ||
31 | [expout]) | ||
32 | |||
33 | AT_CLEANUP | ||
34 | |||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or sign in to post a comment