summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/smtpd.h
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2011-05-17 18:54:33 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2011-05-17 18:54:33 +0000
commit9ff5eb03c0801271c66e35a31b930bccfa701e39 (patch)
tree977d90c3d77da6b09e1756c09e06fb8448f4c06d /usr.sbin/smtpd/smtpd.h
parentd0de42170315935a0a78d8218e8d58287064ffb8 (diff)
introduce new user_backend API for smtpd to lookup the users it wants to
deliver mail to. the only backend supported for now is USER_GETPWNAM and it is not yet possible to switch to an alternate backend. yes this means that we're very close from smtpd being able to handle fully virtual accounts for both incoming and outgoing messages.
Diffstat (limited to 'usr.sbin/smtpd/smtpd.h')
-rw-r--r--usr.sbin/smtpd/smtpd.h32
1 files changed, 29 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h
index 187b56f16e0..eeca47252b0 100644
--- a/usr.sbin/smtpd/smtpd.h
+++ b/usr.sbin/smtpd/smtpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.h,v 1.223 2011/05/17 16:42:06 gilles Exp $ */
+/* $OpenBSD: smtpd.h,v 1.224 2011/05/17 18:54:32 gilles Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -914,7 +914,7 @@ struct queue_backend {
};
-/* queue structures */
+/* auth structures */
enum auth_type {
AUTH_INVALID=0,
AUTH_BSD,
@@ -927,6 +927,28 @@ struct auth_backend {
};
+/* user structures */
+enum user_type {
+ USER_INVALID=0,
+ USER_GETPWNAM,
+};
+
+#define MAXPASSWORDLEN 128
+struct user {
+ char username[MAXLOGNAME];
+ char directory[MAXPATHLEN];
+ char password[MAXPASSWORDLEN];
+ uid_t uid;
+ gid_t gid;
+};
+
+struct user_backend {
+ enum user_type type;
+ int (*getbyname)(struct user *, char *);
+ int (*getbyuid)(struct user *, uid_t);
+};
+
+
extern struct smtpd *env;
extern void (*imsg_callback)(struct imsgev *, struct imsg *);
@@ -1126,6 +1148,10 @@ int ssl_ctx_use_private_key(void *, char *, off_t);
int ssl_ctx_use_certificate_chain(void *, char *, off_t);
+/* user_backend.c */
+struct user_backend *user_backend_lookup(enum user_type);
+
+
/* util.c */
typedef struct arglist arglist;
struct arglist {
@@ -1146,7 +1172,7 @@ 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);
+int secure_file(int, char *, char *, uid_t, int);
void lowercase(char *, char *, size_t);
void envelope_set_errormsg(struct envelope *, char *, ...);
char *envelope_get_errormsg(struct envelope *);