diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2011-04-17 13:36:08 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2011-04-17 13:36:08 +0000 |
commit | 66e06ec8570a0086ca9fdce67a3b30be7c9deb8e (patch) | |
tree | ae96e9b08c418e3f55a5c6b2a3cafb7296ef65f4 /usr.sbin | |
parent | bfb477fad35115cd1bcaf0720f4fe0914c80cda4 (diff) |
cleanups, cosmethic changes, functions that should be static are now static
no functionnal change
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/smtpd/aliases.c | 14 | ||||
-rw-r--r-- | usr.sbin/smtpd/config.c | 6 | ||||
-rw-r--r-- | usr.sbin/smtpd/dns.c | 34 | ||||
-rw-r--r-- | usr.sbin/smtpd/enqueue.c | 41 | ||||
-rw-r--r-- | usr.sbin/smtpd/lka.c | 62 | ||||
-rw-r--r-- | usr.sbin/smtpd/makemap.c | 17 | ||||
-rw-r--r-- | usr.sbin/smtpd/map_backend.c | 34 | ||||
-rw-r--r-- | usr.sbin/smtpd/map_parser.c | 14 | ||||
-rw-r--r-- | usr.sbin/smtpd/mda.c | 26 | ||||
-rw-r--r-- | usr.sbin/smtpd/mfa.c | 28 | ||||
-rw-r--r-- | usr.sbin/smtpd/mta.c | 71 | ||||
-rw-r--r-- | usr.sbin/smtpd/queue.c | 23 | ||||
-rw-r--r-- | usr.sbin/smtpd/ramqueue.c | 32 | ||||
-rw-r--r-- | usr.sbin/smtpd/ruleset.c | 23 | ||||
-rw-r--r-- | usr.sbin/smtpd/runner.c | 36 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtp.c | 43 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtp_session.c | 117 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpctl.c | 12 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpd.c | 65 | ||||
-rw-r--r-- | usr.sbin/smtpd/smtpd.h | 225 | ||||
-rw-r--r-- | usr.sbin/smtpd/util.c | 8 |
21 files changed, 457 insertions, 474 deletions
diff --git a/usr.sbin/smtpd/aliases.c b/usr.sbin/smtpd/aliases.c index 0433f924066..f416f530860 100644 --- a/usr.sbin/smtpd/aliases.c +++ b/usr.sbin/smtpd/aliases.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aliases.c,v 1.40 2010/11/28 14:02:46 gilles Exp $ */ +/* $OpenBSD: aliases.c,v 1.41 2011/04/17 13:36:07 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -33,12 +33,12 @@ #include "smtpd.h" #include "log.h" -int aliases_expand_include(struct expandtree *, char *); -int alias_is_filter(struct expandnode *, char *, size_t); -int alias_is_username(struct expandnode *, char *, size_t); -int alias_is_address(struct expandnode *, char *, size_t); -int alias_is_filename(struct expandnode *, char *, size_t); -int alias_is_include(struct expandnode *, char *, size_t); +static int aliases_expand_include(struct expandtree *, char *); +static int alias_is_filter(struct expandnode *, char *, size_t); +static int alias_is_username(struct expandnode *, char *, size_t); +static int alias_is_address(struct expandnode *, char *, size_t); +static int alias_is_filename(struct expandnode *, char *, size_t); +static int alias_is_include(struct expandnode *, char *, size_t); int aliases_exist(struct smtpd *env, objid_t mapid, char *username) diff --git a/usr.sbin/smtpd/config.c b/usr.sbin/smtpd/config.c index 6f40c6927ca..6858f05677b 100644 --- a/usr.sbin/smtpd/config.c +++ b/usr.sbin/smtpd/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.13 2010/11/28 13:56:43 gilles Exp $ */ +/* $OpenBSD: config.c,v 1.14 2011/04/17 13:36:07 gilles Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -31,9 +31,9 @@ #include "smtpd.h" #include "log.h" -int is_peer(struct peer *, enum smtp_proc_type, u_int); +static int is_peer(struct peer *, enum smtp_proc_type, u_int); -int +static int is_peer(struct peer *p, enum smtp_proc_type peer, u_int peercount) { u_int i; diff --git a/usr.sbin/smtpd/dns.c b/usr.sbin/smtpd/dns.c index dd06fb3bcd5..d3fc88b959b 100644 --- a/usr.sbin/smtpd/dns.c +++ b/usr.sbin/smtpd/dns.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dns.c,v 1.39 2011/04/02 16:40:19 eric Exp $ */ +/* $OpenBSD: dns.c,v 1.40 2011/04/17 13:36:07 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -37,14 +37,14 @@ #include "smtpd.h" #include "log.h" -struct dnssession *dnssession_init(struct smtpd *, struct dns *); -void dnssession_destroy(struct smtpd *, struct dnssession *); -void dnssession_mx_insert(struct dnssession *, const char *, int); -void dns_asr_event_set(struct dnssession *, struct asr_result *); -void dns_asr_handler(int, short, void *); -void dns_asr_dispatch_host(struct dnssession *); -void dns_asr_dispatch_mx(struct dnssession *); -void dns_asr_dispatch_cname(struct dnssession *); +static struct dnssession *dnssession_init(struct smtpd *, struct dns *); +static void dnssession_destroy(struct smtpd *, struct dnssession *); +static void dnssession_mx_insert(struct dnssession *, const char *, int); +static void dns_asr_event_set(struct dnssession *, struct asr_result *); +static void dns_asr_handler(int, short, void *); +static void dns_asr_dispatch_host(struct dnssession *); +static void dns_asr_dispatch_mx(struct dnssession *); +static void dns_asr_dispatch_cname(struct dnssession *); struct asr *asr = NULL; @@ -148,7 +148,7 @@ noasr: imsg_compose_event(asker, type, 0, 0, -1, query, sizeof(*query)); } -void +static void dns_asr_event_set(struct dnssession *dnssession, struct asr_result *ar) { struct timeval tv = { 0, 0 }; @@ -160,7 +160,7 @@ dns_asr_event_set(struct dnssession *dnssession, struct asr_result *ar) event_add(&dnssession->ev, &tv); } -void +static void dns_asr_handler(int fd, short event, void *arg) { struct dnssession *dnssession = arg; @@ -180,7 +180,7 @@ dns_asr_handler(int fd, short event, void *arg) } } -void +static void dns_asr_dispatch_mx(struct dnssession *dnssession) { struct dns *query = &dnssession->query; @@ -226,7 +226,7 @@ hosts: dns_asr_dispatch_host(dnssession); } -void +static void dns_asr_dispatch_host(struct dnssession *dnssession) { struct dns *query = &dnssession->query; @@ -268,7 +268,7 @@ next: goto next; } -void +static void dns_asr_dispatch_cname(struct dnssession *dnssession) { struct dns *query = &dnssession->query; @@ -296,7 +296,7 @@ dns_asr_dispatch_cname(struct dnssession *dnssession) dnssession_destroy(query->env, dnssession); } -struct dnssession * +static struct dnssession * dnssession_init(struct smtpd *env, struct dns *query) { struct dnssession *dnssession; @@ -317,7 +317,7 @@ dnssession_init(struct smtpd *env, struct dns *query) return dnssession; } -void +static void dnssession_destroy(struct smtpd *env, struct dnssession *dnssession) { env->stats->lka.queries_active--; @@ -326,7 +326,7 @@ dnssession_destroy(struct smtpd *env, struct dnssession *dnssession) free(dnssession); } -void +static void dnssession_mx_insert(struct dnssession *dnssession, const char *host, int prio) { size_t i, j; diff --git a/usr.sbin/smtpd/enqueue.c b/usr.sbin/smtpd/enqueue.c index 1c304012535..e86d6527000 100644 --- a/usr.sbin/smtpd/enqueue.c +++ b/usr.sbin/smtpd/enqueue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: enqueue.c,v 1.42 2011/03/26 10:59:59 gilles Exp $ */ +/* $OpenBSD: enqueue.c,v 1.43 2011/04/17 13:36:07 gilles Exp $ */ /* * Copyright (c) 2005 Henning Brauer <henning@bulabula.org> @@ -38,17 +38,16 @@ extern struct imsgbuf *ibuf; -void usage(void); -void sighdlr(int); -int main(int, char *[]); -void build_from(char *, struct passwd *); -int parse_message(FILE *, int, int, FILE *); -void parse_addr(char *, size_t, int); -void parse_addr_terminal(int); -char *qualify_addr(char *); -void rcpt_add(char *); -int open_connection(void); -void enqueue_event(int, short, void *); +void usage(void); +static void sighdlr(int); +static void build_from(char *, struct passwd *); +static int parse_message(FILE *, int, int, FILE *); +static void parse_addr(char *, size_t, int); +static void parse_addr_terminal(int); +static char *qualify_addr(char *); +static void rcpt_add(char *); +static int open_connection(void); +static void enqueue_event(int, short, void *); enum headerfields { HDR_NONE, @@ -109,7 +108,7 @@ struct { char buf[SMTP_LINELEN]; } pstate; -void +static void sighdlr(int sig) { if (sig == SIGALRM) { @@ -241,7 +240,7 @@ enqueue(int argc, char *argv[]) exit(0); } -void +static void enqueue_event(int fd, short event, void *p) { if (event & EV_TIMEOUT) @@ -276,7 +275,7 @@ rw: event_add(&msg.ev, &msg.pcb->timeout); } -void +static void build_from(char *fake_from, struct passwd *pw) { char *p; @@ -318,7 +317,7 @@ build_from(char *fake_from, struct passwd *pw) } } -int +static int parse_message(FILE *fin, int get_from, int tflag, FILE *fout) { char *buf; @@ -391,7 +390,7 @@ parse_message(FILE *fin, int get_from, int tflag, FILE *fout) return (!header_seen); } -void +static void parse_addr(char *s, size_t len, int is_from) { size_t pos = 0; @@ -464,7 +463,7 @@ parse_addr(char *s, size_t len, int is_from) parse_addr(s + pos, len - pos, is_from); } -void +static void parse_addr_terminal(int is_from) { if (pstate.comment || pstate.quote || pstate.esc) @@ -481,7 +480,7 @@ parse_addr_terminal(int is_from) } } -char * +static char * qualify_addr(char *in) { char *out; @@ -496,7 +495,7 @@ qualify_addr(char *in) return (out); } -void +static void rcpt_add(char *addr) { void *nrcpts; @@ -508,7 +507,7 @@ rcpt_add(char *addr) msg.rcpts[msg.rcpt_cnt++] = qualify_addr(addr); } -int +static int open_connection(void) { struct imsg imsg; diff --git a/usr.sbin/smtpd/lka.c b/usr.sbin/smtpd/lka.c index 7ee4bace72d..027c6dbb1b9 100644 --- a/usr.sbin/smtpd/lka.c +++ b/usr.sbin/smtpd/lka.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lka.c,v 1.124 2011/04/17 11:39:22 gilles Exp $ */ +/* $OpenBSD: lka.c,v 1.125 2011/04/17 13:36:07 gilles Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -41,27 +41,27 @@ #include "smtpd.h" #include "log.h" -void lka_imsg(struct smtpd *, struct imsgev *, struct imsg *); -__dead void lka_shutdown(void); -void lka_sig_handler(int, short, void *); -void lka_expand_pickup(struct smtpd *, struct lkasession *); -int lka_expand_resume(struct smtpd *, struct lkasession *); -int lka_resolve_node(struct smtpd *, char *tag, struct path *, struct expandnode *); -int lka_verify_mail(struct smtpd *, struct path *); -struct rule *ruleset_match(struct smtpd *, char *, struct path *, struct sockaddr_storage *); -int lka_resolve_path(struct smtpd *, struct lkasession *, struct path *); -struct lkasession *lka_session_init(struct smtpd *, struct submit_status *); -void lka_request_forwardfile(struct smtpd *, struct lkasession *, char *); -void lka_clear_expandtree(struct expandtree *); -void lka_clear_deliverylist(struct deliverylist *); -int lka_encode_credentials(char *, size_t, struct map_secret *); -size_t lka_expand(char *, size_t, struct path *, struct path *); -void lka_rcpt_action(struct smtpd *, char *, struct path *); -void lka_session_destroy(struct smtpd *, struct lkasession *); -void lka_expansion_done(struct smtpd *, struct lkasession *); -void lka_session_fail(struct smtpd *, struct lkasession *, struct submit_status *); - -void +struct rule *ruleset_match(struct smtpd *, char *, struct path *, struct sockaddr_storage *); +static void lka_imsg(struct smtpd *, struct imsgev *, struct imsg *); +static void lka_shutdown(void); +static void lka_sig_handler(int, short, void *); +static void lka_expand_pickup(struct smtpd *, struct lkasession *); +static int lka_expand_resume(struct smtpd *, struct lkasession *); +static int lka_resolve_node(struct smtpd *, char *, struct path *, struct expandnode *); +static int lka_verify_mail(struct smtpd *, struct path *); +static int lka_resolve_path(struct smtpd *, struct lkasession *, struct path *); +static struct lkasession *lka_session_init(struct smtpd *, struct submit_status *); +static void lka_request_forwardfile(struct smtpd *, struct lkasession *, char *); +static void lka_clear_expandtree(struct expandtree *); +static void lka_clear_deliverylist(struct deliverylist *); +static int lka_encode_credentials(char *, size_t, struct map_secret *); +static size_t lka_expand(char *, size_t, struct path *, struct path *); +static void lka_rcpt_action(struct smtpd *, char *, struct path *); +static void lka_session_destroy(struct smtpd *, struct lkasession *); +static void lka_expansion_done(struct smtpd *, struct lkasession *); +static void lka_session_fail(struct smtpd *, struct lkasession *, struct submit_status *); + +static void lka_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) { struct lkasession skey; @@ -252,7 +252,7 @@ lka_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) fatalx("lka_imsg: unexpected imsg"); } -void +static void lka_sig_handler(int sig, short event, void *p) { int status; @@ -711,7 +711,7 @@ lka_resolve_path(struct smtpd *env, struct lkasession *lkasession, struct path * return 0; } -void +static void lka_rcpt_action(struct smtpd *env, char *tag, struct path *path) { struct rule *r; @@ -744,7 +744,7 @@ lkasession_cmp(struct lkasession *s1, struct lkasession *s2) return (0); } -void +static void lka_clear_expandtree(struct expandtree *expandtree) { struct expandnode *expnode; @@ -755,7 +755,7 @@ lka_clear_expandtree(struct expandtree *expandtree) } } -void +static void lka_clear_deliverylist(struct deliverylist *deliverylist) { struct path *path; @@ -766,7 +766,7 @@ lka_clear_deliverylist(struct deliverylist *deliverylist) } } -int +static int lka_encode_credentials(char *dst, size_t size, struct map_secret *map_secret) { char *buf; @@ -785,7 +785,7 @@ lka_encode_credentials(char *dst, size_t size, struct map_secret *map_secret) return 1; } -struct lkasession * +static struct lkasession * lka_session_init(struct smtpd *env, struct submit_status *ss) { struct lkasession *lkasession; @@ -806,7 +806,7 @@ lka_session_init(struct smtpd *env, struct submit_status *ss) return lkasession; } -void +static void lka_session_fail(struct smtpd *env, struct lkasession *lkasession, struct submit_status *ss) { ss->code = 530; @@ -815,14 +815,14 @@ lka_session_fail(struct smtpd *env, struct lkasession *lkasession, struct submit lka_session_destroy(env, lkasession); } -void +static void lka_session_destroy(struct smtpd *env, struct lkasession *lkasession) { SPLAY_REMOVE(lkatree, &env->lka_sessions, lkasession); free(lkasession); } -void +static void lka_request_forwardfile(struct smtpd *env, struct lkasession *lkasession, char *username) { struct forward_req fwreq; diff --git a/usr.sbin/smtpd/makemap.c b/usr.sbin/smtpd/makemap.c index 942c2797268..864cf660f0b 100644 --- a/usr.sbin/smtpd/makemap.c +++ b/usr.sbin/smtpd/makemap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: makemap.c,v 1.28 2010/11/28 14:35:58 gilles Exp $ */ +/* $OpenBSD: makemap.c,v 1.29 2011/04/17 13:36:07 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -45,14 +45,13 @@ extern char *__progname; __dead void usage(void); -int parse_map(char *); -int parse_entry(char *, size_t, size_t); -int parse_mapentry(char *, size_t, size_t); -int parse_setentry(char *, size_t, size_t); -int make_plain(DBT *, char *); -int make_aliases(DBT *, char *); - -char *conf_aliases(char *); +static int parse_map(char *); +static int parse_entry(char *, size_t, size_t); +static int parse_mapentry(char *, size_t, size_t); +static int parse_setentry(char *, size_t, size_t); +static int make_plain(DBT *, char *); +static int make_aliases(DBT *, char *); +static char *conf_aliases(char *); DB *db; char *source; diff --git a/usr.sbin/smtpd/map_backend.c b/usr.sbin/smtpd/map_backend.c index b6ecd4fe6f7..c9634c0c09a 100644 --- a/usr.sbin/smtpd/map_backend.c +++ b/usr.sbin/smtpd/map_backend.c @@ -1,4 +1,4 @@ -/* $OpenBSD: map_backend.c,v 1.4 2010/11/28 14:35:58 gilles Exp $ */ +/* $OpenBSD: map_backend.c,v 1.5 2011/04/17 13:36:07 gilles Exp $ */ /* * Copyright (c) 2010 Gilles Chehade <gilles@openbsd.org> @@ -38,16 +38,16 @@ struct map_backend *map_backend_lookup(enum map_src); /* db(3) backend */ -void *map_db_open(char *); -void map_db_close(void *); -char *map_db_get(void *, char *, size_t *); -int map_db_put(void *, char *, char *); +static void *map_db_open(char *); +static void map_db_close(void *); +static char *map_db_get(void *, char *, size_t *); +static int map_db_put(void *, char *, char *); /* stdio(3) backend */ -void *map_stdio_open(char *); -void map_stdio_close(void *); -char *map_stdio_get(void *, char *, size_t *); -int map_stdio_put(void *, char *, char *); +static void *map_stdio_open(char *); +static void map_stdio_close(void *); +static char *map_stdio_get(void *, char *, size_t *); +static int map_stdio_put(void *, char *, char *); struct map_backend map_backends[] = { @@ -75,13 +75,13 @@ map_backend_lookup(enum map_src source) /* db(3) backend */ -void * +static void * map_db_open(char *src) { return dbopen(src, O_RDONLY, 0600, DB_HASH, NULL); } -void +static void map_db_close(void *hdl) { DB *db = hdl; @@ -89,7 +89,7 @@ map_db_close(void *hdl) db->close(db); } -char * +static char * map_db_get(void *hdl, char *key, size_t *len) { int ret; @@ -114,7 +114,7 @@ map_db_get(void *hdl, char *key, size_t *len) return result; } -int +static int map_db_put(void *hdl, char *key, char *val) { return 0; @@ -122,13 +122,13 @@ map_db_put(void *hdl, char *key, char *val) /* stdio(3) backend */ -void * +static void * map_stdio_open(char *src) { return fopen(src, "r"); } -void +static void map_stdio_close(void *hdl) { FILE *fp = hdl; @@ -136,7 +136,7 @@ map_stdio_close(void *hdl) fclose(fp); } -char * +static char * map_stdio_get(void *hdl, char *key, size_t *len) { char *buf, *lbuf; @@ -184,7 +184,7 @@ map_stdio_get(void *hdl, char *key, size_t *len) return result; } -int +static int map_stdio_put(void *hdl, char *key, char *val) { return 0; diff --git a/usr.sbin/smtpd/map_parser.c b/usr.sbin/smtpd/map_parser.c index 8870f16d4a7..0a926c909f7 100644 --- a/usr.sbin/smtpd/map_parser.c +++ b/usr.sbin/smtpd/map_parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: map_parser.c,v 1.5 2010/11/28 14:35:58 gilles Exp $ */ +/* $OpenBSD: map_parser.c,v 1.6 2011/04/17 13:36:07 gilles Exp $ */ /* * Copyright (c) 2010 Gilles Chehade <gilles@openbsd.org> @@ -34,9 +34,9 @@ struct map_parser *map_parser_lookup(enum map_kind); -void *map_parse_secret(char *, char *, size_t); -void *map_parse_alias(char *, char *, size_t); -void *map_parse_virtual(char *, char *, size_t); +static void *map_parse_secret(char *, char *, size_t); +static void *map_parse_alias(char *, char *, size_t); +static void *map_parse_virtual(char *, char *, size_t); struct map_parser map_parsers[] = { { K_NONE, NULL }, @@ -60,7 +60,7 @@ map_parser_lookup(enum map_kind kind) return &map_parsers[i]; } -void * +static void * map_parse_secret(char *key, char *line, size_t len) { struct map_secret *map_secret = NULL; @@ -103,7 +103,7 @@ err: return NULL; } -void * +static void * map_parse_alias(char *key, char *line, size_t len) { char *subrcpt; @@ -144,7 +144,7 @@ error: return NULL; } -void * +static void * map_parse_virtual(char *key, char *line, size_t len) { char *subrcpt; diff --git a/usr.sbin/smtpd/mda.c b/usr.sbin/smtpd/mda.c index c507aea44e1..7626b9ed229 100644 --- a/usr.sbin/smtpd/mda.c +++ b/usr.sbin/smtpd/mda.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mda.c,v 1.53 2011/04/17 11:39:22 gilles Exp $ */ +/* $OpenBSD: mda.c,v 1.54 2011/04/17 13:36:07 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -36,16 +36,16 @@ #include "smtpd.h" #include "log.h" -void mda_imsg(struct smtpd *, struct imsgev *, struct imsg *); -__dead void mda_shutdown(void); -void mda_sig_handler(int, short, void *); -void mda_store(struct mda_session *); -void mda_store_event(int, short, void *); -struct mda_session *mda_lookup(struct smtpd *, u_int32_t); +static void mda_imsg(struct smtpd *, struct imsgev *, struct imsg *); +static void mda_shutdown(void); +static void mda_sig_handler(int, short, void *); +static void mda_store(struct mda_session *); +static void mda_store_event(int, short, void *); +static struct mda_session *mda_lookup(struct smtpd *, u_int32_t); u_int32_t mda_id; -void +static void mda_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) { char output[128], *error, *parent_error; @@ -242,7 +242,7 @@ mda_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) fatalx("mda_imsg: unexpected imsg"); } -void +static void mda_sig_handler(int sig, short event, void *p) { switch (sig) { @@ -255,7 +255,7 @@ mda_sig_handler(int sig, short event, void *p) } } -void +static void mda_shutdown(void) { log_info("mail delivery agent exiting"); @@ -324,7 +324,7 @@ mda(struct smtpd *env) return (0); } -void +static void mda_store(struct mda_session *s) { char *p; @@ -354,7 +354,7 @@ mda_store(struct mda_session *s) free(p); } -void +static void mda_store_event(int fd, short event, void *p) { char tmp[16384]; @@ -388,7 +388,7 @@ mda_store_event(int fd, short event, void *p) event_add(&s->ev, NULL); } -struct mda_session * +static struct mda_session * mda_lookup(struct smtpd *env, u_int32_t id) { struct mda_session *s; diff --git a/usr.sbin/smtpd/mfa.c b/usr.sbin/smtpd/mfa.c index 9a376ed16f2..d1bda911ecc 100644 --- a/usr.sbin/smtpd/mfa.c +++ b/usr.sbin/smtpd/mfa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mfa.c,v 1.56 2011/04/17 11:39:22 gilles Exp $ */ +/* $OpenBSD: mfa.c,v 1.57 2011/04/17 13:36:07 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -34,15 +34,15 @@ #include "smtpd.h" #include "log.h" -void mfa_imsg(struct smtpd *, struct imsgev *, struct imsg *); -__dead void mfa_shutdown(void); -void mfa_sig_handler(int, short, void *); -void mfa_test_mail(struct smtpd *, struct envelope *); -void mfa_test_rcpt(struct smtpd *, struct envelope *); -void mfa_test_rcpt_resume(struct smtpd *, struct submit_status *); -int mfa_strip_source_route(char *, size_t); +static void mfa_imsg(struct smtpd *, struct imsgev *, struct imsg *); +static void mfa_shutdown(void); +static void mfa_sig_handler(int, short, void *); +static void mfa_test_mail(struct smtpd *, struct envelope *); +static void mfa_test_rcpt(struct smtpd *, struct envelope *); +static void mfa_test_rcpt_resume(struct smtpd *, struct submit_status *); +static int mfa_strip_source_route(char *, size_t); -void +static void mfa_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) { if (iev->proc == PROC_SMTP) { @@ -83,7 +83,7 @@ mfa_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) fatalx("mfa_imsg: unexpected imsg"); } -void +static void mfa_sig_handler(int sig, short event, void *p) { switch (sig) { @@ -96,7 +96,7 @@ mfa_sig_handler(int sig, short event, void *p) } } -void +static void mfa_shutdown(void) { log_info("mail filter exiting"); @@ -201,7 +201,7 @@ accept: 0, -1, &ss, sizeof(ss)); } -void +static void mfa_test_rcpt(struct smtpd *env, struct envelope *m) { struct submit_status ss; @@ -232,7 +232,7 @@ refuse: sizeof(ss)); } -void +static void mfa_test_rcpt_resume(struct smtpd *env, struct submit_status *ss) { if (ss->code != 250) { imsg_compose_event(env->sc_ievs[PROC_SMTP], IMSG_MFA_RCPT, 0, 0, -1, ss, @@ -246,7 +246,7 @@ mfa_test_rcpt_resume(struct smtpd *env, struct submit_status *ss) { ss, sizeof(*ss)); } -int +static int mfa_strip_source_route(char *buf, size_t len) { char *p; diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c index b6fa2aa3742..d8f53754168 100644 --- a/usr.sbin/smtpd/mta.c +++ b/usr.sbin/smtpd/mta.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mta.c,v 1.103 2011/04/17 11:39:22 gilles Exp $ */ +/* $OpenBSD: mta.c,v 1.104 2011/04/17 13:36:07 gilles Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -38,24 +38,21 @@ #include "client.h" #include "log.h" -void mta_imsg(struct smtpd *, struct imsgev *, struct imsg *); - -__dead void mta_shutdown(void); -void mta_sig_handler(int, short, void *); - -struct mta_session *mta_lookup(struct smtpd *, u_int64_t); -void mta_enter_state(struct mta_session *, int, void *); -void mta_pickup(struct mta_session *, void *); -void mta_event(int, short, void *); - -void mta_status(struct mta_session *, const char *, ...); -void mta_message_status(struct envelope *, char *); -void mta_message_log(struct mta_session *, struct envelope *); -void mta_message_done(struct mta_session *, struct envelope *); -void mta_connect_done(int, short, void *); -void mta_request_datafd(struct mta_session *); - -void +static void mta_imsg(struct smtpd *, struct imsgev *, struct imsg *); +static void mta_shutdown(void); +static void mta_sig_handler(int, short, void *); +static struct mta_session *mta_lookup(struct smtpd *, u_int64_t); +static void mta_enter_state(struct mta_session *, int, void *); +static void mta_pickup(struct mta_session *, void *); +static void mta_event(int, short, void *); +static void mta_status(struct mta_session *, const char *, ...); +static void mta_message_status(struct envelope *, char *); +static void mta_message_log(struct mta_session *, struct envelope *); +static void mta_message_done(struct mta_session *, struct envelope *); +static void mta_connect_done(int, short, void *); +static void mta_request_datafd(struct mta_session *); + +static void mta_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) { struct ramqueue_batch *rq_batch; @@ -240,7 +237,7 @@ mta_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) fatalx("mta_imsg: unexpected imsg"); } -void +static void mta_sig_handler(int sig, short event, void *p) { switch (sig) { @@ -253,7 +250,7 @@ mta_sig_handler(int sig, short event, void *p) } } -void +static void mta_shutdown(void) { log_info("mail transfer agent exiting"); @@ -324,13 +321,7 @@ mta(struct smtpd *env) return (0); } -int -mta_session_cmp(struct mta_session *a, struct mta_session *b) -{ - return (a->id < b->id ? -1 : a->id > b->id); -} - -struct mta_session * +static struct mta_session * mta_lookup(struct smtpd *env, u_int64_t id) { struct mta_session key, *res; @@ -341,7 +332,7 @@ mta_lookup(struct smtpd *env, u_int64_t id) return (res); } -void +static void mta_enter_state(struct mta_session *s, int newstate, void *p) { struct secret secret; @@ -535,7 +526,7 @@ mta_enter_state(struct mta_session *s, int newstate, void *p) } } -void +static void mta_pickup(struct mta_session *s, void *p) { int error; @@ -606,7 +597,7 @@ mta_pickup(struct mta_session *s, void *p) } } -void +static void mta_event(int fd, short event, void *p) { struct mta_session *s = p; @@ -654,7 +645,7 @@ ro: event_add(&s->ev, &pcb->timeout); } -void +static void mta_status(struct mta_session *s, const char *fmt, ...) { char *status; @@ -682,7 +673,7 @@ mta_status(struct mta_session *s, const char *fmt, ...) free(status); } -void +static void mta_message_status(struct envelope *m, char *status) { /* @@ -699,7 +690,7 @@ mta_message_status(struct envelope *m, char *status) strlcpy(m->session_errorline, status, sizeof(m->session_errorline)); } -void +static void mta_message_log(struct mta_session *s, struct envelope *m) { struct mta_relay *relay = TAILQ_FIRST(&s->relays); @@ -716,7 +707,7 @@ mta_message_log(struct mta_session *s, struct envelope *m) status + 4); } -void +static void mta_message_done(struct mta_session *s, struct envelope *m) { switch (m->session_errorline[0]) { @@ -737,13 +728,13 @@ mta_message_done(struct mta_session *s, struct envelope *m) free(m); } -void +static void mta_connect_done(int fd, short event, void *p) { mta_pickup(p, NULL); } -void +static void mta_request_datafd(struct mta_session *s) { struct ramqueue_batch rq_batch; @@ -757,4 +748,10 @@ mta_request_datafd(struct mta_session *s) 0, 0, -1, &rq_batch, sizeof(rq_batch)); } +int +mta_session_cmp(struct mta_session *a, struct mta_session *b) +{ + return (a->id < b->id ? -1 : a->id > b->id); +} + SPLAY_GENERATE(mtatree, mta_session, entry, mta_session_cmp); diff --git a/usr.sbin/smtpd/queue.c b/usr.sbin/smtpd/queue.c index e0ffc834296..b540fa17a57 100644 --- a/usr.sbin/smtpd/queue.c +++ b/usr.sbin/smtpd/queue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: queue.c,v 1.101 2011/04/17 11:39:22 gilles Exp $ */ +/* $OpenBSD: queue.c,v 1.102 2011/04/17 13:36:07 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -36,14 +36,13 @@ #include "smtpd.h" #include "log.h" -void queue_imsg(struct smtpd *, struct imsgev *, struct imsg *); -void queue_pass_to_runner(struct smtpd *, struct imsgev *, struct imsg *); -__dead void queue_shutdown(void); -void queue_sig_handler(int, short, void *); -void queue_purge(struct smtpd *, enum queue_kind, char *); +static void queue_imsg(struct smtpd *, struct imsgev *, struct imsg *); +static void queue_pass_to_runner(struct smtpd *, struct imsgev *, struct imsg *); +static void queue_shutdown(void); +static void queue_sig_handler(int, short, void *); +static void queue_purge(struct smtpd *, enum queue_kind, char *); - -void +static void queue_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) { struct submit_status ss; @@ -214,7 +213,7 @@ queue_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) fatalx("queue_imsg: unexpected imsg"); } -void +static void queue_pass_to_runner(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) { imsg_compose_event(env->sc_ievs[PROC_RUNNER], imsg->hdr.type, @@ -222,7 +221,7 @@ queue_pass_to_runner(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) imsg->hdr.len - sizeof imsg->hdr); } -void +static void queue_sig_handler(int sig, short event, void *p) { switch (sig) { @@ -235,7 +234,7 @@ queue_sig_handler(int sig, short event, void *p) } } -void +static void queue_shutdown(void) { log_info("queue handler exiting"); @@ -319,7 +318,7 @@ queue(struct smtpd *env) return (0); } -void +static void queue_purge(struct smtpd *env, enum queue_kind qkind, char *queuepath) { char path[MAXPATHLEN]; diff --git a/usr.sbin/smtpd/ramqueue.c b/usr.sbin/smtpd/ramqueue.c index 5beb2076561..ee0f5cfeb8a 100644 --- a/usr.sbin/smtpd/ramqueue.c +++ b/usr.sbin/smtpd/ramqueue.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ramqueue.c,v 1.5 2011/04/17 11:39:23 gilles Exp $ */ +/* $OpenBSD: ramqueue.c,v 1.6 2011/04/17 13:36:07 gilles Exp $ */ /* * Copyright (c) 2011 Gilles Chehade <gilles@openbsd.org> @@ -38,19 +38,19 @@ #include "smtpd.h" #include "log.h" -int ramqueue_expire(struct smtpd *, struct envelope *, time_t); -void ramqueue_insert(struct ramqueue *, struct envelope *, time_t); -time_t ramqueue_next_schedule(struct envelope *, time_t); -int ramqueue_host_cmp(struct ramqueue_host *, struct ramqueue_host *); -struct ramqueue_host *ramqueue_get_host(struct ramqueue *, char *); -struct ramqueue_batch *ramqueue_get_batch(struct ramqueue *, + +void ramqueue_insert(struct ramqueue *, struct envelope *, time_t); +int ramqueue_host_cmp(struct ramqueue_host *, struct ramqueue_host *); +void ramqueue_put_host(struct ramqueue *, struct ramqueue_host *); +void ramqueue_put_batch(struct ramqueue *, struct ramqueue_batch *); +int ramqueue_load_offline(struct ramqueue *); + +static int ramqueue_expire(struct smtpd *, struct envelope *, time_t); +static time_t ramqueue_next_schedule(struct envelope *, time_t); +static struct ramqueue_host *ramqueue_get_host(struct ramqueue *, char *); +static struct ramqueue_batch *ramqueue_get_batch(struct ramqueue *, struct ramqueue_host *, struct envelope *); -void ramqueue_put_host(struct ramqueue *, struct ramqueue_host *); -void ramqueue_put_batch(struct ramqueue *, struct ramqueue_batch *); -int ramqueue_load_offline(struct ramqueue *); -u_int32_t filename_to_msgid(char *); -u_int64_t filename_to_evpid(char *); void ramqueue_init(struct smtpd *env, struct ramqueue *rqueue) @@ -213,7 +213,7 @@ ramqueue_remove(struct ramqueue *rqueue, struct ramqueue_envelope *rq_evp) rqueue->env->stats->ramqueue.envelopes--; } -int +static int ramqueue_expire(struct smtpd *env, struct envelope *envelope, time_t curtm) { struct envelope bounce; @@ -230,7 +230,7 @@ ramqueue_expire(struct smtpd *env, struct envelope *envelope, time_t curtm) return 0; } -time_t +static time_t ramqueue_next_schedule(struct envelope *envelope, time_t curtm) { time_t delay; @@ -265,7 +265,7 @@ ramqueue_next_schedule(struct envelope *envelope, time_t curtm) return curtm + delay; } -struct ramqueue_host * +static struct ramqueue_host * ramqueue_get_host(struct ramqueue *rqueue, char *hostname) { struct ramqueue_host *rq_host, key; @@ -295,7 +295,7 @@ ramqueue_put_host(struct ramqueue *rqueue, struct ramqueue_host *host) RB_INSERT(hosttree, &rqueue->hosttree, host); } -struct ramqueue_batch * +static struct ramqueue_batch * ramqueue_get_batch(struct ramqueue *rqueue, struct ramqueue_host *host, struct envelope *envelope) { diff --git a/usr.sbin/smtpd/ruleset.c b/usr.sbin/smtpd/ruleset.c index d50bffee02e..84b7e818f14 100644 --- a/usr.sbin/smtpd/ruleset.c +++ b/usr.sbin/smtpd/ruleset.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ruleset.c,v 1.15 2010/11/28 14:35:58 gilles Exp $ */ +/* $OpenBSD: ruleset.c,v 1.16 2011/04/17 13:36:07 gilles Exp $ */ /* * Copyright (c) 2009 Gilles Chehade <gilles@openbsd.org> @@ -32,11 +32,14 @@ #include "smtpd.h" #include "log.h" -struct rule *ruleset_match(struct smtpd *, char *tag, struct path *, struct sockaddr_storage *); -int ruleset_check_source(struct map *, struct sockaddr_storage *); -int ruleset_match_mask(struct sockaddr_storage *, struct netaddr *); -int ruleset_inet4_match(struct sockaddr_in *, struct netaddr *); -int ruleset_inet6_match(struct sockaddr_in6 *, struct netaddr *); + +struct rule *ruleset_match(struct smtpd *, char *tag, struct path *, struct sockaddr_storage *); + +static int ruleset_check_source(struct map *, struct sockaddr_storage *); +static int ruleset_match_mask(struct sockaddr_storage *, struct netaddr *); +static int ruleset_inet4_match(struct sockaddr_in *, struct netaddr *); +static int ruleset_inet6_match(struct sockaddr_in6 *, struct netaddr *); + struct rule * ruleset_match(struct smtpd *env, char *tag, struct path *path, struct sockaddr_storage *ss) @@ -88,7 +91,7 @@ ruleset_match(struct smtpd *env, char *tag, struct path *path, struct sockaddr_s return NULL; } -int +static int ruleset_check_source(struct map *map, struct sockaddr_storage *ss) { struct mapel *me; @@ -115,7 +118,7 @@ ruleset_check_source(struct map *map, struct sockaddr_storage *ss) return 0; } -int +static int ruleset_match_mask(struct sockaddr_storage *ss, struct netaddr *ssmask) { if (ss->ss_family == AF_INET) @@ -127,7 +130,7 @@ ruleset_match_mask(struct sockaddr_storage *ss, struct netaddr *ssmask) return (0); } -int +static int ruleset_inet4_match(struct sockaddr_in *ss, struct netaddr *ssmask) { in_addr_t mask; @@ -147,7 +150,7 @@ ruleset_inet4_match(struct sockaddr_in *ss, struct netaddr *ssmask) return 0; } -int +static int ruleset_inet6_match(struct sockaddr_in6 *ss, struct netaddr *ssmask) { struct in6_addr *in; diff --git a/usr.sbin/smtpd/runner.c b/usr.sbin/smtpd/runner.c index 28eb88fe33f..9877a3b5faf 100644 --- a/usr.sbin/smtpd/runner.c +++ b/usr.sbin/smtpd/runner.c @@ -1,4 +1,4 @@ -/* $OpenBSD: runner.c,v 1.104 2011/04/17 11:39:23 gilles Exp $ */ +/* $OpenBSD: runner.c,v 1.105 2011/04/17 13:36:07 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -41,33 +41,30 @@ #include "smtpd.h" #include "log.h" -void runner_imsg(struct smtpd *, struct imsgev *, struct imsg *); -__dead void runner_shutdown(void); -void runner_sig_handler(int, short, void *); -void runner_setup_events(struct smtpd *); -void runner_reset_events(struct smtpd *); -void runner_disable_events(struct smtpd *); +void ramqueue_insert(struct ramqueue *, struct envelope *, time_t); -void runner_timeout(int, short, void *); +static void runner_imsg(struct smtpd *, struct imsgev *, struct imsg *); +static void runner_shutdown(void); +static void runner_sig_handler(int, short, void *); +static void runner_setup_events(struct smtpd *); +static void runner_reset_events(struct smtpd *); +static void runner_disable_events(struct smtpd *); +static void runner_timeout(int, short, void *); +static int runner_process_envelope(struct smtpd *, struct ramqueue_envelope *, time_t); +static void runner_process_batch(struct smtpd *, struct ramqueue_envelope *, time_t); +static void runner_purge_run(void); +static void runner_purge_message(u_int32_t); +static int runner_check_loop(struct smtpd *, struct envelope *); +static int runner_force_message_to_ramqueue(struct ramqueue *, u_int32_t); -int runner_process_envelope(struct smtpd *, struct ramqueue_envelope *, time_t); -void runner_process_batch(struct smtpd *, struct ramqueue_envelope *, time_t); - -void runner_purge_run(void); -void runner_purge_message(u_int32_t); - -int runner_check_loop(struct smtpd *, struct envelope *); - -int runner_force_message_to_ramqueue(struct ramqueue *, u_int32_t); - -void ramqueue_insert(struct ramqueue *, struct envelope *, time_t); /*temporary*/ u_int16_t fsqueue_hash(u_int32_t); u_int64_t filename_to_evpid(char *); u_int32_t filename_to_msgid(char *); + void runner_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) { @@ -273,6 +270,7 @@ runner(struct smtpd *env) runner_setup_events(env); event_dispatch(); + runner_disable_events(env); runner_shutdown(); return (0); diff --git a/usr.sbin/smtpd/smtp.c b/usr.sbin/smtpd/smtp.c index 2164f8bc6c3..883a1dd103a 100644 --- a/usr.sbin/smtpd/smtp.c +++ b/usr.sbin/smtpd/smtp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtp.c,v 1.83 2011/04/17 11:39:23 gilles Exp $ */ +/* $OpenBSD: smtp.c,v 1.84 2011/04/17 13:36:07 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -37,18 +37,19 @@ #include "smtpd.h" #include "log.h" -void smtp_imsg(struct smtpd *, struct imsgev *, struct imsg *); -__dead void smtp_shutdown(void); -void smtp_sig_handler(int, short, void *); -void smtp_setup_events(struct smtpd *); -void smtp_disable_events(struct smtpd *); -void smtp_pause(struct smtpd *); -int smtp_enqueue(struct smtpd *, uid_t *); -void smtp_accept(int, short, void *); -struct session *smtp_new(struct listener *); -struct session *session_lookup(struct smtpd *, u_int64_t); +static void smtp_imsg(struct smtpd *, struct imsgev *, struct imsg *); +static void smtp_shutdown(void); +static void smtp_sig_handler(int, short, void *); +static void smtp_setup_events(struct smtpd *); +static void smtp_disable_events(struct smtpd *); +static void smtp_pause(struct smtpd *); +static int smtp_enqueue(struct smtpd *, uid_t *); +static void smtp_accept(int, short, void *); +static struct session *smtp_new(struct listener *); +static struct session *session_lookup(struct smtpd *, u_int64_t); -void + +static void smtp_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) { struct session skey; @@ -282,7 +283,7 @@ smtp_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) fatalx("smtp_imsg: unexpected imsg"); } -void +static void smtp_sig_handler(int sig, short event, void *p) { switch (sig) { @@ -295,7 +296,7 @@ smtp_sig_handler(int sig, short event, void *p) } } -void +static void smtp_shutdown(void) { log_info("smtp server exiting"); @@ -370,7 +371,7 @@ smtp(struct smtpd *env) return (0); } -void +static void smtp_setup_events(struct smtpd *env) { struct listener *l; @@ -398,7 +399,7 @@ smtp_setup_events(struct smtpd *env) log_debug("smtp: will accept at most %d clients", env->sc_maxconn); } -void +static void smtp_disable_events(struct smtpd *env) { struct listener *l; @@ -415,7 +416,7 @@ smtp_disable_events(struct smtpd *env) env->sc_maxconn = 0; } -void +static void smtp_pause(struct smtpd *env) { struct listener *l; @@ -439,7 +440,7 @@ smtp_resume(struct smtpd *env) event_add(&l->ev, NULL); } -int +static int smtp_enqueue(struct smtpd *env, uid_t *euid) { static struct listener local, *l; @@ -498,7 +499,7 @@ smtp_enqueue(struct smtpd *env, uid_t *euid) return (fd[1]); } -void +static void smtp_accept(int fd, short event, void *p) { struct listener *l = p; @@ -521,7 +522,7 @@ smtp_accept(int fd, short event, void *p) } -struct session * +static struct session * smtp_new(struct listener *l) { struct smtpd *env = l->env; @@ -564,7 +565,7 @@ smtp_new(struct listener *l) /* * Helper function for handling IMSG replies. */ -struct session * +static struct session * session_lookup(struct smtpd *env, u_int64_t id) { struct session key; diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c index b9669e26aa5..a32d213e6d3 100644 --- a/usr.sbin/smtpd/smtp_session.c +++ b/usr.sbin/smtpd/smtp_session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtp_session.c,v 1.139 2011/04/15 17:01:05 gilles Exp $ */ +/* $OpenBSD: smtp_session.c,v 1.140 2011/04/17 13:36:07 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -39,38 +39,37 @@ #include "smtpd.h" #include "log.h" -int session_rfc5321_helo_handler(struct session *, char *); -int session_rfc5321_ehlo_handler(struct session *, char *); -int session_rfc5321_rset_handler(struct session *, char *); -int session_rfc5321_noop_handler(struct session *, char *); -int session_rfc5321_data_handler(struct session *, char *); -int session_rfc5321_mail_handler(struct session *, char *); -int session_rfc5321_rcpt_handler(struct session *, char *); -int session_rfc5321_vrfy_handler(struct session *, char *); -int session_rfc5321_expn_handler(struct session *, char *); -int session_rfc5321_turn_handler(struct session *, char *); -int session_rfc5321_help_handler(struct session *, char *); -int session_rfc5321_quit_handler(struct session *, char *); -int session_rfc5321_none_handler(struct session *, char *); - -int session_rfc1652_mail_handler(struct session *, char *); - -int session_rfc3207_stls_handler(struct session *, char *); - -int session_rfc4954_auth_handler(struct session *, char *); -void session_rfc4954_auth_plain(struct session *, char *); -void session_rfc4954_auth_login(struct session *, char *); - -void session_read(struct bufferevent *, void *); -void session_read_data(struct session *, char *); -void session_write(struct bufferevent *, void *); -void session_error(struct bufferevent *, short event, void *); -void session_command(struct session *, char *); -char *session_readline(struct session *); -void session_respond_delayed(int, short, void *); -int session_set_path(struct path *, char *); -void session_imsg(struct session *, enum smtp_proc_type, - enum imsg_type, u_int32_t, pid_t, int, void *, u_int16_t); +static int session_rfc5321_helo_handler(struct session *, char *); +static int session_rfc5321_ehlo_handler(struct session *, char *); +static int session_rfc5321_rset_handler(struct session *, char *); +static int session_rfc5321_noop_handler(struct session *, char *); +static int session_rfc5321_data_handler(struct session *, char *); +static int session_rfc5321_mail_handler(struct session *, char *); +static int session_rfc5321_rcpt_handler(struct session *, char *); +static int session_rfc5321_vrfy_handler(struct session *, char *); +static int session_rfc5321_expn_handler(struct session *, char *); +static int session_rfc5321_turn_handler(struct session *, char *); +static int session_rfc5321_help_handler(struct session *, char *); +static int session_rfc5321_quit_handler(struct session *, char *); + +static int session_rfc1652_mail_handler(struct session *, char *); + +static int session_rfc3207_stls_handler(struct session *, char *); + +static int session_rfc4954_auth_handler(struct session *, char *); +static void session_rfc4954_auth_plain(struct session *, char *); +static void session_rfc4954_auth_login(struct session *, char *); + +static void session_read(struct bufferevent *, void *); +static void session_read_data(struct session *, char *); +static void session_write(struct bufferevent *, void *); +static void session_error(struct bufferevent *, short event, void *); +static void session_command(struct session *, char *); +static char *session_readline(struct session *); +static void session_respond_delayed(int, short, void *); +static int session_set_path(struct path *, char *); +static void session_imsg(struct session *, enum smtp_proc_type, + enum imsg_type, u_int32_t, pid_t, int, void *, u_int16_t); struct session_cmd { char *name; @@ -104,7 +103,7 @@ struct session_cmd rfc4954_cmdtab[] = { { "auth", session_rfc4954_auth_handler } }; -int +static int session_rfc3207_stls_handler(struct session *s, char *args) { if (! ADVERTISE_TLS(s)) @@ -131,7 +130,7 @@ session_rfc3207_stls_handler(struct session *s, char *args) return 1; } -int +static int session_rfc4954_auth_handler(struct session *s, char *args) { char *method; @@ -177,7 +176,7 @@ session_rfc4954_auth_handler(struct session *s, char *args) return 1; } -void +static void session_rfc4954_auth_plain(struct session *s, char *arg) { struct auth *a = &s->s_auth; @@ -236,7 +235,7 @@ abort: s->s_state = S_HELO; } -void +static void session_rfc4954_auth_login(struct session *s, char *arg) { struct auth *a = &s->s_auth; @@ -279,7 +278,7 @@ abort: s->s_state = S_HELO; } -int +static int session_rfc1652_mail_handler(struct session *s, char *args) { char *body; @@ -316,7 +315,7 @@ session_rfc1652_mail_handler(struct session *s, char *args) return session_rfc5321_mail_handler(s, args); } -int +static int session_rfc5321_helo_handler(struct session *s, char *args) { if (args == NULL) { @@ -339,7 +338,7 @@ session_rfc5321_helo_handler(struct session *s, char *args) return 1; } -int +static int session_rfc5321_ehlo_handler(struct session *s, char *args) { if (args == NULL) { @@ -379,7 +378,7 @@ session_rfc5321_ehlo_handler(struct session *s, char *args) return 1; } -int +static int session_rfc5321_rset_handler(struct session *s, char *args) { s->s_state = S_HELO; @@ -388,7 +387,7 @@ session_rfc5321_rset_handler(struct session *s, char *args) return 1; } -int +static int session_rfc5321_noop_handler(struct session *s, char *args) { session_respond(s, "250 2.0.0 OK"); @@ -396,7 +395,7 @@ session_rfc5321_noop_handler(struct session *s, char *args) return 1; } -int +static int session_rfc5321_mail_handler(struct session *s, char *args) { if (s->s_state == S_GREETED) { @@ -428,7 +427,7 @@ session_rfc5321_mail_handler(struct session *s, char *args) return 1; } -int +static int session_rfc5321_rcpt_handler(struct session *s, char *args) { if (s->s_state == S_GREETED) { @@ -454,7 +453,7 @@ session_rfc5321_rcpt_handler(struct session *s, char *args) return 1; } -int +static int session_rfc5321_quit_handler(struct session *s, char *args) { session_respond(s, "221 2.0.0 %s Closing connection", s->s_env->sc_hostname); @@ -464,7 +463,7 @@ session_rfc5321_quit_handler(struct session *s, char *args) return 1; } -int +static int session_rfc5321_data_handler(struct session *s, char *args) { if (s->s_state == S_GREETED) { @@ -490,7 +489,7 @@ session_rfc5321_data_handler(struct session *s, char *args) return 1; } -int +static int session_rfc5321_vrfy_handler(struct session *s, char *args) { session_respond(s, "252 5.5.1 Cannot VRFY; try RCPT to attempt delivery"); @@ -498,7 +497,7 @@ session_rfc5321_vrfy_handler(struct session *s, char *args) return 1; } -int +static int session_rfc5321_expn_handler(struct session *s, char *args) { session_respond(s, "502 5.5.2 Sorry, we do not allow this operation"); @@ -506,7 +505,7 @@ session_rfc5321_expn_handler(struct session *s, char *args) return 1; } -int +static int session_rfc5321_turn_handler(struct session *s, char *args) { session_respond(s, "502 5.5.2 Sorry, we do not allow this operation"); @@ -514,7 +513,7 @@ session_rfc5321_turn_handler(struct session *s, char *args) return 1; } -int +static int session_rfc5321_help_handler(struct session *s, char *args) { session_respond(s, "214- This is OpenSMTPD"); @@ -526,7 +525,7 @@ session_rfc5321_help_handler(struct session *s, char *args) return 1; } -void +static void session_command(struct session *s, char *cmd) { char *ep, *args; @@ -761,7 +760,7 @@ session_bufferevent_new(struct session *s) SMTPD_SESSION_TIMEOUT); } -void +static void session_read(struct bufferevent *bev, void *p) { struct session *s = p; @@ -814,7 +813,7 @@ tempfail: free(line); } -void +static void session_read_data(struct session *s, char *line) { size_t datalen; @@ -877,7 +876,7 @@ session_read_data(struct session *s, char *line) } } -void +static void session_write(struct bufferevent *bev, void *p) { struct session *s = p; @@ -919,7 +918,7 @@ session_write(struct bufferevent *bev, void *p) } } -void +static void session_error(struct bufferevent *bev, short event, void *p) { struct session *s = p; @@ -1001,7 +1000,7 @@ session_destroy(struct session *s) free(s); } -char * +static char * session_readline(struct session *s) { char *line, *line2; @@ -1059,7 +1058,7 @@ session_cmp(struct session *s1, struct session *s2) return (0); } -int +static int session_set_path(struct path *path, char *line) { size_t len; @@ -1139,7 +1138,7 @@ session_respond(struct session *s, char *fmt, ...) bufferevent_enable(s->s_bev, EV_WRITE); } -void +static void session_respond_delayed(int fd, short event, void *p) { struct session *s = p; @@ -1150,7 +1149,7 @@ session_respond_delayed(int fd, short event, void *p) /* * Send IMSG, waiting for reply safely. */ -void +static void session_imsg(struct session *s, enum smtp_proc_type proc, enum imsg_type type, u_int32_t peerid, pid_t pid, int fd, void *data, u_int16_t datalen) { diff --git a/usr.sbin/smtpd/smtpctl.c b/usr.sbin/smtpd/smtpctl.c index 4c0be4cc7fd..d9c7db9d518 100644 --- a/usr.sbin/smtpd/smtpctl.c +++ b/usr.sbin/smtpd/smtpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpctl.c,v 1.58 2011/04/13 20:53:18 gilles Exp $ */ +/* $OpenBSD: smtpctl.c,v 1.59 2011/04/17 13:36:07 gilles Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -37,9 +37,9 @@ #include "smtpd.h" #include "parser.h" -__dead void usage(void); -int show_command_output(struct imsg*); -int show_stats_output(struct imsg *); +void usage(void); +static int show_command_output(struct imsg*); +static int show_stats_output(struct imsg *); int proctype; struct imsgbuf *ibuf; @@ -215,7 +215,7 @@ connected: return (0); } -int +static int show_command_output(struct imsg *imsg) { switch (imsg->hdr.type) { @@ -231,7 +231,7 @@ show_command_output(struct imsg *imsg) return (1); } -int +static int show_stats_output(struct imsg *imsg) { struct stats *stats; diff --git a/usr.sbin/smtpd/smtpd.c b/usr.sbin/smtpd/smtpd.c index 95e589c0d85..d5f49cb1ff8 100644 --- a/usr.sbin/smtpd/smtpd.c +++ b/usr.sbin/smtpd/smtpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.c,v 1.120 2011/04/14 22:46:38 gilles Exp $ */ +/* $OpenBSD: smtpd.c,v 1.121 2011/04/17 13:36:07 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -44,33 +44,30 @@ #include "smtpd.h" #include "log.h" -void parent_imsg(struct smtpd *, struct imsgev *, struct imsg *); -__dead void usage(void); -void parent_shutdown(struct smtpd *); -void parent_send_config(int, short, void *); -void parent_send_config_listeners(struct smtpd *); -void parent_send_config_client_certs(struct smtpd *); -void parent_send_config_ruleset(struct smtpd *, int); -void parent_sig_handler(int, short, void *); - -void forkmda(struct smtpd *, struct imsgev *, u_int32_t, - struct deliver *); -int parent_enqueue_offline(struct smtpd *, char *); -int parent_forward_open(char *); -int path_starts_with(char *, char *); - -void fork_peers(struct smtpd *); - -struct child *child_add(struct smtpd *, pid_t, int, int); -void child_del(struct smtpd *, pid_t); -struct child *child_lookup(struct smtpd *, pid_t); +static void parent_imsg(struct smtpd *, struct imsgev *, struct imsg *); +static void usage(void); +static void parent_shutdown(struct smtpd *); +static void parent_send_config(int, short, void *); +static void parent_send_config_listeners(struct smtpd *); +static void parent_send_config_client_certs(struct smtpd *); +static void parent_send_config_ruleset(struct smtpd *, int); +static void parent_sig_handler(int, short, void *); +static void forkmda(struct smtpd *, struct imsgev *, u_int32_t, + struct deliver *); +static int parent_enqueue_offline(struct smtpd *, char *); +static int parent_forward_open(char *); +static int path_starts_with(char *, char *); +static void fork_peers(struct smtpd *); +static struct child *child_lookup(struct smtpd *, pid_t); +static struct child *child_add(struct smtpd *, pid_t, int, int); +static void child_del(struct smtpd *, pid_t); extern char **environ; void (*imsg_callback)(struct smtpd *, struct imsgev *, struct imsg *); int __b64_pton(char const *, unsigned char *, size_t); -void +static void parent_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) { struct smtpd newenv; @@ -180,7 +177,7 @@ parent_imsg(struct smtpd *env, struct imsgev *iev, struct imsg *imsg) fatalx("parent_imsg: unexpected imsg"); } -__dead void +static void usage(void) { extern char *__progname; @@ -190,7 +187,7 @@ usage(void) exit(1); } -void +static void parent_shutdown(struct smtpd *env) { struct child *child; @@ -208,7 +205,7 @@ parent_shutdown(struct smtpd *env) exit(0); } -void +static void parent_send_config(int fd, short event, void *p) { parent_send_config_listeners(p); @@ -216,7 +213,7 @@ parent_send_config(int fd, short event, void *p) parent_send_config_ruleset(p, PROC_LKA); } -void +static void parent_send_config_listeners(struct smtpd *env) { struct listener *l; @@ -262,7 +259,7 @@ parent_send_config_listeners(struct smtpd *env) 0, 0, -1, NULL, 0); } -void +static void parent_send_config_client_certs(struct smtpd *env) { struct ssl *s; @@ -325,7 +322,7 @@ parent_send_config_ruleset(struct smtpd *env, int proc) 0, 0, -1, NULL, 0); } -void +static void parent_sig_handler(int sig, short event, void *p) { struct smtpd *env = p; @@ -542,7 +539,7 @@ main(int argc, char *argv[]) return (0); } -void +static void fork_peers(struct smtpd *env) { SPLAY_INIT(&env->children); @@ -613,7 +610,7 @@ child_add(struct smtpd *env, pid_t pid, int type, int title) return (child); } -void +static void child_del(struct smtpd *env, pid_t pid) { struct child *p; @@ -627,7 +624,7 @@ child_del(struct smtpd *env, pid_t pid) free(p); } -struct child * +static struct child * child_lookup(struct smtpd *env, pid_t pid) { struct child key; @@ -662,7 +659,7 @@ imsg_compose_event(struct imsgev *iev, u_int16_t type, u_int32_t peerid, imsg_event_add(iev); } -void +static void forkmda(struct smtpd *env, struct imsgev *iev, u_int32_t id, struct deliver *deliver) { @@ -864,7 +861,7 @@ forkmda(struct smtpd *env, struct imsgev *iev, u_int32_t id, #undef error #undef error2 -int +static int parent_enqueue_offline(struct smtpd *env, char *runner_path) { char path[MAXPATHLEN]; @@ -974,7 +971,7 @@ parent_enqueue_offline(struct smtpd *env, char *runner_path) return (1); } -int +static int parent_forward_open(char *username) { struct passwd *pw; diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index c95bbe25a34..ca4a489cb89 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpd.h,v 1.218 2011/04/17 12:46:46 gilles Exp $ */ +/* $OpenBSD: smtpd.h,v 1.219 2011/04/17 13:36:07 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -926,8 +926,8 @@ struct queue_backend { struct envelope *); }; -extern void (*imsg_callback)(struct smtpd *, struct imsgev *, struct imsg *); +extern void (*imsg_callback)(struct smtpd *, struct imsgev *, struct imsg *); /* aliases.c */ @@ -951,32 +951,34 @@ void bounce_event(int, short, void *); /* config.c */ -#define PURGE_LISTENERS 0x01 -#define PURGE_MAPS 0x02 -#define PURGE_RULES 0x04 -#define PURGE_SSL 0x08 -#define PURGE_EVERYTHING 0xff -void purge_config(struct smtpd *, u_int8_t); -void unconfigure(struct smtpd *); -void configure(struct smtpd *); -void init_pipes(struct smtpd *); -void config_pipes(struct smtpd *, struct peer *, u_int); -void config_peers(struct smtpd *, struct peer *, u_int); +#define PURGE_LISTENERS 0x01 +#define PURGE_MAPS 0x02 +#define PURGE_RULES 0x04 +#define PURGE_SSL 0x08 +#define PURGE_EVERYTHING 0xff +void purge_config(struct smtpd *, u_int8_t); +void unconfigure(struct smtpd *); +void configure(struct smtpd *); +void init_pipes(struct smtpd *); +void config_pipes(struct smtpd *, struct peer *, u_int); +void config_peers(struct smtpd *, struct peer *, u_int); /* control.c */ -pid_t control(struct smtpd *); -void session_socket_blockmode(int, enum blockmodes); -void session_socket_no_linger(int); -int session_socket_error(int); +pid_t control(struct smtpd *); +void session_socket_blockmode(int, enum blockmodes); +void session_socket_no_linger(int); +int session_socket_error(int); /* dns.c */ -void dns_query_host(struct smtpd *, char *, int, u_int64_t); -void dns_query_mx(struct smtpd *, char *, int, u_int64_t); -void dns_query_ptr(struct smtpd *, struct sockaddr_storage *, +void dns_query_host(struct smtpd *, char *, int, u_int64_t); +void dns_query_mx(struct smtpd *, char *, int, u_int64_t); +void dns_query_ptr(struct smtpd *, struct sockaddr_storage *, u_int64_t); -void dns_async(struct smtpd *, struct imsgev *, int, struct dns *); +void dns_async(struct smtpd *, struct imsgev *, int, struct dns *); +int dnssession_cmp(struct dnssession *, struct dnssession *); +SPLAY_PROTOTYPE(dnstree, dnssession, nodes, dnssession_cmp); /* enqueue.c */ @@ -999,84 +1001,81 @@ int forwards_get(int, struct expandtree *); /* lka.c */ -pid_t lka(struct smtpd *); -int lkasession_cmp(struct lkasession *, struct lkasession *); -int dnssession_cmp(struct dnssession *, struct dnssession *); +pid_t lka(struct smtpd *); +int lkasession_cmp(struct lkasession *, struct lkasession *); SPLAY_PROTOTYPE(lkatree, lkasession, nodes, lkasession_cmp); -SPLAY_PROTOTYPE(dnstree, dnssession, nodes, dnssession_cmp); /* map.c */ -void *map_lookup(struct smtpd *, objid_t, char *, enum map_kind); -struct map *map_find(struct smtpd *, objid_t); -struct map *map_findbyname(struct smtpd *, const char *); - +void *map_lookup(struct smtpd *, objid_t, char *, enum map_kind); +struct map *map_find(struct smtpd *, objid_t); +struct map *map_findbyname(struct smtpd *, const char *); /* mda.c */ -pid_t mda(struct smtpd *); +pid_t mda(struct smtpd *); /* mfa.c */ -pid_t mfa(struct smtpd *); +pid_t mfa(struct smtpd *); /* mta.c */ -pid_t mta(struct smtpd *); -int mta_session_cmp(struct mta_session *, struct mta_session *); +pid_t mta(struct smtpd *); +int mta_session_cmp(struct mta_session *, struct mta_session *); SPLAY_PROTOTYPE(mtatree, mta_session, entry, mta_session_cmp); /* parse.y */ -int parse_config(struct smtpd *, const char *, int); -int cmdline_symset(char *); +int parse_config(struct smtpd *, const char *, int); +int cmdline_symset(char *); /* queue.c */ -pid_t queue(struct smtpd *); -void queue_submit_envelope(struct smtpd *, struct envelope *); -void queue_commit_envelopes(struct smtpd *, struct envelope *); +pid_t queue(struct smtpd *); +void queue_submit_envelope(struct smtpd *, struct envelope *); +void queue_commit_envelopes(struct smtpd *, struct envelope *); /* queue_backend.c */ struct queue_backend *queue_backend_lookup(enum queue_type); -int queue_message_create(struct smtpd *, enum queue_kind, u_int32_t *); -int queue_message_delete(struct smtpd *, enum queue_kind, u_int32_t); -int queue_message_commit(struct smtpd *, enum queue_kind, u_int32_t); -int queue_message_fd_r(struct smtpd *, enum queue_kind, u_int32_t); -int queue_message_fd_rw(struct smtpd *, enum queue_kind, u_int32_t); -int queue_message_purge(struct smtpd *, enum queue_kind, u_int32_t); -int queue_envelope_create(struct smtpd *, enum queue_kind, +int queue_message_create(struct smtpd *, enum queue_kind, u_int32_t *); +int queue_message_delete(struct smtpd *, enum queue_kind, u_int32_t); +int queue_message_commit(struct smtpd *, enum queue_kind, u_int32_t); +int queue_message_fd_r(struct smtpd *, enum queue_kind, u_int32_t); +int queue_message_fd_rw(struct smtpd *, enum queue_kind, u_int32_t); +int queue_message_purge(struct smtpd *, enum queue_kind, u_int32_t); +int queue_envelope_create(struct smtpd *, enum queue_kind, struct envelope *); -int queue_envelope_delete(struct smtpd *, enum queue_kind, +int queue_envelope_delete(struct smtpd *, enum queue_kind, struct envelope *); -int queue_envelope_load(struct smtpd *, enum queue_kind, +int queue_envelope_load(struct smtpd *, enum queue_kind, u_int64_t, struct envelope *); -int queue_envelope_update(struct smtpd *, enum queue_kind, +int queue_envelope_update(struct smtpd *, enum queue_kind, struct envelope *); /* queue_shared.c */ -void queue_message_update(struct smtpd *, struct envelope *); +void queue_message_update(struct smtpd *, struct envelope *); struct qwalk *qwalk_new(char *); -int qwalk(struct qwalk *, char *); -void qwalk_close(struct qwalk *); -int bounce_record_message(struct smtpd *, struct envelope *, struct envelope *); -void show_queue(char *, int); +int qwalk(struct qwalk *, char *); +void qwalk_close(struct qwalk *); +int bounce_record_message(struct smtpd *, struct envelope *, struct envelope *); +void show_queue(char *, int); /* ramqueue.c */ -void ramqueue_init(struct smtpd *, struct ramqueue *); -int ramqueue_load(struct ramqueue *, time_t *); -int ramqueue_load_offline(struct ramqueue *); -int ramqueue_host_cmp(struct ramqueue_host *, struct ramqueue_host *); -void ramqueue_remove(struct ramqueue *, struct ramqueue_envelope *); -int ramqueue_is_empty(struct ramqueue *); -int ramqueue_is_empty(struct ramqueue *); -int ramqueue_batch_is_empty(struct ramqueue_batch *); -int ramqueue_host_is_empty(struct ramqueue_host *); -void ramqueue_remove_batch(struct ramqueue_host *, struct ramqueue_batch *); -void ramqueue_remove_host(struct ramqueue *, struct ramqueue_host *); +void ramqueue_init(struct smtpd *, struct ramqueue *); +int ramqueue_load(struct ramqueue *, time_t *); +int ramqueue_load_offline(struct ramqueue *); +int ramqueue_host_cmp(struct ramqueue_host *, struct ramqueue_host *); +void ramqueue_remove(struct ramqueue *, struct ramqueue_envelope *); +int ramqueue_is_empty(struct ramqueue *); +int ramqueue_is_empty(struct ramqueue *); +int ramqueue_batch_is_empty(struct ramqueue_batch *); +int ramqueue_host_is_empty(struct ramqueue_host *); +void ramqueue_remove_batch(struct ramqueue_host *, struct ramqueue_batch *); +void ramqueue_remove_host(struct ramqueue *, struct ramqueue_host *); struct ramqueue_envelope *ramqueue_first_envelope(struct ramqueue *); struct ramqueue_envelope *ramqueue_next_envelope(struct ramqueue *); struct ramqueue_envelope *ramqueue_batch_first_envelope(struct ramqueue_batch *); @@ -1084,45 +1083,43 @@ RB_PROTOTYPE(hosttree, ramqueue_host, host_entry, ramqueue_host_cmp); /* runner.c */ -pid_t runner(struct smtpd *); -void message_reset_flags(struct envelope *); +pid_t runner(struct smtpd *); +void message_reset_flags(struct envelope *); /* smtp.c */ -pid_t smtp(struct smtpd *); -void smtp_resume(struct smtpd *); +pid_t smtp(struct smtpd *); +void smtp_resume(struct smtpd *); /* smtp_session.c */ -void session_init(struct listener *, struct session *); -int session_cmp(struct session *, struct session *); -void session_pickup(struct session *, struct submit_status *); -void session_destroy(struct session *); -void session_respond(struct session *, char *, ...) - __attribute__ ((format (printf, 2, 3))); -void session_bufferevent_new(struct session *); - +void session_init(struct listener *, struct session *); +int session_cmp(struct session *, struct session *); +void session_pickup(struct session *, struct submit_status *); +void session_destroy(struct session *); +void session_respond(struct session *, char *, ...) + __attribute__ ((format (printf, 2, 3))); +void session_bufferevent_new(struct session *); SPLAY_PROTOTYPE(sessiontree, session, s_nodes, session_cmp); /* smtpd.c */ int child_cmp(struct child *, struct child *); +void imsg_event_add(struct imsgev *); +void imsg_compose_event(struct imsgev *, u_int16_t, u_int32_t, pid_t, + int, void *, u_int16_t); +void imsg_dispatch(int, short, void *); SPLAY_PROTOTYPE(childtree, child, entry, child_cmp); -void imsg_event_add(struct imsgev *); -void imsg_compose_event(struct imsgev *, u_int16_t, u_int32_t, pid_t, - int, void *, u_int16_t); -void imsg_dispatch(int, short, void *); /* ssl.c */ -void ssl_init(void); -void ssl_transaction(struct session *); - -void ssl_session_init(struct session *); -void ssl_session_destroy(struct session *); -int ssl_load_certfile(struct smtpd *, const char *, u_int8_t); -void ssl_setup(struct smtpd *, struct listener *); -int ssl_cmp(struct ssl *, struct ssl *); +void ssl_init(void); +void ssl_transaction(struct session *); +void ssl_session_init(struct session *); +void ssl_session_destroy(struct session *); +int ssl_load_certfile(struct smtpd *, const char *, u_int8_t); +void ssl_setup(struct smtpd *, struct listener *); +int ssl_cmp(struct ssl *, struct ssl *); SPLAY_PROTOTYPE(ssltree, ssl, ssl_nodes, ssl_cmp); @@ -1138,29 +1135,29 @@ struct arglist { u_int num; u_int nalloc; }; -void addargs(arglist *, char *, ...) - __attribute__((format(printf, 2, 3))); -int bsnprintf(char *, size_t, const char *, ...) - __attribute__ ((format (printf, 3, 4))); -int safe_fclose(FILE *); -int hostname_match(char *, char *); -int recipient_to_path(struct path *, char *); -int valid_localpart(char *); -int valid_domainpart(char *); -char *ss_to_text(struct sockaddr_storage *); -int valid_message_id(char *); -int valid_message_uid(char *); -char *time_to_text(time_t); -int secure_file(int, char *, struct passwd *, int); -void lowercase(char *, char *, size_t); -void message_set_errormsg(struct envelope *, char *, ...); -char *message_get_errormsg(struct envelope *); -void sa_set_port(struct sockaddr *, int); -struct path *path_dup(struct path *); -u_int64_t generate_uid(void); -void fdlimit(double); -int availdesc(void); -u_int32_t evpid_to_msgid(u_int64_t); -u_int64_t msgid_to_evpid(u_int32_t); -u_int32_t filename_to_msgid(char *); -u_int64_t filename_to_evpid(char *); +void addargs(arglist *, char *, ...) + __attribute__((format(printf, 2, 3))); +int bsnprintf(char *, size_t, const char *, ...) + __attribute__ ((format (printf, 3, 4))); +int safe_fclose(FILE *); +int hostname_match(char *, char *); +int recipient_to_path(struct path *, char *); +int valid_localpart(char *); +int valid_domainpart(char *); +char *ss_to_text(struct sockaddr_storage *); +int valid_message_id(char *); +int valid_message_uid(char *); +char *time_to_text(time_t); +int secure_file(int, char *, struct passwd *, int); +void lowercase(char *, char *, size_t); +void message_set_errormsg(struct envelope *, char *, ...); +char *message_get_errormsg(struct envelope *); +void sa_set_port(struct sockaddr *, int); +struct path *path_dup(struct path *); +u_int64_t generate_uid(void); +void fdlimit(double); +int availdesc(void); +u_int32_t evpid_to_msgid(u_int64_t); +u_int64_t msgid_to_evpid(u_int32_t); +u_int32_t filename_to_msgid(char *); +u_int64_t filename_to_evpid(char *); diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c index 34072fab662..34d84ea7104 100644 --- a/usr.sbin/smtpd/util.c +++ b/usr.sbin/smtpd/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.43 2011/04/17 11:39:23 gilles Exp $ */ +/* $OpenBSD: util.c,v 1.44 2011/04/17 13:36:07 gilles Exp $ */ /* * Copyright (c) 2000,2001 Markus Friedl. All rights reserved. @@ -50,12 +50,6 @@ const char *log_in6addr(const struct in6_addr *); const char *log_sockaddr(struct sockaddr *); -u_int32_t filename_to_msgid(char *); -u_int64_t filename_to_evpid(char *); - -u_int32_t evpid_to_msgid(u_int64_t); -u_int64_t msgid_to_evpid(u_int32_t); - int bsnprintf(char *str, size_t size, const char *format, ...) { |