summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/smtpd/parse.y51
-rw-r--r--usr.sbin/smtpd/smtpd.conf.521
-rw-r--r--usr.sbin/smtpd/smtpd.h12
3 files changed, 22 insertions, 62 deletions
diff --git a/usr.sbin/smtpd/parse.y b/usr.sbin/smtpd/parse.y
index cf6a1d83f5f..a27c515378b 100644
--- a/usr.sbin/smtpd/parse.y
+++ b/usr.sbin/smtpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.85 2012/04/16 13:32:16 chl Exp $ */
+/* $OpenBSD: parse.y,v 1.86 2012/05/12 18:41:10 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -122,8 +122,8 @@ typedef struct {
%}
%token AS QUEUE INTERVAL SIZE LISTEN ON ALL PORT EXPIRE
-%token MAP TYPE HASH LIST SINGLE SSL SMTPS CERTIFICATE
-%token DNS DB PLAIN EXTERNAL DOMAIN CONFIG SOURCE
+%token MAP HASH LIST SINGLE SSL SMTPS CERTIFICATE
+%token DB PLAIN EXTERNAL DOMAIN SOURCE
%token RELAY VIA DELIVER TO MAILDIR MBOX HOSTNAME
%token ACCEPT REJECT INCLUDE NETWORK ERROR MDA FROM FOR
%token ARROW ENABLE AUTH TLS LOCAL VIRTUAL TAG ALIAS FILTER
@@ -181,6 +181,14 @@ optnl : '\n' optnl
|
;
+optlbracket : '{'
+ |
+ ;
+
+optrbracket : '}'
+ |
+ ;
+
nl : '\n' optnl
;
@@ -416,13 +424,7 @@ main : QUEUE INTERVAL interval {
*/
;
-maptype : SINGLE { map->m_type = T_SINGLE; }
- | LIST { map->m_type = T_LIST; }
- | HASH { map->m_type = T_HASH; }
- ;
-
-mapsource : DNS { map->m_src = S_DNS; }
- | PLAIN STRING {
+mapsource : PLAIN STRING {
map->m_src = S_PLAIN;
if (strlcpy(map->m_config, $2, sizeof(map->m_config))
>= sizeof(map->m_config))
@@ -437,15 +439,7 @@ mapsource : DNS { map->m_src = S_DNS; }
| EXTERNAL { map->m_src = S_EXT; }
;
-mapopt : TYPE maptype
- | SOURCE mapsource
- | CONFIG STRING {
- }
- ;
-
-mapopts_l : mapopts_l mapopt nl
- | mapopt optnl
- ;
+mapopt : SOURCE mapsource { }
map : MAP STRING {
struct map *m;
@@ -470,7 +464,6 @@ map : MAP STRING {
}
m->m_id = last_map_id++;
- m->m_type = T_SINGLE;
if (m->m_id == INT_MAX) {
yyerror("too many maps defined");
@@ -479,7 +472,7 @@ map : MAP STRING {
YYERROR;
}
map = m;
- } '{' optnl mapopts_l '}' {
+ } optlbracket mapopt optrbracket {
if (map->m_src == S_NONE) {
yyerror("map %s has no source defined", $2);
free(map);
@@ -605,8 +598,6 @@ mapref : STRING {
if (! bsnprintf(m->m_name, sizeof(m->m_name),
"<dynamic(%u)>", m->m_id))
fatal("snprintf");
- m->m_flags |= F_DYNAMIC|F_USED;
- m->m_type = T_SINGLE;
m->m_src = S_NONE;
TAILQ_INIT(&m->m_contents);
@@ -684,8 +675,6 @@ mapref : STRING {
if (! bsnprintf(m->m_name, sizeof(m->m_name),
"<dynamic(%u)>", m->m_id))
fatal("snprintf");
- m->m_flags |= F_DYNAMIC|F_USED;
- m->m_type = T_LIST;
TAILQ_INIT(&m->m_contents);
contents = &m->m_contents;
@@ -710,8 +699,6 @@ mapref : STRING {
if (! bsnprintf(m->m_name, sizeof(m->m_name),
"<dynamic(%u)>", m->m_id))
fatal("snprintf");
- m->m_flags |= F_DYNAMIC|F_USED;
- m->m_type = T_HASH;
TAILQ_INIT(&m->m_contents);
contents = &m->m_contents;
@@ -730,7 +717,6 @@ mapref : STRING {
YYERROR;
}
free($2);
- m->m_flags |= F_USED;
$$ = m->m_id;
}
;
@@ -781,7 +767,6 @@ condition : NETWORK mapref {
YYERROR;
}
free($2);
- m->m_flags |= F_USED;
if ((c = calloc(1, sizeof *c)) == NULL)
fatal("out of memory");
@@ -814,8 +799,6 @@ condition : NETWORK mapref {
if (! bsnprintf(m->m_name, sizeof(m->m_name),
"<dynamic(%u)>", m->m_id))
fatal("snprintf");
- m->m_flags |= F_DYNAMIC|F_USED;
- m->m_type = T_SINGLE;
TAILQ_INIT(&m->m_contents);
@@ -1067,8 +1050,6 @@ from : FROM mapref {
if (! bsnprintf(m->m_name, sizeof(m->m_name),
"<dynamic(%u)>", m->m_id))
fatal("snprintf");
- m->m_flags |= F_DYNAMIC|F_USED;
- m->m_type = T_SINGLE;
TAILQ_INIT(&m->m_contents);
@@ -1223,10 +1204,8 @@ lookup(char *s)
{ "as", AS },
{ "auth", AUTH },
{ "certificate", CERTIFICATE },
- { "config", CONFIG },
{ "db", DB },
{ "deliver", DELIVER },
- { "dns", DNS },
{ "domain", DOMAIN },
{ "enable", ENABLE },
{ "expire", EXPIRE },
@@ -1260,7 +1239,6 @@ lookup(char *s)
{ "tag", TAG },
{ "tls", TLS },
{ "to", TO },
- { "type", TYPE },
{ "via", VIA },
{ "virtual", VIRTUAL },
};
@@ -1653,7 +1631,6 @@ parse_config(struct smtpd *x_conf, const char *filename, int opts)
if (strlcpy(m->m_name, "localhost", sizeof(m->m_name))
>= sizeof(m->m_name))
fatal("strlcpy");
- m->m_type = T_LIST;
TAILQ_INIT(&m->m_contents);
TAILQ_INSERT_TAIL(conf->sc_maps, m, m_entry);
set_localaddrs();
diff --git a/usr.sbin/smtpd/smtpd.conf.5 b/usr.sbin/smtpd/smtpd.conf.5
index a225192481a..944d3f118b3 100644
--- a/usr.sbin/smtpd/smtpd.conf.5
+++ b/usr.sbin/smtpd/smtpd.conf.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: smtpd.conf.5,v 1.49 2012/04/24 14:56:09 jmc Exp $
+.\" $OpenBSD: smtpd.conf.5,v 1.50 2012/05/12 18:41:10 gilles Exp $
.\"
.\" Copyright (c) 2008 Janne Johansson <jj@openbsd.org>
.\" Copyright (c) 2009 Jacek Masiulaniec <jacekm@dobremiasto.net>
@@ -16,7 +16,7 @@
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\"
-.Dd $Mdocdate: April 24 2012 $
+.Dd $Mdocdate: May 12 2012 $
.Dt SMTPD.CONF 5
.Os
.Sh NAME
@@ -157,9 +157,7 @@ it was the server's local user that was sending the mail.
This means that filter rules using "from local" will be matched.
.It Xo
.Ic map Ar map
-.No {
.Ic source Ar type Ar source
-.No }
.Xc
Maps are used to provide additional configuration information for
.Xr smtpd 8 .
@@ -175,8 +173,6 @@ may be one of the following:
Mappings are stored in a file created using
.Xr makemap 8 .
This is the default type if none is specified.
-.It dns
-Not implemented yet.
.It plain
Mappings are stored in a plain text file using the
same format as used to generate
@@ -187,13 +183,10 @@ mappings.
.Ar source
specifies the source of the map data.
It must be an absolute path to a file for the
-.Dq file
+.Dq plain
and
.Dq db
-map types,
-or a domain name for the
-.Dq dns
-map type.
+map types.
.It Ic size Ar n
Specify a maximum message size of
.Ar n
@@ -397,8 +390,8 @@ A secrets file is needed to specify a username and password:
would look like this:
.Bd -literal -offset indent
listen on lo0
-map aliases { source db "/etc/mail/aliases.db" }
-map secrets { source db "/etc/mail/secrets.db" }
+map aliases source db "/etc/mail/aliases.db"
+map secrets source db "/etc/mail/secrets.db"
accept for local deliver to mbox
accept for all relay via smtp.example.com tls auth "secrets"
.Ed
@@ -423,7 +416,7 @@ The configuration file would look like this:
.Bd -literal -offset indent
listen on lo0
listen on bnx0 tls certificate "mail.example.com" enable auth
-map aliases { source db "/etc/mail/aliases.db" }
+map aliases source db "/etc/mail/aliases.db"
accept for local deliver to mda "/path/to/mda -f -"
accept from all for domain example.org deliver to mda "/path/to/mda -f -"
accept for all relay
diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h
index 986b4c93667..6b0b605cce2 100644
--- a/usr.sbin/smtpd/smtpd.h
+++ b/usr.sbin/smtpd/smtpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.h,v 1.290 2012/05/12 17:41:27 eric Exp $ */
+/* $OpenBSD: smtpd.h,v 1.291 2012/05/12 18:41:10 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -231,12 +231,6 @@ struct peer {
void (*cb)(int, short, void *);
};
-enum map_type {
- T_SINGLE,
- T_LIST,
- T_HASH
-};
-
enum map_src {
S_NONE,
S_DYN,
@@ -270,12 +264,8 @@ struct mapel {
struct map {
TAILQ_ENTRY(map) m_entry;
-#define F_USED 0x01
-#define F_DYNAMIC 0x02
- u_int8_t m_flags;
char m_name[MAX_LINE_SIZE];
objid_t m_id;
- enum map_type m_type;
enum mapel_type m_eltype;
enum map_src m_src;
char m_config[MAXPATHLEN];