/*++ /* NAME /* mail_addr_map 3 /* SUMMARY /* generic address mapping /* SYNOPSIS /* #include <mail_addr_map.h> /* /* ARGV *mail_addr_map_internal(path, address, propagate) /* MAPS *path; /* const char *address; /* int propagate; /* /* ARGV *mail_addr_map_opt(path, address, propagate, in_form, /* query_form, out_form) /* MAPS *path; /* const char *address; /* int propagate; /* int in_form; /* int query_form; /* int out_form; /* DESCRIPTION /* mail_addr_map_*() returns the translation for the named address, /* or a null pointer if none is found. /* /* With mail_addr_map_internal(), the search address and results /* are in internal (unquoted) form. /* /* mail_addr_map_opt() gives more control, at the cost of additional /* conversions between internal and external forms. /* /* When the \fBpropagate\fR argument is non-zero, /* address extensions that aren't explicitly matched in the lookup /* table are propagated to the result addresses. The caller is /* expected to pass the lookup result to argv_free(). /* /* Lookups are performed by mail_addr_find_*(). When the result has the /* form \fI@otherdomain\fR, the result is the original user in /* \fIotherdomain\fR. /* /* Arguments: /* .IP path /* Dictionary search path (see maps(3)). /* .IP address /* The address to be looked up in external (quoted) form, or /* in the form specified with the in_form argument. /* .IP query_form /* Database query address forms, either MA_FORM_INTERNAL (unquoted /* form), MA_FORM_EXTERNAL (quoted form), MA_FORM_EXTERNAL_FIRST /* (external, then internal if the forms differ), or /* MA_FORM_INTERNAL_FIRST (internal, then external if the forms /* differ). /* .IP in_form /* .IP out_form /* Input and output address forms, either MA_FORM_INTERNAL (unquoted /* form) or MA_FORM_EXTERNAL (quoted form). /* DIAGNOSTICS /* Warnings: map lookup returns a non-address result. /* /* The path->error value is non-zero when the lookup /* failed with a non-permanent error. /* SEE ALSO /* mail_addr_find(3), mail address matching /* mail_addr_crunch(3), mail address parsing and rewriting /* LICENSE /* .ad /* .fi /* The Secure Mailer license must be distributed with this software. /* AUTHOR(S) /* Wietse Venema /* IBM T.J. Watson Research /* P.O. Box 704 /* Yorktown Heights, NY 10598, USA /* /* Wietse Venema /* Google, Inc. /* 111 8th Avenue /* New York, NY 10011, USA
/*--*/
typedefstruct { constchar *testname; constchar *database; int propagate; constchar *delimiter; int in_form; int query_form; int out_form; constchar *address; constchar *expect_argv[2]; int expect_argc;
} MAIL_ADDR_MAP_TEST;
staticint compare(constchar *testname, constchar **expect_argv, int expect_argc, char **result_argv, int result_argc)
{ int n; int err = 0;
if (expect_argc != 0 && result_argc != 0) { for (n = 0; n < expect_argc && n < result_argc; n++) { if (strcmp(expect_argv[n], result_argv[n]) != 0) {
msg_warn("fail test %s: expect[%d]='%s', result[%d]='%s'",
testname, n, expect_argv[n], n, result_argv[n]);
err = 1;
}
}
} if (expect_argc != result_argc) {
msg_warn("fail test %s: expects %d results but there were %d",
testname, expect_argc, result_argc); for (n = expect_argc; n < result_argc; n++)
msg_info("no expect to match result[%d]='%s'", n, result_argv[n]); for (n = result_argc; n < expect_argc; n++)
msg_info("no result to match expect[%d]='%s'", n, expect_argv[n]);
err = 1;
} return (err);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.