form "name = value" instead of the expected "name=value".
Found during code maintenance. Also refined an "empty name"
check. Files: clean_env.c, split_nameval.c.
+
+ Safety: Postfix programs log a warning when a configuration
+ parameter specifies a list that contains a #comment. Examples
+ of such parameters are smtpd_*_restrictions, check_ccert_access,
+ and restriction_classes. This affects about 70 call sites
+ where a list is parsed. Files: proto/stop.spell-cc,
+ src/cleanup/cleanup_init.c, src/global/dict_ldap.c,
+ src/global/dict_mysql.c, src/global/dict_pgsql.c,
+ src/global/dynamicmaps.c, src/global/header_opts.c,
+ src/global/login_sender_match.c, src/global/mail_conf.c,
+ src/global/maillog_client.c, src/global/mail_parm_split.c,
+ src/global/mail_queue.c, src/global/maps.c,
+ src/global/map_search.c, src/global/own_inet_addr.c,
+ src/global/server_acl.c, src/local/dotforward.c,
+ src/master/master_ent.c, src/milter/milter8.c, src/milter/milter.c,
+ src/oqmgr/qmgr_message.c, src/postfix/postfix.c,
+ src/postmulti/postmulti.c, src/postscreen/postscreen_dnsbl.c,
+ src/postsuper/postsuper.c, src/proxymap/proxymap.c,
+ src/qmgr/qmgr_message.c, src/sendmail/sendmail.c,
+ src/smtpd/smtpd_check.c, src/smtp/smtp_connect.c,
+ src/smtp/smtp_tls_policy.c, src/tls/tls_certkey.c,
+ src/tls/tls_dane.c, src/util/argv.h, src/util/argv_split.c,
+ src/util/argv_splitq.c, src/util/dict_file.c,
+ src/util/dict_inline.c, src/util/dict_pipe.c,
+ src/util/dict_random.c, src/util/dict_stream.c,
+ src/util/dict_union.c, src/util/match_list.c, src/util/mystrtok.c,
+ src/util/name_mask.c, src/util/stringops.h.
The location of the Postfix top-level queue directory.
<b><a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a> (empty)</b>
- Don't rewrite message headers from remote clients at all when
- this parameter is empty; otherwise, rewrite message headers and
- append the specified domain name to incomplete addresses.
+ Rewrite or add message headers in mail from remote clients if
+ the <a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a> parameter value is non-empty,
+ updating incomplete addresses with the domain specified in the
+ <a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a> parameter, and adding missing head-
+ ers.
<b><a href="postconf.5.html#syslog_facility">syslog_facility</a> (mail)</b>
The syslog facility of Postfix logging.
111 8th Avenue
New York, NY 10011, USA
+ Wietse Venema
+
SENDMAIL(1)
</pre> </body> </html>
The location of the Postfix top-level queue directory.
<b><a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a> (empty)</b>
- Don't rewrite message headers from remote clients at all when
- this parameter is empty; otherwise, rewrite message headers and
- append the specified domain name to incomplete addresses.
+ Rewrite or add message headers in mail from remote clients if
+ the <a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a> parameter value is non-empty,
+ updating incomplete addresses with the domain specified in the
+ <a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a> parameter, and adding missing head-
+ ers.
<b><a href="postconf.5.html#syslog_facility">syslog_facility</a> (mail)</b>
The syslog facility of Postfix logging.
111 8th Avenue
New York, NY 10011, USA
+ Wietse Venema
+
SENDMAIL(1)
</pre> </body> </html>
The Linux PLD project
Dean Strik, Eindhoven University, The Netherlands
+ Wietse Venema
+
POSTFIX(1)
</pre> </body> </html>
111 8th Avenue
New York, NY 10011, USA
+ Wietse Venema
+
POSTMULTI(1)
</pre> </body> </html>
subdirectory levels.
<b><a href="postconf.5.html#import_environment">import_environment</a> (see 'postconf -d' output)</b>
- The list of environment parameters that a privileged Postfix
+ The list of environment variables that a privileged Postfix
process will import from a non-Postfix parent process, or
name=value environment overrides.
111 8th Avenue
New York, NY 10011, USA
+ Wietse Venema
+
POSTSUPER(1)
</pre> </body> </html>
111 8th Avenue
New York, NY 10011, USA
+ Wietse Venema
+
PROXYMAP(8)
</pre> </body> </html>
The location of the Postfix top-level queue directory.
<b><a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a> (empty)</b>
- Don't rewrite message headers from remote clients at all when
- this parameter is empty; otherwise, rewrite message headers and
- append the specified domain name to incomplete addresses.
+ Rewrite or add message headers in mail from remote clients if
+ the <a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a> parameter value is non-empty,
+ updating incomplete addresses with the domain specified in the
+ <a href="postconf.5.html#remote_header_rewrite_domain">remote_header_rewrite_domain</a> parameter, and adding missing head-
+ ers.
<b><a href="postconf.5.html#syslog_facility">syslog_facility</a> (mail)</b>
The syslog facility of Postfix logging.
111 8th Avenue
New York, NY 10011, USA
+ Wietse Venema
+
SENDMAIL(1)
</pre> </body> </html>
# Non-production: needs thorough testing, or major changes are still
# needed before the code stabilizes.
-#CCARGS="$CCARGS -DNONPROD"
+CCARGS="$CCARGS -DNONPROD"
# Workaround: prepend Postfix include files before other include files.
CCARGS="-I. -I../../include $CCARGS"
Jun\-ichiro 'itojun' Hagino, KAME project, Japan
The Linux PLD project
Dean Strik, Eindhoven University, The Netherlands
+
+Wietse Venema
Google, Inc.
111 8th Avenue
New York, NY 10011, USA
+
+Wietse Venema
with exactly one recipient \fBuser@example.com\fR:
.sp
.nf
-postqueue \-j | jq -r '
+postqueue \-j | jq \-r '
# See JSON OBJECT FORMAT section in the postqueue(1) manpage
select(.recipients[0].address == "user@example.com")
| select(.recipients[1].address == null)
' | postsuper \-d \-
.fi
.sp
-(note the "jq -r" option), or the historical form:
+(note the "jq \-r" option), or the historical form:
.sp
.nf
mailq | tail \-n +2 | grep \-v '^ *(' | awk 'BEGIN { RS = "" }
The names of queue directories that are split across multiple
subdirectory levels.
.IP "\fBimport_environment (see 'postconf -d' output)\fR"
-The list of environment parameters that a privileged Postfix
+The list of environment variables that a privileged Postfix
process will import from a non\-Postfix parent process, or name=value
environment overrides.
.IP "\fBqueue_directory (see 'postconf -d' output)\fR"
Google, Inc.
111 8th Avenue
New York, NY 10011, USA
+
+Wietse Venema
.IP "\fBqueue_directory (see 'postconf -d' output)\fR"
The location of the Postfix top\-level queue directory.
.IP "\fBremote_header_rewrite_domain (empty)\fR"
-Don't rewrite message headers from remote clients at all when
-this parameter is empty; otherwise, rewrite message headers and
-append the specified domain name to incomplete addresses.
+Rewrite or add message headers in mail from remote clients if
+the remote_header_rewrite_domain parameter value is non\-empty,
+updating incomplete addresses with the domain specified in the
+remote_header_rewrite_domain parameter, and adding missing headers.
.IP "\fBsyslog_facility (mail)\fR"
The syslog facility of Postfix logging.
.IP "\fBsyslog_name (see 'postconf -d' output)\fR"
Google, Inc.
111 8th Avenue
New York, NY 10011, USA
+
+Wietse Venema
Google, Inc.
111 8th Avenue
New York, NY 10011, USA
+
+Wietse Venema
util net_mask_top hc smtpd smtpd c smtpd smtpd_peer c
util inet_prefix_top hc smtpd smtpd c smtpd smtpd_peer c
File smtp smtp h
+ src master master_ent c src milter milter8 c src milter milter c
+ src oqmgr qmgr_message c src postfix postfix c
+ src postmulti postmulti c src postscreen postscreen_dnsbl c
+ src postsuper postsuper c src proxymap proxymap c
+ src postsuper postsuper c src proxymap proxymap c
+ src qmgr qmgr_message c src sendmail sendmail c
bitcount
bytecount
ipproto
+cw
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
name_mask(VAR_CANON_CLASSES, rcpt_canon_class_table,
var_rcpt_canon_classes);
if (*var_masq_domains)
- cleanup_masq_domains = argv_split(var_masq_domains, CHARS_COMMA_SP);
+ cleanup_masq_domains =
+ argv_split_cw(var_masq_domains, CHARS_COMMA_SP, VAR_MASQ_DOMAINS);
if (*var_header_checks)
cleanup_header_checks =
maps_create(VAR_HEADER_CHECKS, var_header_checks, DICT_FLAG_LOCK);
/* SYNOPSIS
/* #include <attr_override.h>
/*
-/* void attr_override(bp, delimiters, parens, ... CA_ATTR_OVER_END);
+/* void attr_override(blame, bp, delimiters, parens, ...,
+/* CA_ATTR_OVER_END)
/* char *bp;
/* const char *delimiters;
/* const char *parens;
/* fall-back policies, etc.).
/*
/* Arguments:
+/* .IP blame
+/* Context for error messages.
/* .IP bp
/* Pointer to input string. The input is modified.
/* .IP "delimiters, parens"
/* IBM T.J. Watson Research
/* P.O. Box 704
/* Yorktown Heights, NY 10598, USA
+/*
+/* Wietse Venema
/*--*/
/*
/* attr_override - apply settings from list of attribute=value pairs */
-void attr_override(char *cp, const char *sep, const char *parens,...)
+void attr_override(const char *blame, char *cp, const char *sep, const char *parens,...)
{
static const char myname[] = "attr_override";
va_list ap;
*/
/* { name = value } */
if (*nameval == parens[0]
- && (err = extpar(&nameval, parens, EXTPAR_FLAG_NONE)) != 0)
+ && (err = extpar(&nameval, parens, EXTPAR_FLAG_STRIP)) != 0)
msg_fatal("%s in \"%s\"", err, nameval);
+ if (*nameval == '#')
+ msg_fatal("%s: #comment after other text is not allowed: \"...%s...\"",
+ blame, nameval);
if ((err = split_nameval(nameval, &key, &value)) != 0)
- msg_fatal("malformed option: %s: \"...%s...\"", err, nameval);
+ msg_fatal("%s: malformed option: %s: \"...%s...\"", blame, err, nameval);
+ if (*value == '#')
+ msg_fatal("%s: #comment after other text is not allowed: \"...%s %s\"",
+ blame, key, value);
/*
* Look up the name and apply the value.
*/
#include <check_arg.h>
-extern void attr_override(char *, const char *, const char *,...);
+extern void attr_override(const char *, char *, const char *, const char *,...);
typedef struct {
const char *name;
/* IBM T.J. Watson Research
/* P.O. Box 704
/* Yorktown Heights, NY 10598, USA
+/*
+/* Wietse Venema
/*--*/
#endif
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/*
* The settings is in the form of associations separated by comma. Split
* it into separate associations.
*/
- associations = argv_split(settings, ",");
+ associations = argv_split(settings, ","); /* blame later */
if (associations->argc == 0) {
argv_free(associations);
return;
for (cpp = associations->argv; *cpp != 0; cpp++) {
char *temp = concatenate(" ", *cpp, " ", (char *) 0);
- association = argv_split_at(temp, '=');
+ association = argv_split_at(temp, '='); /* blame later */
myfree(temp);
if (association->argc == 0) {
bp = association->argv[association->argc - 1];
if ((rhs = mystrtok(&bp, CHARS_SPACE)) == 0) {
err = "missing port value after \"=\"";
+ } else if (*rhs == '#') {
+ err = "#comment after other text is not allowed";
} else if (mystrtok(&bp, CHARS_SPACE) != 0) {
err = "whitespace in port number";
} else {
bp = association->argv[n];
if ((lhs = mystrtok(&bp, CHARS_SPACE)) == 0) {
new_err = "missing service name before \"=\"";
+ } else if (*lhs == '#') {
+ err = "#comment after other text is not allowed";
} else if (mystrtok(&bp, CHARS_SPACE) != 0) {
new_err = "whitespace in service name";
} else {
/* Institute of Mathematics of the Romanian Academy
/* P.O. BOX 1-764
/* RO-014700 Bucharest, ROMANIA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
/* url_attrs - attributes we want from LDAP URL */
-static char **url_attrs(DICT_LDAP *dict_ldap, LDAPURLDesc * url)
+static char **url_attrs(DICT_LDAP *dict_ldap, LDAPURLDesc *url)
{
static ARGV *attrs;
char **a1;
url_list = vstring_alloc(32);
s = server_host;
- while ((h = mystrtok(&s, CHARS_COMMA_SP)) != NULL) {
+ while ((h = mystrtok_cw(&s, CHARS_COMMA_SP, ldapsource)) != NULL) {
#if defined(LDAP_API_FEATURE_X_OPENLDAP)
/*
/* Order matters, first the terminal attributes: */
attr = cfg_get_str(dict_ldap->parser, "terminal_result_attribute", "", 0, 0);
- dict_ldap->result_attributes = argv_split(attr, CHARS_COMMA_SP);
+ dict_ldap->result_attributes = argv_split_cw(attr, CHARS_COMMA_SP,
+ ldapsource);
dict_ldap->num_terminal = dict_ldap->result_attributes->argc;
myfree(attr);
/* Order matters, next the leaf-only attributes: */
attr = cfg_get_str(dict_ldap->parser, "leaf_result_attribute", "", 0, 0);
if (*attr)
- argv_split_append(dict_ldap->result_attributes, attr, CHARS_COMMA_SP);
+ argv_split_append_cw(dict_ldap->result_attributes, attr,
+ CHARS_COMMA_SP, ldapsource);
dict_ldap->num_leaf =
dict_ldap->result_attributes->argc - dict_ldap->num_terminal;
myfree(attr);
/* Order matters, next the regular attributes: */
attr = cfg_get_str(dict_ldap->parser, "result_attribute", "maildrop", 0, 0);
if (*attr)
- argv_split_append(dict_ldap->result_attributes, attr, CHARS_COMMA_SP);
+ argv_split_append_cw(dict_ldap->result_attributes, attr,
+ CHARS_COMMA_SP, ldapsource);
dict_ldap->num_attributes = dict_ldap->result_attributes->argc;
myfree(attr);
/* Order matters, finally the special attributes: */
attr = cfg_get_str(dict_ldap->parser, "special_result_attribute", "", 0, 0);
if (*attr)
- argv_split_append(dict_ldap->result_attributes, attr, CHARS_COMMA_SP);
+ argv_split_append_cw(dict_ldap->result_attributes, attr,
+ CHARS_COMMA_SP, ldapsource);
myfree(attr);
/*
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
hosts = cfg_get_str(p, "hosts", "", 0, 0);
- dict_mysql->hosts = argv_split(hosts, CHARS_COMMA_SP);
+ dict_mysql->hosts = argv_split_cw(hosts, CHARS_COMMA_SP,
+ dict_mysql->dict.name);
if (dict_mysql->hosts->argc == 0) {
argv_add(dict_mysql->hosts, "localhost", ARGV_END);
argv_terminate(dict_mysql->hosts);
/* Joshua Marcus
/* IC Group, Inc.
/* josh@icgroup.com
+/*
+/* Wietse Venema
/*--*/
/* System library. */
hosts = cfg_get_str(p, "hosts", "", 0, 0);
- dict_pgsql->hosts = argv_split(hosts, CHARS_COMMA_SP);
+ dict_pgsql->hosts = argv_split_cw(hosts, CHARS_COMMA_SP,
+ dict_pgsql->dict.name);
if (dict_pgsql->hosts->argc == 0) {
argv_add(dict_pgsql->hosts, "localhost", ARGV_END);
argv_terminate(dict_pgsql->hosts);
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/*
linenum++;
if (*cp == '#' || *cp == '\0')
continue;
- argv = argv_split(cp, " \t");
+ argv = argv_split_cw(cp, " \t", path);
if (argv->argc != 3 && argv->argc != 4)
msg_fatal("%s, line %d: Expected \"dict-type .so-name dict"
"-function [mkmap-function]\"", path, linenum);
/* IBM T.J. Watson Research
/* P.O. Box 704
/* Yorktown Heights, NY 10598, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
*
* Thus, it is unlikely that all header flags will become configurable.
*/
- hdr_drop_list = argv_split(var_drop_hdrs, CHARS_COMMA_SP);
+ hdr_drop_list = argv_split_cw(var_drop_hdrs, CHARS_COMMA_SP,
+ VAR_DROP_HDRS);
for (cpp = hdr_drop_list->argv; *cpp; cpp++) {
lowercase(*cpp);
if ((ht = htable_locate(header_hash, *cpp)) == 0) {
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/*
*/
cp = saved_sender_patterns = mystrdup(sender_patterns);
while (found_or_error == LSM_STAT_NOTFOUND
- && (sender_pattern = mystrtokdq(&cp, CHARS_COMMA_SP)) != 0) {
+ && (sender_pattern = mystrtokdq_cw(&cp, CHARS_COMMA_SP,
+ lsm->maps->title)) != 0) {
/* Special pattern: @domain. */
if (*sender_pattern == '@') {
if ((at_sender_domain = strrchr(sender_addr, '@')) != 0
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
/* mail_conf_checkdir - authorize non-default directory */
-void mail_conf_checkdir(const char *config_dir)
+void mail_conf_checkdir(const char *config_dir)
{
VSTRING *buf;
VSTREAM *fp;
if (split_nameval(vstring_str(buf), &name, &value) == 0
&& (strcmp(name, VAR_CONFIG_DIRS) == 0
|| strcmp(name, VAR_MULTI_CONF_DIRS) == 0)) {
- while (found == 0 && (cp = mystrtok(&value, CHARS_COMMA_SP)) != 0)
+ while (found == 0
+ && (cp = mystrtok_cw(&value, CHARS_COMMA_SP, path)) != 0)
if (strcmp(cp, config_dir) == 0)
found = 1;
}
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/*
* error. In this case, mystrtokq() detects no error, extpar() signals
* the error to its caller, and this function handles the error.
*/
- while ((arg = mystrtokq(&bp, CHARS_COMMA_SP, CHARS_BRACE)) != 0) {
+ while ((arg = mystrtokq_cw(&bp, CHARS_COMMA_SP, CHARS_BRACE, name)) != 0) {
if (*arg == CHARS_BRACE[0]
&& (err = extpar(&arg, CHARS_BRACE, EXTPAR_FLAG_STRIP)) != 0) {
#ifndef TEST
/* IBM T.J. Watson Research
/* P.O. Box 704
/* Yorktown Heights, NY 10598, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
}
if (hash_buf == 0) {
hash_buf = vstring_alloc(100);
- hash_queue_names = argv_split(var_hash_queue_names, CHARS_COMMA_SP);
+ hash_queue_names = argv_split_cw(var_hash_queue_names, CHARS_COMMA_SP,
+ VAR_HASH_QUEUE_NAMES);
}
/*
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/*
char *service_path;
if (var_maillog_file && *var_maillog_file) {
- ARGV *good_prefixes = argv_split(var_maillog_file_pfxs,
- CHARS_COMMA_SP);
+ ARGV *good_prefixes = argv_split_cw(var_maillog_file_pfxs,
+ CHARS_COMMA_SP,
+ VAR_MAILLOG_FILE_PFXS);
char **cpp;
for (cpp = good_prefixes->argv; /* see below */ ; cpp++) {
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/*
if ((heap_err = extpar(&bp, CHARS_BRACE, EXTPAR_FLAG_STRIP)) != 0) {
msg_warn("malformed map specification: '%s'", heap_err);
MAP_SEARCH_CREATE_RETURN(0);
- } else if ((map_type_name = mystrtokq(&bp, CHARS_COMMA_SP,
- CHARS_BRACE)) == 0) {
+ } else if ((map_type_name = mystrtokq_cw(&bp, CHARS_COMMA_SP,
+ CHARS_BRACE, map_spec)) == 0) {
msg_warn("empty map specification: '%s'", map_spec);
MAP_SEARCH_CREATE_RETURN(0);
}
* with the same attribute name.
*/
if (bp != 0) {
- while ((attr_name_val = mystrtokq(&bp, CHARS_COMMA_SP, CHARS_BRACE)) != 0) {
+ while ((attr_name_val = mystrtokq_cw(&bp, CHARS_COMMA_SP, CHARS_BRACE,
+ map_spec)) != 0) {
if (*attr_name_val == CHARS_BRACE[0]) {
if ((heap_err = extpar(&attr_name_val, CHARS_BRACE,
EXTPAR_FLAG_STRIP)) != 0) {
*/
if (attr_name != 0) {
search_order = vstring_alloc(10);
- while ((atom = mystrtok(&attr_value, CHARS_COMMA_SP)) != 0) {
+ while ((atom = mystrtok_cw(&attr_value, CHARS_COMMA_SP,
+ map_spec)) != 0) {
if ((code = name_code(map_search_actions, NAME_CODE_FLAG_NONE,
atom)) == MAP_SEARCH_CODE_UNKNOWN) {
msg_warn("unknown search type '%s' in '%s'", atom, map_spec);
{"{type:name {search_order=one, two, bad}}", 0, 0, 0},
{"{inline:{a=b} {search_order=one, two}}", 1, "inline:{a=b}", "\01\02"},
{"{inline:{a=b, c=d} {search_order=one, two}}", 1, "inline:{a=b, c=d}", "\01\02"},
+ {"#after text", 0, 0, 0},
+ {"{type:name, #after text}", 1, "type:name", 0},
+ {"{type:name {search_order=one, two, #after text}}", 1, "type:name", "\01\02"},
{0},
};
TEST_CASE *test_case;
unknown: warning: unknown search type 'bad' in '{type:name {search_order=one, two, bad}}'
unknown: test case 11: '{inline:{a=b} {search_order=one, two}}'
unknown: test case 12: '{inline:{a=b, c=d} {search_order=one, two}}'
+unknown: test case 13: '#after text'
+unknown: warning: malformed map specification: '#after text'
+unknown: warning: expected maptype:mapname instead of '#after text'
+unknown: test case 14: '{type:name, #after text}'
+unknown: warning: {type:name, #after text}: #comment after other text is not allowed: #after text
+unknown: test case 15: '{type:name {search_order=one, two, #after text}}'
+unknown: warning: {type:name {search_order=one, two, #after text}}: #comment after other text is not allowed: #after text
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
#define OPEN_FLAGS O_RDONLY
- while ((map_type_name = mystrtokq(&bufp, sep, parens)) != 0) {
+ while ((map_type_name = mystrtokq_cw(&bufp, sep, parens, title)) != 0) {
vstring_sprintf(map_type_name_flags, "%s(%o,%s)",
map_type_name, OPEN_FLAGS,
dict_flags_str(dict_flags));
/* IBM T.J. Watson Research
/* P.O. Box 704
/* Yorktown Heights, NY 10598, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
*/
else {
bufp = hosts = mystrdup(var_inet_interfaces);
- while ((host = mystrtok(&bufp, sep)) != 0)
+ while ((host = mystrtok_cw(&bufp, sep, VAR_INET_INTERFACES)) != 0)
if (inet_addr_host(addr_list, host) == 0)
msg_fatal("config variable %s: host not found: %s",
VAR_INET_INTERFACES, host);
/* own_inet_addr - is this my own internet address */
-int own_inet_addr(struct sockaddr * addr)
+int own_inet_addr(struct sockaddr *addr)
{
int i;
*/
inet_addr_list_init(addr_list);
bufp = hosts = mystrdup(var_proxy_interfaces);
- while ((host = mystrtok(&bufp, sep)) != 0)
+ while ((host = mystrtok_cw(&bufp, sep, VAR_PROXY_INTERFACES)) != 0)
if (inet_addr_host(addr_list, host) == 0)
msg_fatal("config variable %s: host not found: %s",
VAR_PROXY_INTERFACES, host);
/* proxy_inet_addr - is this my proxy internet address */
-int proxy_inet_addr(struct sockaddr * addr)
+int proxy_inet_addr(struct sockaddr *addr)
{
int i;
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
if (warn_compat_break_mynetworks_style)
server_acl_mynetworks_host =
addr_match_list_init(origin, MATCH_FLAG_RETURN
- | match_parent_style(origin), mynetworks_host());
+ | match_parent_style(origin), mynetworks_host());
}
/* server_acl_parse - parse access list */
* chroot jail, while access lists are evaluated after entering the
* chroot jail.
*/
- while ((acl = mystrtokq(&bp, CHARS_COMMA_SP, CHARS_BRACE)) != 0) {
+ while ((acl = mystrtokq_cw(&bp, CHARS_COMMA_SP, CHARS_BRACE, origin)) != 0) {
if (strchr(acl, ':') != 0) {
if (strchr(origin, ':') != 0) {
msg_warn("table %s: lookup result \"%s\" is not allowed"
#include <vstring_vstream.h>
#include <name_code.h>
#include <split_at.h>
-
+
char *var_server_acl = "";
#define UPDATE_VAR(s,v) do { if (*(s)) myfree(s); (s) = mystrdup(v); } while (0)
/* IBM T.J. Watson Research
/* P.O. Box 704
/* Yorktown Heights, NY 10598, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
next = saved_forward_path;
lookup_status = -1;
- while ((lhs = mystrtok(&next, CHARS_COMMA_SP)) != 0) {
+ while ((lhs = mystrtok_cw(&next, CHARS_COMMA_SP, VAR_FORWARD_PATH)) != 0) {
expand_status = local_expand(path, lhs, &state, &usr_attr,
var_fwd_exp_filter);
if ((expand_status & (MAC_PARSE_ERROR | MAC_PARSE_UNDEF)) == 0) {
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/* System libraries. */
{
char *value;
- if ((value = mystrtok(bufp, master_blanks)) == 0)
+ if ((value = mystrtok_cw(bufp, master_blanks, master_conf_context())) == 0)
fatal_with_context("missing \"%s\" field", name);
if (strcmp(value, "-") == 0) {
if (def_val == 0)
argv_add(serv->args, "-s",
vstring_str(vstring_sprintf(junk, "%d", serv->listen_fd_count)),
(char *) 0);
+
+ /*
+ * The remaining arguments may have application-specific syntax. Do not
+ * complain about words that start with a '#'.
+ */
while ((cp = mystrtokq(&bufp, master_blanks, CHARS_BRACE)) != 0) {
if (*cp == CHARS_BRACE[0]
&& (err = extpar(&cp, CHARS_BRACE, EXTPAR_FLAG_STRIP)) != 0)
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
VSTRING *canon_buf = 0;
char *nameval;
- while ((nameval = mystrtokq(&cp, CHARS_COMMA_SP, CHARS_BRACE)) != 0) {
+ while ((nameval = mystrtokq_cw(&cp, CHARS_COMMA_SP, CHARS_BRACE,
+ VAR_MILT_MACRO_DEFLTS)) != 0) {
const char *err;
char *name;
char *value;
const char *name;
const char *cname;
- while ((name = mystrtok(&cp, CHARS_COMMA_SP)) != 0) {
+ /* XXX Which parameter to blame? */
+ while ((name = mystrtok_cw(&cp, CHARS_COMMA_SP, "milter_macros")) != 0) {
if (msg_verbose)
msg_info("%s: \"%s\"", myname, name);
if (*name != '{') /* } */
char *op;
char *err;
+ /* XXX Which parameter to blame? */
+ char *blame = "milters";
+
/*
* Instantiate Milters, allowing for per-Milter overrides.
*/
- while ((name = mystrtokq(&cp, sep, parens)) != 0) {
+ while ((name = mystrtokq_cw(&cp, sep, parens, blame)) != 0) {
my_conn_timeout = conn_timeout;
my_cmd_timeout = cmd_timeout;
my_msg_timeout = msg_timeout;
op = name;
if ((err = extpar(&op, parens, EXTPAR_FLAG_NONE)) != 0)
msg_fatal("milter service syntax error: %s", err);
- if ((name = mystrtok(&op, sep)) == 0)
+ if ((name = mystrtok_cw(&op, sep, blame)) == 0)
msg_fatal("empty milter definition: \"%s\"", names);
- attr_override(op, sep, parens,
+ attr_override(blame, op, sep, parens,
CA_ATTR_OVER_STR_TABLE(str_table),
CA_ATTR_OVER_TIME_TABLE(time_table),
CA_ATTR_OVER_END);
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
if (edit_resp == 0)
edit_resp = parent->repl_body(parent->chg_context,
MILTER_BODY_END,
- /* unused*/ 0,
+ /* unused */ 0,
(VSTRING *) 0);
body_edit_lockout = 1;
vstring_free(body_line_buf);
body_line_buf = vstring_alloc(var_line_limit);
edit_resp = parent->repl_body(parent->chg_context,
MILTER_BODY_START,
- /* unused */ 0,
+ /* unused */ 0,
(VSTRING *) 0);
}
/* Extract lines from the on-the-wire CRLF format. */
* don't want to take the risk that a future version will be more picky.
*/
cp = saved_version = mystrdup(milter->protocol);
- while ((name = mystrtok(&cp, CHARS_COMMA_SP)) != 0) {
+ while ((name = mystrtok_cw(&cp, CHARS_COMMA_SP, VAR_MILT_PROTOCOL)) != 0) {
int mask;
int vers;
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
*/
if (*var_defer_xports && (message->qflags & QMGR_FLUSH_DFXP) == 0) {
if (defer_xport_argv == 0)
- defer_xport_argv = argv_split(var_defer_xports, CHARS_COMMA_SP);
+ defer_xport_argv = argv_split_cw(var_defer_xports,
+ CHARS_COMMA_SP,
+ VAR_DEFER_XPORTS);
for (cpp = defer_xport_argv->argv; *cpp; cpp++)
if (strcmp(*cpp, STR(reply.transport)) == 0)
break;
/* when running as PID 1.
/* This command requires that multi-instance support is
/* disabled (i.e. the multi_instance_directories parameter
-/* value must be empty).
+/* value must be empty).
/*
/* When running Postfix inside a container, see MAILLOG_README
/* for logging to stdout. Postfix logs to syslog by default,
/* Jun-ichiro 'itojun' Hagino, KAME project, Japan
/* The Linux PLD project
/* Dean Strik, Eindhoven University, The Netherlands
+/*
+/* Wietse Venema
/*--*/
/* System library. */
* Run the management script.
*/
if (force_single_instance
- || argv_split(var_multi_conf_dirs, CHARS_COMMA_SP)->argc == 0) {
+ || argv_split_cw(var_multi_conf_dirs, CHARS_COMMA_SP,
+ VAR_MULTI_CONF_DIRS)->argc == 0) {
script = concatenate(var_daemon_dir, "/postfix-script", (char *) 0);
if (optind < 1)
msg_panic("bad optind value");
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
* only comma characters. Count the actual number of elements, before we
* decide that the list is empty.
*/
- secondary_names = argv_split(var_multi_conf_dirs, CHARS_COMMA_SP);
+ secondary_names = argv_split_cw(var_multi_conf_dirs, CHARS_COMMA_SP,
+ VAR_MULTI_CONF_DIRS);
/*
* First, the primary instance. This is synthesized out of thin air.
/* word_in_list - look up command in start, stop, or control list */
-static int word_in_list(char *cmdlist, const char *cmd)
+static int word_in_list(char *cmdlist, const char *cmd, const char *blame)
{
char *saved;
char *cp;
char *elem;
cp = saved = mystrdup(cmdlist);
- while ((elem = mystrtok(&cp, CHARS_COMMA_SP)) != 0 && strcmp(elem, cmd) != 0)
+ while ((elem = mystrtok_cw(&cp, CHARS_COMMA_SP, blame)) != 0
+ && strcmp(elem, cmd) != 0)
/* void */ ;
myfree(saved);
return (elem != 0);
/*
* Override the iterator controls.
*/
- if (word_in_list(var_multi_start_cmds, argv[0])) {
+ if (word_in_list(var_multi_start_cmds, argv[0], VAR_MULTI_START_CMDS)) {
iter_flags = ITER_FLAG_CHECK_DISABLED;
- } else if (word_in_list(var_multi_stop_cmds, argv[0])) {
+ } else if (word_in_list(var_multi_stop_cmds, argv[0],
+ VAR_MULTI_STOP_CMDS)) {
iter_flags = ITER_FLAG_SKIP_DISABLED | ITER_FLAG_REVERSE;
- } else if (word_in_list(var_multi_cntrl_cmds, argv[0])) {
+ } else if (word_in_list(var_multi_cntrl_cmds, argv[0],
+ VAR_MULTI_CNTRL_CMDS)) {
iter_flags = ITER_FLAG_SKIP_DISABLED;
} else {
iter_flags = 0;
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
int weight;
HTABLE_INFO *ht;
char *parse_err;
- const char *safe_dnsbl;
+ const char *safe_dnsbl;
/*
* Parse the required DNSBL domain name, the optional reply filter and
void psc_dnsbl_init(void)
{
const char *myname = "psc_dnsbl_init";
- ARGV *dnsbl_site = argv_split(var_psc_dnsbl_sites, CHARS_COMMA_SP);
+ ARGV *dnsbl_site = argv_split_cw(var_psc_dnsbl_sites, CHARS_COMMA_SP,
+ VAR_PSC_DNSBL_SITES);
char **cpp;
/*
/* The names of queue directories that are split across multiple
/* subdirectory levels.
/* .IP "\fBimport_environment (see 'postconf -d' output)\fR"
-/* The list of environment parameters that a privileged Postfix
+/* The list of environment variables that a privileged Postfix
/* process will import from a non-Postfix parent process, or name=value
/* environment overrides.
/* .IP "\fBqueue_directory (see 'postconf -d' output)\fR"
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
static void super(const char **queues, int action)
{
- ARGV *hash_queue_names = argv_split(var_hash_queue_names, CHARS_COMMA_SP);
+ ARGV *hash_queue_names = argv_split_cw(var_hash_queue_names,
+ CHARS_COMMA_SP,
+ VAR_HASH_QUEUE_NAMES);
VSTRING *actual_path = vstring_alloc(10);
VSTRING *wanted_path = vstring_alloc(10);
struct stat st;
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
/* authorize_proxied_maps - recursively authorize maps */
-static void authorize_proxied_maps(char *bp)
+static void authorize_proxied_maps(char *bp, const char *blame)
{
const char *sep = CHARS_COMMA_SP;
const char *parens = CHARS_BRACE;
char *type_name;
- while ((type_name = mystrtokq(&bp, sep, parens)) != 0) {
+ while ((type_name = mystrtokq_cw(&bp, sep, parens, blame)) != 0) {
char *nested_info;
/* Maybe { maptype:mapname attr=value... } */
continue;
}
/* Don't try to second-guess the semantics of { }. */
- if ((type_name = mystrtokq(&type_name, sep, parens)) == 0)
+ if ((type_name = mystrtokq_cw(&type_name, sep, parens, blame)) == 0)
continue;
}
/* Recurse into nested map (pipemap, unionmap). */
myfree(err);
continue;
}
- authorize_proxied_maps(nested_info);
+ authorize_proxied_maps(nested_info, blame);
continue;
}
if (strncmp(type_name, PROXY_COLON, PROXY_COLON_LEN))
saved_filter = mystrdup(proxy_writer ? var_proxy_write_maps :
var_proxy_read_maps);
proxy_auth_maps = htable_create(13);
- authorize_proxied_maps(saved_filter);
+ authorize_proxied_maps(saved_filter, proxy_writer ? VAR_PROXY_WRITE_MAPS :
+ VAR_PROXY_READ_MAPS);
myfree(saved_filter);
/*
/* Patrik Rak
/* Modra 6
/* 155 00, Prague, Czech Republic
+/*
+/* Wietse Venema
/*--*/
/* System library. */
*/
if (*var_defer_xports && (message->qflags & QMGR_FLUSH_DFXP) == 0) {
if (defer_xport_argv == 0)
- defer_xport_argv = argv_split(var_defer_xports, CHARS_COMMA_SP);
+ defer_xport_argv = argv_split_cw(var_defer_xports,
+ CHARS_COMMA_SP,
+ VAR_DEFER_XPORTS);
for (cpp = defer_xport_argv->argv; *cpp; cpp++)
if (strcmp(*cpp, STR(reply.transport)) == 0)
break;
/* .IP "\fBqueue_directory (see 'postconf -d' output)\fR"
/* The location of the Postfix top-level queue directory.
/* .IP "\fBremote_header_rewrite_domain (empty)\fR"
-/* Don't rewrite message headers from remote clients at all when
-/* this parameter is empty; otherwise, rewrite message headers and
-/* append the specified domain name to incomplete addresses.
+/* Rewrite or add message headers in mail from remote clients if
+/* the remote_header_rewrite_domain parameter value is non-empty,
+/* updating incomplete addresses with the domain specified in the
+/* remote_header_rewrite_domain parameter, and adding missing headers.
/* .IP "\fBsyslog_facility (mail)\fR"
/* The syslog facility of Postfix logging.
/* .IP "\fBsyslog_name (see 'postconf -d' output)\fR"
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
if (alias_map_from_args != 0)
argv_add(ext_argv, alias_map_from_args, (char *) 0);
else
- argv_split_append(ext_argv, var_alias_db_map, CHARS_COMMA_SP);
+ argv_split_append_cw(ext_argv, var_alias_db_map, CHARS_COMMA_SP,
+ VAR_ALIAS_DB_MAP);
argv_terminate(ext_argv);
mail_run_replace(var_command_dir, ext_argv->argv);
/* NOTREACHED */
/* Connection caching in cooperation with:
/* Victor Duchovni
/* Morgan Stanley
+/*
+/* Wietse Venema
/*--*/
/* System library. */
if (sites->argc == 0)
msg_panic("null destination: \"%s\"", nexthop);
non_fallback_sites = sites->argc;
- argv_split_append(sites, var_fallback_relay, CHARS_COMMA_SP);
+ argv_split_append_cw(sites, var_fallback_relay, CHARS_COMMA_SP,
+ VAR_SMTP_FALLBACK);
/*
* Don't give up after a hard host lookup error until we have tried the
/* New York, NY 10011, USA
/*
/* Viktor Dukhovni
+/*
+/* Wietse Venema
/*--*/
/* System library. */
}
saved_policy = policy = mystrdup(lookup);
- if ((tok = mystrtok(&policy, CHARS_COMMA_SP)) == 0) {
+ if ((tok = mystrtok_cw(&policy, CHARS_COMMA_SP, tls_policy->title)) == 0) {
msg_warn("%s: invalid empty policy", WHERE);
INVALID_RETURN(tls->why, site_level);
}
* Warn about ignored attributes when TLS is disabled.
*/
if (*site_level < TLS_LEV_MAY) {
- while ((tok = mystrtok(&policy, CHARS_COMMA_SP)) != 0)
+ while ((tok = mystrtok_cw(&policy, CHARS_COMMA_SP, tls_policy->title)) != 0)
msg_warn("%s: ignoring attribute \"%s\" with TLS disabled",
WHERE, tok);
FREE_RETURN;
* Errors in attributes may have security consequences, don't ignore
* errors that can degrade security.
*/
- while ((tok = mystrtok(&policy, CHARS_COMMA_SP)) != 0) {
+ while ((tok = mystrtok_cw(&policy, CHARS_COMMA_SP, tls_policy->title)) != 0) {
if ((err = split_nameval(tok, &name, &val)) != 0) {
msg_warn("%s: malformed attribute/value pair \"%s\": %s",
WHERE, tok, err);
/* load_tas - load one or more ta files */
-static int load_tas(TLS_DANE *dane, const char *files)
+static int load_tas(TLS_DANE *dane, const char *files, const char *blame)
{
int ret = 0;
char *save = mystrdup(files);
char *file;
do {
- if ((file = mystrtok(&buf, CHARS_COMMA_SP)) != 0)
+ if ((file = mystrtok_cw(&buf, CHARS_COMMA_SP, blame)) != 0)
ret = tls_dane_load_trustfile(dane, file);
} while (file && ret);
case TLS_LEV_SECURE:
if (tls->matchargv == 0)
tls->matchargv =
- argv_split(tls->level == TLS_LEV_VERIFY ?
- var_smtp_tls_vfy_cmatch : var_smtp_tls_sec_cmatch,
- CHARS_COMMA_SP ":");
+ argv_split_cw(tls->level == TLS_LEV_VERIFY ?
+ var_smtp_tls_vfy_cmatch : var_smtp_tls_sec_cmatch,
+ CHARS_COMMA_SP ":", tls->level == TLS_LEV_VERIFY ?
+ VAR_SMTP_TLS_VFY_CMATCH : VAR_SMTP_TLS_SEC_CMATCH);
if (*var_smtp_tls_tafile) {
if (tls->dane == 0)
tls->dane = tls_dane_alloc();
if (tls->dane->tlsa == 0
- && !load_tas(tls->dane, var_smtp_tls_tafile)) {
+ && !load_tas(tls->dane, var_smtp_tls_tafile,
+ VAR_SMTP_TLS_TAFILE)) {
MARK_INVALID(tls->why, &tls->level);
return ((void *) tls);
}
/* Allgemeine Elektrotechnik
/* Universitaetsplatz 3-4
/* D-03044 Cottbus, Germany
+/*
+/* Wietse Venema
/*--*/
/* System library. */
/* policy_client_register - register policy service endpoint */
-static void policy_client_register(const char *name)
+static void policy_client_register(const char *name, const char *pname)
{
static const char myname[] = "policy_client_register";
SMTPD_POLICY_CLNT *policy_client;
cp = saved_name = mystrdup(name);
if ((err = extpar(&cp, parens, EXTPAR_FLAG_NONE)) != 0)
msg_fatal("policy service syntax error: %s", cp);
- if ((policy_name = mystrtok(&cp, sep)) == 0)
+ if ((policy_name = mystrtok_cw(&cp, sep, pname)) == 0)
msg_fatal("empty policy service: \"%s\"", name);
- attr_override(cp, sep, parens,
+ attr_override(pname, cp, sep, parens,
CA_ATTR_OVER_TIME_TABLE(time_table),
CA_ATTR_OVER_INT_TABLE(int_table),
CA_ATTR_OVER_STR_TABLE(str_table),
/* smtpd_check_parse - pre-parse restrictions */
-static ARGV *smtpd_check_parse(int flags, const char *checks)
+static ARGV *smtpd_check_parse(int flags, const char *pname, const char *checks)
{
char *saved_checks = mystrdup(checks);
ARGV *argv = argv_alloc(1);
#define SMTPD_CHECK_PARSE_MAPS (1<<1)
#define SMTPD_CHECK_PARSE_ALL (~0)
- while ((name = mystrtokq(&bp, CHARS_COMMA_SP, CHARS_BRACE)) != 0) {
+ while ((name = mystrtokq_cw(&bp, CHARS_COMMA_SP, CHARS_BRACE,
+ pname)) != 0) {
argv_add(argv, name, (char *) 0);
if ((flags & SMTPD_CHECK_PARSE_POLICY)
&& last && strcasecmp(last, CHECK_POLICY_SERVICE) == 0) {
- policy_client_register(name);
+ policy_client_register(name, pname);
} else if ((flags & SMTPD_CHECK_PARSE_MAPS)
&& (*name == *CHARS_BRACE || strchr(name, ':') != 0)) {
if ((map_search = map_search_create(name)) != 0)
* before going to jail.
*/
client_restrctions = smtpd_check_parse(SMTPD_CHECK_PARSE_ALL,
+ VAR_CLIENT_CHECKS,
var_client_checks);
helo_restrctions = smtpd_check_parse(SMTPD_CHECK_PARSE_ALL,
+ VAR_HELO_CHECKS,
var_helo_checks);
mail_restrctions = smtpd_check_parse(SMTPD_CHECK_PARSE_ALL,
+ VAR_MAIL_CHECKS,
var_mail_checks);
relay_restrctions = smtpd_check_parse(SMTPD_CHECK_PARSE_ALL,
+ VAR_RELAY_CHECKS,
var_relay_checks);
if (warn_compat_break_relay_restrictions)
fake_relay_restrctions = smtpd_check_parse(SMTPD_CHECK_PARSE_ALL,
+ "fake relay restrictions",
FAKE_RELAY_CHECKS);
rcpt_restrctions = smtpd_check_parse(SMTPD_CHECK_PARSE_ALL,
+ VAR_RCPT_CHECKS,
var_rcpt_checks);
etrn_restrctions = smtpd_check_parse(SMTPD_CHECK_PARSE_ALL,
+ VAR_ETRN_CHECKS,
var_etrn_checks);
data_restrctions = smtpd_check_parse(SMTPD_CHECK_PARSE_ALL,
+ VAR_DATA_CHECKS,
var_data_checks);
eod_restrictions = smtpd_check_parse(SMTPD_CHECK_PARSE_ALL,
+ VAR_EOD_CHECKS,
var_eod_checks);
/*
smtpd_rest_classes = htable_create(1);
if (*var_rest_classes) {
cp = saved_classes = mystrdup(var_rest_classes);
- while ((name = mystrtok(&cp, CHARS_COMMA_SP)) != 0) {
+ while ((name = mystrtok_cw(&cp, CHARS_COMMA_SP,
+ VAR_REST_CLASSES)) != 0) {
if ((value = mail_conf_lookup_eval(name)) == 0 || *value == 0)
msg_fatal("restriction class `%s' needs a definition", name);
/* XXX This store operation should not be case-sensitive. */
htable_enter(smtpd_rest_classes, name,
(void *) smtpd_check_parse(SMTPD_CHECK_PARSE_ALL,
+ VAR_REST_CLASSES,
value));
}
myfree(saved_classes);
#endif
htable_enter(smtpd_rest_classes, REJECT_SENDER_LOGIN_MISMATCH,
(void *) smtpd_check_parse(SMTPD_CHECK_PARSE_ALL,
+ REJECT_SENDER_LOGIN_MISMATCH,
REJECT_AUTH_SENDER_LOGIN_MISMATCH
" " REJECT_UNAUTH_SENDER_LOGIN_MISMATCH));
* Local rewrite policy.
*/
local_rewrite_clients = smtpd_check_parse(SMTPD_CHECK_PARSE_MAPS,
+ VAR_LOC_RWR_CLIENTS,
var_local_rwr_clients);
/*
*/
#define ADDROF(x) ((char *) &(x))
- restrictions = argv_splitq(value, CHARS_COMMA_SP, CHARS_BRACE);
+ restrictions = argv_splitq_cw(value, CHARS_COMMA_SP, CHARS_BRACE, table);
memcpy(ADDROF(savebuf), ADDROF(smtpd_check_buf), sizeof(savebuf));
status = setjmp(smtpd_check_buf);
if (status != 0) {
if ((owners = check_mail_addr_find(state, sender, smtpd_sender_login_maps,
STR(reply->recipient), (char **) 0)) != 0) {
cp = saved_owners = mystrdup(owners);
- while ((name = mystrtok(&cp, CHARS_COMMA_SP)) != 0) {
+ while ((name = mystrtok_cw(&cp, CHARS_COMMA_SP,
+ VAR_SMTPD_SND_AUTH_MAPS)) != 0) {
if (strcasecmp_utf8(state->sasl_username, name) == 0) {
found = 1;
break;
/* rest_class - (re)define a restriction class */
-static void rest_class(char *class)
+static void rest_class(const char *pname, char *class)
{
char *cp = class;
char *name;
if (smtpd_rest_classes == 0)
smtpd_rest_classes = htable_create(1);
- if ((name = mystrtok(&cp, CHARS_COMMA_SP)) == 0)
+ if ((name = mystrtok_cw(&cp, CHARS_COMMA_SP, pname)) == 0)
msg_panic("rest_class: null class name");
if ((entry = htable_locate(smtpd_rest_classes, name)) != 0)
argv_free((ARGV *) entry->value);
else
entry = htable_enter(smtpd_rest_classes, name, (void *) 0);
- entry->value = (void *) smtpd_check_parse(SMTPD_CHECK_PARSE_ALL, cp);
+ entry->value = (void *) smtpd_check_parse(SMTPD_CHECK_PARSE_ALL,
+ pname, cp);
}
/* resolve_clnt_init - initialize reply */
}
#endif
if (strcasecmp(args->argv[0], "restriction_class") == 0) {
- rest_class(args->argv[1]);
+ rest_class("restriction_class", args->argv[1]);
resp = 0;
break;
}
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
static int load_chain_files(SSL_CTX *ctx, const char *chain_files)
{
pem_load_state_t st;
- ARGV *files = argv_split(chain_files, CHARS_COMMA_SP);
+
+ /* XXX Which parameter to blame? */
+ ARGV *files = argv_split_cw(chain_files, CHARS_COMMA_SP, "chain_files");
char **filep;
int ret = 0;
int more;
/* New York, NY 10011, USA
/*
/* Viktor Dukhovni
+/*
+/* Wietse Venema
/*--*/
/* System library. */
void tls_dane_add_fpt_digests(TLS_DANE *dane, const char *digest,
const char *delim, int smtp_mode)
{
- ARGV *values = argv_split(digest, delim);
+ /* XXX Which parameter to blame? */
+ ARGV *values = argv_split_cw(digest, delim, "fingerprint digests");
ssize_t i;
if (smtp_mode) {
maxtype = 2;
save = cp = mystrdup(var_tls_dane_digests);
- while ((algname = mystrtok(&cp, CHARS_COMMA_SP)) != 0) {
+ while ((algname = mystrtok_cw(&cp, CHARS_COMMA_SP,
+ VAR_TLS_DANE_DIGESTS)) != 0) {
char *algcode = split_at(algname, '=');
int codepoint = -1;
/* IBM T.J. Watson Research
/* P.O. Box 704
/* Yorktown Heights, NY 10598, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
/* ------------------------------------- Common API */
#define AG_STAT_OK (0)
-#define AG_STAT_NO_GROUP (-1) /* no usable group, may retry */
-#define AG_STAT_NO_RETRY (-2) /* other error, don't retry */
+#define AG_STAT_NO_GROUP (-1) /* no usable group, may retry */
+#define AG_STAT_NO_RETRY (-2) /* other error, don't retry */
static int setup_auto_groups(SSL_CTX *ctx, const char *origin,
- const char *eecdh,
+ const char *eecdh,
const char *ffdhe)
{
#ifndef OPENSSL_NO_ECDH
} while (0)
groups = save = concatenate(eecdh, " ", ffdhe, NULL);
- if ((group = mystrtok(&groups, CHARS_COMMA_SP)) == 0) {
+ /* XXX which parameter to blame? */
+ if ((group = mystrtok_cw(&groups, CHARS_COMMA_SP,
+ "key exchange group")) == 0) {
msg_warn("no %s key exchange group - OpenSSL requires at least one",
origin);
SETUP_AG_RETURN(AG_STAT_NO_GROUP);
}
- for (; group != 0; group = mystrtok(&groups, CHARS_COMMA_SP)) {
+ /* XXX which parameter to blame? */
+ for (; group != 0; group = mystrtok_cw(&groups, CHARS_COMMA_SP,
+ "key exchange group")) {
int nid = EC_curve_nist2nid(group);
if (nid == NID_undef)
* group selection is mere performance tuning and not security critical.
* All the groups supported for negotiation should be strong enough.
*/
- for (origin = "configured"; /* void */ ; /* void */) {
+ for (origin = "configured"; /* void */ ; /* void */ ) {
switch (setup_auto_groups(ctx, origin, eecdh, ffdhe)) {
case AG_STAT_OK:
return;
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
*floor = *ceiling = 0;
save = cp = mystrdup(plist);
- while ((tok = mystrtok(&cp, CHARS_COMMA_SP ":")) != 0) {
+ /* XXX Which parameter to blame? */
+ while ((tok = mystrtok_cw(&cp, CHARS_COMMA_SP ":",
+ "protocol exclusions")) != 0) {
if (strncmp(tok, ">=", 2) == 0)
code = parse_tls_version(tok + 2, floor);
else if (strncmp(tok, "<=", 2) == 0)
#define CIPHER_SEP CHARS_COMMA_SP ":"
if (exclusions != 0) {
cp = save = mystrdup(exclusions);
- while ((tok = mystrtok(&cp, CIPHER_SEP)) != 0) {
+ /* XXX Which parameter to blame? */
+ while ((tok = mystrtok_cw(&cp, CIPHER_SEP,
+ "cipher exclusions")) != 0) {
/*
* Can't exclude ciphers that start with modifiers.
char **argv; /* string array */
} ARGV;
-typedef int (*ARGV_COMPAR_FN)(const void *, const void *);
+typedef int (*ARGV_COMPAR_FN) (const void *, const void *);
extern ARGV *argv_alloc(ssize_t);
extern ARGV *argv_sort(ARGV *); /* backwards compatibility */
extern ARGV *argv_free(ARGV *);
extern ARGV *argv_split(const char *, const char *);
+extern ARGV *argv_split_cw(const char *, const char *, const char *);
extern ARGV *argv_split_count(const char *, const char *, ssize_t);
extern ARGV *argv_split_append(ARGV *, const char *, const char *);
+extern ARGV *argv_split_append_cw(ARGV *, const char *, const char *, const char *);
+
+#define argv_split(cp, sp) argv_split_cw((cp), (sp), (char *) 0)
+#define argv_split_append(av, cp, sp) argv_split_append_cw((av), (cp), (sp), (char *) 0)
extern ARGV *argv_splitq(const char *, const char *, const char *);
+extern ARGV *argv_splitq_cw(const char *, const char *, const char *, const char *);
extern ARGV *argv_splitq_count(const char *, const char *, const char *, ssize_t);
extern ARGV *argv_splitq_append(ARGV *, const char *, const char *, const char *);
+#define argv_splitq(cp, sp, pp) argv_splitq_cw((cp), (sp), (pp), (char *) 0)
+
extern ARGV *argv_split_at(const char *, int);
extern ARGV *argv_split_at_count(const char *, int, ssize_t);
extern ARGV *argv_split_at_append(ARGV *, const char *, int);
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
#endif
/* const char *string;
/* const char *delim;
/*
+/* ARGV *argv_split_cw(string, delim, blame)
+/* const char *string;
+/* const char *delim;
+/* const char *blame;
+/*
/* ARGV *argv_split_count(string, delim, count)
/* const char *string;
/* const char *delim;
/* ARGV *argv;
/* const char *string;
/* const char *delim;
+/*
+/* ARGV *argv_split_append_cw(argv, string, delim, blame)
+/* ARGV *argv;
+/* const char *string;
+/* const char *delim;
+/* const char *blame;
/* DESCRIPTION
/* argv_split() breaks up \fIstring\fR into tokens according
/* to the delimiters specified in \fIdelim\fR. The result is
/* a null-terminated string array.
/*
+/* argv_split_cw() is like argv_split(), but stops splitting
+/* input and logs a warning when it encounters text that looks
+/* like a trailing comment. The \fBblame\fR argument specifies
+/* context that is used in warning messages. Specify a null
+/* pointer to disable the trailing comment check.
+/*
/* argv_split_count() is like argv_split() but stops splitting
/* input after at most \fIcount\fR -1 times and leaves the
/* remainder, if any, in the last array element. It is an error
/* to specify a count < 1.
-/*
+/*
/* argv_split_append() performs the same operation as argv_split(),
/* but appends the result to an existing string array.
+/*
+/* argv_split_append_cw() is like argv_split_append(), but
+/* stops splitting input and logs a warning when it encounters
+/* text that looks like a trailing comment. The \fBblame\fR
+/* argument specifies context that is used in warning messages.
+/* Specify a null pointer to disable the trailing comment
+/* check.
/* SEE ALSO
/* mystrtok(), safe string splitter.
/* DIAGNOSTICS
/* IBM T.J. Watson Research
/* P.O. Box 704
/* Yorktown Heights, NY 10598, USA
+/*
+/* Wietse Venema
/*--*/
/* System libraries. */
#include "argv.h"
#include "msg.h"
-/* argv_split - split string into token array */
+/* argv_split - ABI compatibility wrapper */
+
+#undef argv_split
ARGV *argv_split(const char *string, const char *delim)
+{
+ return (argv_split_cw(string, delim, (char *) 0));
+}
+
+/* argv_split_cw - split string into token array and complain about comment */
+
+ARGV *argv_split_cw(const char *string, const char *delim, const char *blame)
{
ARGV *argvp = argv_alloc(1);
char *saved_string = mystrdup(string);
char *bp = saved_string;
char *arg;
- while ((arg = mystrtok(&bp, delim)) != 0)
+ while ((arg = mystrtok_cw(&bp, delim, blame)) != 0)
argv_add(argvp, arg, (char *) 0);
argv_terminate(argvp);
myfree(saved_string);
return (argvp);
}
-/* argv_split_append - split string into token array, append to array */
+/* argv_split_append - ABI compatibility wrapper */
+
+#undef argv_split_append
ARGV *argv_split_append(ARGV *argvp, const char *string, const char *delim)
+{
+ return (argv_split_append_cw(argvp, string, delim, (char *) 0));
+}
+
+/* argv_split_append_cw - split string into token array, append to array */
+
+ARGV *argv_split_append_cw(ARGV *argvp, const char *string, const char *delim,
+ const char *blame)
{
char *saved_string = mystrdup(string);
char *bp = saved_string;
char *arg;
- while ((arg = mystrtok(&bp, delim)) != 0)
+ while ((arg = mystrtok_cw(&bp, delim, blame)) != 0)
argv_add(argvp, arg, (char *) 0);
argv_terminate(argvp);
myfree(saved_string);
/* const char *delim;
/* const char *parens;
/*
+/* ARGV *argv_splitq_cw(string, delim, parens, blame)
+/* const char *string;
+/* const char *delim;
+/* const char *parens;
+/* const char *blame;
+/*
/* ARGV *argv_splitq_count(string, delim, parens, count)
/* const char *string;
/* const char *delim;
/* splitting text between matching parentheses. The result is
/* a null-terminated string array.
/*
+/* argv_splitq_cw() is like argv_splitq() but stops splitting
+/* input and logs a warning when it encounters text that looks
+/* like a trailing comment. The \fBblame\fR argument specifies
+/* context that is used in warning messages. Specify a null
+/* pointer to disable the trailing comment check.
+/*
/* argv_splitq_count() is like argv_splitq() but stops splitting
/* input after at most \fIcount\fR -1 times and leaves the
/* remainder, if any, in the last array element. It is an error
/* IBM T.J. Watson Research
/* P.O. Box 704
/* Yorktown Heights, NY 10598, USA
+/*
+/* Wietse Venema
/*--*/
/* System libraries. */
#include "argv.h"
#include "msg.h"
-/* argv_splitq - split string into token array */
+/* argv_splitq - ABI compatibility wrapper */
+
+#undef argv_splitq
ARGV *argv_splitq(const char *string, const char *delim, const char *parens)
+{
+ return (argv_splitq_cw(string, delim, parens, (char *) 0));
+}
+
+/* argv_splitq_cw - split string into token array */
+
+ARGV *argv_splitq_cw(const char *string, const char *delim,
+ const char *parens, const char *blame)
{
ARGV *argvp = argv_alloc(1);
char *saved_string = mystrdup(string);
char *bp = saved_string;
char *arg;
- while ((arg = mystrtokq(&bp, delim, parens)) != 0)
+ while ((arg = mystrtokq_cw(&bp, delim, parens, blame)) != 0)
argv_add(argvp, arg, (char *) 0);
argv_terminate(argvp);
myfree(saved_string);
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/*
return (retval); \
} while (0);
- argv = argv_split(pathnames, CHARS_COMMA_SP);
+ argv = argv_split_cw(pathnames, CHARS_COMMA_SP, dict->name);
if (argv->argc == 0) {
vstring_sprintf(dict->file_buf, "empty pathname list: >>%s<<'",
pathnames);
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
*/
dict = dict_open3(DICT_TYPE_HT, name, open_flags, dict_flags);
dict_type_override(dict, DICT_TYPE_INLINE);
- while ((nameval = mystrtokq(&cp, CHARS_COMMA_SP, CHARS_BRACE)) != 0) {
+ while ((nameval = mystrtokq_cw(&cp, CHARS_COMMA_SP, CHARS_BRACE,
+ name)) != 0) {
if (nameval[0] == CHARS_BRACE[0])
err = free_me = extpar(&nameval, CHARS_BRACE, EXTPAR_FLAG_STRIP);
if (err != 0 || (err = split_qnameval(nameval, &vname, &value)) != 0)
/* IBM T.J. Watson Research
/* P.O. Box 704
/* Yorktown Heights, NY 10598, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
*/
if ((len = balpar(name, CHARS_BRACE)) == 0 || name[len] != 0
|| *(saved_name = mystrndup(name + 1, len - 2)) == 0
- || ((argv = argv_splitq(saved_name, CHARS_COMMA_SP, CHARS_BRACE)),
- (argv->argc == 0)))
+ || ((argv = argv_splitq_cw(saved_name, CHARS_COMMA_SP, CHARS_BRACE,
+ name)), (argv->argc == 0)))
DICT_PIPE_RETURN(dict_surrogate(DICT_TYPE_PIPE, name,
open_flags, dict_flags,
"bad syntax: \"%s:%s\"; "
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
VSTRING *b64 = 0;
char *err = 0;
- while ((arg = mystrtokq(&bp, delim, parens)) != 0) {
+ while ((arg = mystrtokq_cw(&bp, delim, parens, string)) != 0) {
if (dict->flags & DICT_FLAG_SRC_RHS_IS_FILE) {
if ((b64 = dict_file_to_b64(dict, arg)) != 0) {
argv_add(argvp, vstring_str(b64), (char *) 0);
/* content as specified above.
/* .IP st
/* File metadata with the file owner, or fake metadata with the
-/* real UID and GID of the dict_stream_open() caller. This is
+/* real UID and GID of the dict_stream_open() caller. This is
/* used for "taint" tracking (zero=trusted, non-zero=untrusted).
/* IP why
/* Pointer to pointer to error message storage. dict_stream_open()
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/*
/* Strip the {} from the map "name". */
err = extpar(&bp, CHARS_BRACE, EXTPAR_FLAG_NONE);
/* Extract zero or more rules inside {}. */
- while (err == 0 && (cp = mystrtokq(&bp, CHARS_COMMA_SP, CHARS_BRACE)) != 0)
+ while (err == 0
+ && (cp = mystrtokq_cw(&bp, CHARS_COMMA_SP, CHARS_BRACE, mapname)) != 0)
if ((err = extpar(&cp, CHARS_BRACE, EXTPAR_FLAG_STRIP)) == 0)
/* Write rule to in-memory file. */
vstring_sprintf_append(vp, "%s\n", cp);
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
*/
if ((len = balpar(name, CHARS_BRACE)) == 0 || name[len] != 0
|| *(saved_name = mystrndup(name + 1, len - 2)) == 0
- || ((argv = argv_splitq(saved_name, CHARS_COMMA_SP, CHARS_BRACE)),
- (argv->argc == 0)))
+ || ((argv = argv_splitq_cw(saved_name, CHARS_COMMA_SP, CHARS_BRACE,
+ name)), (argv->argc == 0)))
DICT_UNION_RETURN(dict_surrogate(DICT_TYPE_UNION, name,
open_flags, dict_flags,
"bad syntax: \"%s:%s\"; "
/* IBM T.J. Watson Research
/* P.O. Box 704
/* Yorktown Heights, NY 10598, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
* If there is an error, implement graceful degradation by inserting a
* pseudo table whose lookups fail with a warning message.
*/
- while ((start = mystrtokq(&bp, delim, CHARS_BRACE)) != 0) {
- if (*start == '#') {
- msg_warn("%s: comment at end of line is not supported: %s %s",
- match_list->pname, start, bp);
- break;
- }
+ while ((start = mystrtokq_cw(&bp, delim, CHARS_BRACE,
+ match_list->pname)) != 0) {
for (match = init_match, item = start; *item == '!'; item++)
match = !match;
if (*item == 0)
/* char *mystrtokdq(bufp, delimiters)
/* char **bufp;
/* const char *delimiters;
+/*
+/* char *mystrtok_cw(bufp, delimiters, blame)
+/* char **bufp;
+/* const char *delimiters;
+/* const char *blame;
+/*
+/* char *mystrtokq_cw(bufp, delimiters, parens, blame)
+/* char **bufp;
+/* const char *delimiters;
+/* const char *parens;
+/* const char *blame;
+/*
+/* char *mystrtokdq_cw(bufp, delimiters, blame)
+/* char **bufp;
+/* const char *delimiters;
+/* const char *blame;
/* DESCRIPTION
/* mystrtok() splits a buffer on the specified \fIdelimiters\fR.
/* Tokens are delimited by runs of delimiters, so this routine
/*
/* The result value is the next token, or a null pointer when the
/* end of the buffer was reached.
+/*
+/* mystrtok_cw(), mystrtokq_cw(), and mystrtokdq_cw, log a
+/* warning and return null when the result would look like
+/* comment. The \fBblame\fR argument provides context for
+/* warning messages. Specify a null pointer to disable the
+/* comment check.
/* LICENSE
/* .ad
/* .fi
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
-#include "sys_defs.h"
+#include <sys_defs.h>
#include <string.h>
/* Utility library. */
-#include "stringops.h"
+#include <msg.h>
+#include <stringops.h>
-/* mystrtok - safe tokenizer */
+/* mystrtok_warn - warn for #comment after other text */
+
+static void mystrtok_warn(const char *start, const char *bufp, const char *blame)
+{
+ msg_warn("%s: #comment after other text is not allowed: %s %s",
+ blame, start, bufp);
+}
+
+/* mystrtok - ABI compatibility wrapper */
+
+#undef mystrtok
char *mystrtok(char **src, const char *sep)
+{
+ return (mystrtok_cw(src, sep, (char *) 0));
+}
+
+/* mystrtok - safe tokenizer */
+
+char *mystrtok_cw(char **src, const char *sep, const char *blame)
{
char *start = *src;
char *end;
if (*end != 0)
*end++ = 0;
*src = end;
- return (start);
+
+ if (blame && *start == '#') {
+ mystrtok_warn(start, *src, blame);
+ return (0);
+ } else {
+ return (start);
+ }
}
-/* mystrtokq - safe tokenizer with quoting support */
+/* mystrtokq - ABI compatibility wrapper */
+
+#undef mystrtokq
char *mystrtokq(char **src, const char *sep, const char *parens)
+{
+ return (mystrtokq_cw(src, sep, parens, (char *) 0));
+}
+
+/* mystrtokq_cw - safe tokenizer with quoting support */
+
+char *mystrtokq_cw(char **src, const char *sep, const char *parens,
+ const char *blame)
{
char *start = *src;
static char *cp;
}
}
*src = cp;
- return (start);
+
+ /*
+ * Optional detect a comment.
+ */
+ if (blame && *start == '#') {
+ mystrtok_warn(start, *src, blame);
+ return (0);
+ } else {
+ return (start);
+ }
}
-/* mystrtokdq - safe tokenizer, double quote and backslash support */
+/* mystrtokdq - ABI compatibility wrapper */
+
+#undef mystrtokdq
char *mystrtokdq(char **src, const char *sep)
+{
+ return (mystrtokdq_cw(src, sep, (char *) 0));
+}
+
+/* mystrtokdq_cw - safe tokenizer, double quote and backslash support */
+
+char *mystrtokdq_cw(char **src, const char *sep, const char *blame)
{
char *cp = *src;
char *start;
}
}
*src = cp;
- return (start);
+ if (blame && start && *start == '#') {
+ mystrtok_warn(start, *src, blame);
+ return (0);
+ } else {
+ return (start);
+ }
}
#ifdef TEST
{"mystrtokdq", " foo\\ bar ", {"foo\\ bar"}},
{"mystrtokdq", " foo \\\" bar", {"foo", "\\\"", "bar"}},
{"mystrtokdq", " foo \" bar baz\" ", {"foo", "\" bar baz\""}},
+ {"mystrtok_cw", "#after text"},
+ {"mystrtok_cw", "before-text #after text", {"before-text"}},
+ {"mystrtokq_cw", "#after text"},
+ {"mystrtokq_cw", "{ before text } #after text", "{ before text }"},
+ {"mystrtokdq_cw", "#after text"},
+ {"mystrtokdq_cw", "\"before text\" #after text", {"\"before text\""}},
};
int main(void)
actual = mystrtokq(&cp, CHARS_SPACE, CHARS_BRACE);
} else if (strcmp(tp->action, "mystrtokdq") == 0) {
actual = mystrtokdq(&cp, CHARS_SPACE);
+ } else if (strcmp(tp->action, "mystrtok_cw") == 0) {
+ actual = mystrtok_cw(&cp, CHARS_SPACE, "test");
+ } else if (strcmp(tp->action, "mystrtokq_cw") == 0) {
+ actual = mystrtokq_cw(&cp, CHARS_SPACE, CHARS_BRACE, "test");
+ } else if (strcmp(tp->action, "mystrtokdq_cw") == 0) {
+ actual = mystrtokdq_cw(&cp, CHARS_SPACE, "test");
} else {
msg_panic("invalid command: %s", tp->action);
}
unknown: PASS test 13
unknown: RUN test case 14 mystrtokdq > foo " bar baz" <
unknown: PASS test 14
+unknown: RUN test case 15 mystrtok_cw >#after text<
+unknown: warning: test: #comment after other text is not allowed: #after text
+unknown: PASS test 15
+unknown: RUN test case 16 mystrtok_cw >before-text #after text<
+unknown: warning: test: #comment after other text is not allowed: #after text
+unknown: PASS test 16
+unknown: RUN test case 17 mystrtokq_cw >#after text<
+unknown: warning: test: #comment after other text is not allowed: #after text
+unknown: PASS test 17
+unknown: RUN test case 18 mystrtokq_cw >{ before text } #after text<
+unknown: warning: test: #comment after other text is not allowed: #after text
+unknown: PASS test 18
+unknown: RUN test case 19 mystrtokdq_cw >#after text<
+unknown: warning: test: #comment after other text is not allowed: #after text
+unknown: PASS test 19
+unknown: RUN test case 20 mystrtokdq_cw >"before text" #after text<
+unknown: warning: test: #comment after other text is not allowed: #after text
+unknown: PASS test 20
/* IBM T.J. Watson Research
/* P.O. Box 704
/* Yorktown Heights, NY 10598, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
* Break up the names string, and look up each component in the table. If
* the name is found, merge its mask with the result.
*/
- while ((name = mystrtok(&bp, delim)) != 0) {
+ while ((name = mystrtok_cw(&bp, delim, context)) != 0) {
for (np = table; /* void */ ; np++) {
if (np->name == 0) {
if ((flags & NAME_MASK_NUMBER)
/* long_name_mask_delim_opt - compute mask corresponding to list of names */
long long_name_mask_delim_opt(const char *context,
- const LONG_NAME_MASK * table,
+ const LONG_NAME_MASK *table,
const char *names, const char *delim,
int flags)
{
* Break up the names string, and look up each component in the table. If
* the name is found, merge its mask with the result.
*/
- while ((name = mystrtok(&bp, delim)) != 0) {
+ while ((name = mystrtok_cw(&bp, delim, context)) != 0) {
for (np = table; /* void */ ; np++) {
if (np->name == 0) {
if ((flags & NAME_MASK_NUMBER)
/* str_long_name_mask_opt - mask to string */
const char *str_long_name_mask_opt(VSTRING *buf, const char *context,
- const LONG_NAME_MASK * table,
+ const LONG_NAME_MASK *table,
long mask, int flags)
{
const char *myname = "name_mask";
/* IBM T.J. Watson Research
/* P.O. Box 704
/* Yorktown Heights, NY 10598, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
execvp(args.argv[0], args.argv);
msg_fatal("%s: execvp %s: %m", myname, args.argv[0]);
} else if (args.shell && *args.shell) {
- argv = argv_split(args.shell, CHARS_SPACE);
+ /* XXX Which parameter to blame? */
+ argv = argv_split_cw(args.shell, CHARS_SPACE, "command_shell");
argv_add(argv, args.command, (char *) 0);
argv_terminate(argv);
execvp(argv->argv[0], argv->argv);
extern char *mystrtok(char **, const char *);
extern char *mystrtokq(char **, const char *, const char *);
extern char *mystrtokdq(char **, const char *);
+extern char *mystrtok_cw(char **, const char *, const char *);
+extern char *mystrtokq_cw(char **, const char *, const char *, const char *);
+extern char *mystrtokdq_cw(char **, const char *, const char *);
extern char *translit(char *, const char *, const char *);
+#define mystrtok(cp, sp) mystrtok_cw((cp), (sp), (char *) 0)
+#define mystrtokq(cp, sp, pp) mystrtokq_cw((cp), (sp), (pp), (char *) 0)
+#define mystrtokdq(cp, sp) mystrtokdq_cw((cp), (sp), (char *) 0)
+
#define printable(string, replacement) \
printable_except((string), (replacement), (char *) 0)
/* Google, Inc.
/* 111 8th Avenue
/* New York, NY 10011, USA
+/*
+/* Wietse Venema
/*--*/
#endif
/* IBM T.J. Watson Research
/* P.O. Box 704
/* Yorktown Heights, NY 10598, USA
+/*
+/* Wietse Venema
/*--*/
/* System library. */
execvp(args.argv[0], args.argv);
msg_fatal("%s: execvp %s: %m", myname, args.argv[0]);
} else if (args.shell && *args.shell) {
- argv = argv_split(args.shell, CHARS_SPACE);
+ /* XXX Which parameter to blame? */
+ argv = argv_split_cw(args.shell, CHARS_SPACE, "command_shell");
argv_add(argv, args.command, (char *) 0);
argv_terminate(argv);
execvp(argv->argv[0], argv->argv);