.if !exists(${DESTDIR}/etc/dma/dma.conf)
FILES+= dma.conf
.endif
-.if !exists(${DESTDIR}/etc/dma/virtusertable)
-FILES+= virtusertable
-.endif
.include <bsd.prog.mk>
str[len - 1] = 0;
}
-/*
- * Read the virtual user table
- */
-void
-parse_virtuser(const char *path)
-{
- char line[2048];
- FILE *v;
- char *data;
- struct virtuser *vu;
- int lineno = 0;
-
- v = fopen(path, "r");
- if (v == NULL) {
- errlog(1, "can not open virtuser file `%s'", path);
- /* NOTREACHED */
- }
-
- while (!feof(v)) {
- if (fgets(line, sizeof(line), v) == NULL)
- break;
- lineno++;
-
- chomp(line);
-
- /* We hit a comment */
- if (*line == '#')
- continue;
- /* Ignore empty lines */
- if (*line == 0)
- continue;
-
- vu = calloc(1, sizeof(*vu));
- if (vu == NULL)
- errlog(1, NULL);
-
- data = strdup(line);
- vu->login = strsep(&data, DP);
- vu->address = data;
-
- if (vu->login == NULL ||
- vu->address == NULL) {
- errlogx(1, "syntax error in virtuser file %s:%d",
- path, lineno);
- /* NOTREACHED */
- }
-
- SLIST_INSERT_HEAD(&virtusers, vu, next);
- }
-
- fclose(v);
-}
-
/*
* Read the SMTP authentication config file
*
config.aliases = data;
else if (strcmp(word, "SPOOLDIR") == 0 && data != NULL)
config.spooldir = data;
- else if (strcmp(word, "VIRTPATH") == 0 && data != NULL)
- config.virtualpath = data;
else if (strcmp(word, "AUTHPATH") == 0 && data != NULL)
config.authpath= data;
else if (strcmp(word, "CERTFILE") == 0 && data != NULL)
config.mailname = data;
else if (strcmp(word, "MAILNAMEFILE") == 0 && data != NULL)
config.mailnamefile = data;
- else if (strcmp(word, "VIRTUAL") == 0 && data == NULL)
- config.features |= VIRTUAL;
else if (strcmp(word, "STARTTLS") == 0 && data == NULL)
config.features |= STARTTLS;
else if (strcmp(word, "SECURETRANSFER") == 0 && data == NULL)
auth.conf
.It
dma.conf
-.It
-virtusertable
.El
.Pp
These three files are stored per default in
.Nm Ap s
spool directory.
Just stick with the default.
-.It Ic VIRTPATH Xo
-(string, default=/etc/dma/virtusertable)
-.Xc
-Path to the
-.Sq virtusertable
-file.
.It Ic AUTHPATH Xo
(string, default=/etc/dma/auth.conf)
.Xc
Path to the
.Sq auth.conf
file.
-.It Ic VIRTUAL Xo
-(boolean, default=commented)
-.Xc
-Comment if you want virtual user support.
.It Ic SECURETRANS Xo
(boolean, default=commented)
.Xc
.Sq MAILNAME
from.
.El
-.Ss virtusertable
-The
-.Pa virtusertable
-file specifies a virtual user table.
-Each line has the format
-.Dq Li localuser:mail-address .
-Some smarthosts do not accept mails from unresolvable email address
-(e.g.\& user@localhost) so you have to rewrite your outgoing email
-address to a valid address.
.Sh SEE ALSO
.Xr mailaddr 7 ,
.Xr mailwrapper 8 ,
struct aliases aliases = LIST_HEAD_INITIALIZER(aliases);
struct strlist tmpfs = SLIST_HEAD_INITIALIZER(tmpfs);
-struct virtusers virtusers = LIST_HEAD_INITIALIZER(virtusers);
struct authusers authusers = LIST_HEAD_INITIALIZER(authusers);
const char *username;
const char *logident_base;
.port = 25,
.aliases = "/var/mail/aliases",
.spooldir = "/var/spool/dma",
- .virtualpath = NULL,
.authpath = NULL,
.certfile = NULL,
.features = 0,
static char *
set_from(struct queue *queue, const char *osender)
{
- struct virtuser *v;
char *sender;
- if ((config.features & VIRTUAL) != 0) {
- SLIST_FOREACH(v, &virtusers, next) {
- if (strcmp(v->login, username) == 0) {
- sender = strdup(v->address);
- if (sender == NULL)
- return(NULL);
- goto out;
- }
- }
- }
-
if (osender) {
sender = strdup(osender);
if (sender == NULL)
parse_conf(CONF_PATH);
- if (config.features & VIRTUAL) {
- if (config.virtualpath == NULL)
- errlogx(1, "no virtuser file specified, but VIRTUAL configured");
- parse_virtuser(config.virtualpath);
- }
-
if (config.authpath != NULL)
parse_authfile(config.authpath);
# Path to your spooldir. Just stay with the default.
#SPOOLDIR /var/spool/dma
-# Path to your virtual user file. Just stay with the default.
-#VIRTPATH /etc/dma/virtusertable
-
# SMTP authentication
#AUTHPATH /etc/dma/auth.conf
-# Uncomment if you want address rewriting
-#VIRTUAL
-
# Uncomment if yout want TLS/SSL support
#SECURETRANSFER
#define SMTP_PORT 25 /* Default SMTP port */
#define CON_TIMEOUT 120 /* Connection timeout */
-#define VIRTUAL 0x001 /* Support for address rewrites */
#define STARTTLS 0x002 /* StartTLS support */
#define SECURETRANS 0x004 /* SSL/TLS in general */
#define NOSSL 0x008 /* Do not use SSL */
int port;
const char *aliases;
const char *spooldir;
- const char *virtualpath;
const char *authpath;
const char *certfile;
int features;
};
-struct virtuser {
- SLIST_ENTRY(virtuser) next;
- char *login;
- char *address;
-};
-SLIST_HEAD(virtusers, virtuser);
-
struct authuser {
SLIST_ENTRY(authuser) next;
char *login;
extern struct aliases aliases;
extern struct config config;
extern struct strlist tmpfs;
-extern struct virtusers virtusers;
extern struct authusers authusers;
extern const char *username;
extern const char *logident_base;
/* conf.c */
void trim_line(char *);
void parse_conf(const char *);
-void parse_virtuser(const char *);
void parse_authfile(const char *);
/* crypto.c */
+++ /dev/null
-# $DragonFly: src/etc/dma/virtusertable,v 1.1 2008/02/02 18:24:00 matthias Exp $
-#
-# Virtual user table for address rewriting. If you want to use this file
-# don't forget to uncomment VIRTUAL option in dma.conf.
-#
-# Format: localuser:my-real@email-address.example.com