summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/smtpd.h
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2012-10-14 11:58:24 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2012-10-14 11:58:24 +0000
commit9c4a800e568b41a715338f7828b289638231c1d3 (patch)
tree569f6977d85151c57cd0dfc2da7a5eda8f4f70b4 /usr.sbin/smtpd/smtpd.h
parent48f944375b479b7ec9d8d8ac55afc4889d18f95f (diff)
introduce map_file.c which will deprecate map_stdio.c
The idea is to have a file-backed map but to have smtpd(8) cache the maps so that it cannot be partially read if edited while mail is received. The file is read and converted to a static map (map_static.c), changes aren't visible to smtpd until an explicit: smtpctl update map which reads file, builds a new static map and invalidates the former. partial-read issue discussed with beck@ and halex@ idea to convert internally to a static map by eric@ diff ok eric@ and chl@
Diffstat (limited to 'usr.sbin/smtpd/smtpd.h')
-rw-r--r--usr.sbin/smtpd/smtpd.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h
index 0d13040caed..5e21f593d12 100644
--- a/usr.sbin/smtpd/smtpd.h
+++ b/usr.sbin/smtpd/smtpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.h,v 1.388 2012/10/12 08:51:02 eric Exp $ */
+/* $OpenBSD: smtpd.h,v 1.389 2012/10/14 11:58:23 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -126,10 +126,14 @@ enum imsg_type {
IMSG_CONF_RULE_SOURCE,
IMSG_CONF_FILTER,
IMSG_CONF_END,
+
+ IMSG_LKA_UPDATE_MAP,
+
IMSG_LKA_MAIL,
IMSG_LKA_RCPT,
IMSG_LKA_SECRET,
IMSG_LKA_RULEMATCH,
+
IMSG_MDA_SESS_NEW,
IMSG_MDA_DONE,
@@ -230,7 +234,7 @@ struct peer {
enum map_src {
S_NONE,
- S_PLAIN,
+ S_FILE,
S_DB /*,
S_LDAP*/
};
@@ -265,11 +269,13 @@ struct map {
enum map_src m_src;
char m_config[MAXPATHLEN];
TAILQ_HEAD(mapel_list, mapel) m_contents;
+ void *m_handle;
};
struct map_backend {
void *(*open)(struct map *);
+ void (*update)(struct map *);
void (*close)(void *);
void *(*lookup)(void *, const char *, enum map_kind);
int (*compare)(void *, const char *, enum map_kind,
@@ -972,13 +978,20 @@ void lka_session(struct submit_status *);
void lka_session_forward_reply(struct forward_req *, int);
/* map.c */
+void *map_open(struct map *);
+void map_update(struct map *);
+void map_close(struct map *, void *);
+
void *map_lookup(objid_t, const char *, enum map_kind);
int map_compare(objid_t, const char *, enum map_kind,
int (*)(const char *, const char *));
struct map *map_find(objid_t);
struct map *map_findbyname(const char *);
struct map *map_create(enum map_src, const char *);
+void map_destroy(struct map *);
void map_add(struct map *, const char *, const char *);
+void map_delete(struct map *, const char *);
+void map_delete_all(struct map *);
/* mda.c */