diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-11-08 23:08:57 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-11-08 23:08:57 +0000 |
commit | cb89fc166cda202180868bdf62a4da204ddf2db0 (patch) | |
tree | 8264eb2c73180dda6142d65a3f6bef9c37cf49ff /usr.sbin/smtpd/forward.c | |
parent | 3c9d47f3b24544d8c15531bc7bec2541c36fbe8f (diff) |
rework a bit expansion and data structures involved in the expansion so we
no longer have a direct mapping between structures saved in aliases/virtual
db and structures used at runtime during expansion.
side effects ? struct alias is smaller, databases are smaller and it is no
longer necessary to rebuild aliases/virtual databases each time jacekm@ or
I make changes to some obscure structure used indirectely during expansion
rebuild databases, flush queues, make clean
Diffstat (limited to 'usr.sbin/smtpd/forward.c')
-rw-r--r-- | usr.sbin/smtpd/forward.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/usr.sbin/smtpd/forward.c b/usr.sbin/smtpd/forward.c index f2d70a9f608..e9a245433bd 100644 --- a/usr.sbin/smtpd/forward.c +++ b/usr.sbin/smtpd/forward.c @@ -1,4 +1,4 @@ -/* $OpenBSD: forward.c,v 1.16 2009/11/08 21:40:05 gilles Exp $ */ +/* $OpenBSD: forward.c,v 1.17 2009/11/08 23:08:56 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -35,15 +35,15 @@ #include "smtpd.h" int -forwards_get(int fd, struct aliasestree *aliases) +forwards_get(int fd, struct expandtree *expandtree) { FILE *fp; struct alias alias; - struct alias *aliasp; char *buf, *lbuf, *p, *cp; size_t len; size_t nbaliases = 0; int quoted; + struct expand_node *expnode; fp = fdopen(fd, "r"); if (fp == NULL) @@ -89,17 +89,18 @@ forwards_get(int fd, struct aliasestree *aliases) continue; } - if (alias.type == ALIAS_INCLUDE) { + if (alias.type == EXPAND_INCLUDE) { log_debug( "includes are forbidden in ~/.forward"); continue; } - aliasp = calloc(1, sizeof(struct alias)); - if (aliasp == NULL) + expnode = calloc(sizeof(struct expand_node), 1); + if (expnode == NULL) fatal("calloc"); - *aliasp = alias; - aliasestree_insert(aliases, aliasp); + expnode->type = alias.type; + expnode->u = alias.u; + expandtree_insert(expandtree, expnode); nbaliases++; } while (*cp != '\0'); } |