diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-11-08 23:20:08 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-11-08 23:20:08 +0000 |
commit | a46bd01b9b1c9dc94fcf086229dbd5c50e8a6801 (patch) | |
tree | 62aee8b14088670df56b6465691cd8ed56c9a7b8 /usr.sbin | |
parent | 9f9db797cbd47e8f4634e4d2aa46f0e8bce2caeb (diff) |
add an alias_to_expand_node() function and use it in aliases.c
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/smtpd/aliases.c | 18 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpd.h | 15 |
2 files changed, 19 insertions, 14 deletions
diff --git a/usr.sbin/smtpd/aliases.c b/usr.sbin/smtpd/aliases.c index 325a23f4e6d..9e568e19444 100644 --- a/usr.sbin/smtpd/aliases.c +++ b/usr.sbin/smtpd/aliases.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aliases.c,v 1.28 2009/11/08 23:15:03 gilles Exp $ */ +/* $OpenBSD: aliases.c,v 1.29 2009/11/08 23:20:07 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -127,8 +127,7 @@ aliases_get(struct smtpd *env, objid_t mapid, struct expandtree *expandtree, cha expnode = calloc(sizeof(struct expand_node), 1); if (expnode == NULL) fatal("aliases_get: calloc"); - expnode->type = alias.type; - expnode->u = alias.u; + alias_to_expand_node(expnode, &alias); expandtree_insert(expandtree, expnode); } } while (--nbaliases); @@ -303,8 +302,7 @@ aliases_virtual_get(struct smtpd *env, objid_t mapid, expnode = calloc(sizeof(struct expand_node), 1); if (expnode== NULL) fatal("aliases_virtual_get: calloc"); - expnode->type = alias.type; - expnode->u = alias.u; + alias_to_expand_node(expnode, &alias); expandtree_insert(expandtree, expnode); } } while (--nbaliases); @@ -345,8 +343,7 @@ aliases_expand_include(struct expandtree *expandtree, char *filename) expnode = calloc(sizeof(struct expand_node), 1); if (expnode== NULL) fatal("aliases_virtual_get: calloc"); - expnode->type = alias.type; - expnode->u = alias.u; + alias_to_expand_node(expnode, &alias); expandtree_insert(expandtree, expnode); } @@ -488,3 +485,10 @@ alias_is_include(struct alias *alias, char *line, size_t len) alias->type = EXPAND_INCLUDE; return 1; } + +void +alias_to_expand_node(struct expand_node *expnode, struct alias *alias) +{ + expnode->type = alias->type; + expnode->u = alias->u; +} diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index 05a45a8893e..b9c224aae86 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.156 2009/11/08 23:08:56 gilles Exp $ */ +/* $OpenBSD: smtpd.h,v 1.157 2009/11/08 23:20:07 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -793,11 +793,7 @@ int aliases_vdomain_exists(struct smtpd *, objid_t, char *); int aliases_virtual_exist(struct smtpd *, objid_t, struct path *); int aliases_virtual_get(struct smtpd *, objid_t, struct expandtree *, struct path *); int alias_parse(struct alias *, char *); -int expand_cmp(struct expand_node *, struct expand_node *); -void expandtree_insert(struct expandtree *, struct expand_node *); -void expandtree_remove(struct expandtree *, struct expand_node *); -struct expand_node *expandtree_lookup(struct expandtree *, struct expand_node *); -RB_PROTOTYPE(expandtree, expand_node, nodes, expand_cmp); +void alias_to_expand_node(struct expand_node *, struct alias *); /* authenticate.c */ int authenticate_user(char *, char *); @@ -829,7 +825,12 @@ void dns_query_ptr(struct smtpd *, struct sockaddr_storage *, u_int64_t); void dns_async(struct smtpd *, struct imsgev *, int, struct dns *); - +/* expand.c */ +int expand_cmp(struct expand_node *, struct expand_node *); +void expandtree_insert(struct expandtree *, struct expand_node *); +void expandtree_remove(struct expandtree *, struct expand_node *); +struct expand_node *expandtree_lookup(struct expandtree *, struct expand_node *); +RB_PROTOTYPE(expandtree, expand_node, nodes, expand_cmp); /* forward.c */ int forwards_get(int, struct expandtree *); |