From: Simon Schubert <2@0x2c.org> Date: Thu, 22 Apr 2010 14:04:24 +0000 (+0200) Subject: drop the virtusertable support X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=34e5d98a7229b76d842b3b19fbc5575dfd6a6e3e;p=people%2Fms%2Fdma.git drop the virtusertable support A better way to set the envelope sender is to use either the -f argument or to set the EMAIL environment variable. --- diff --git a/Makefile.etc b/Makefile.etc index 7965caa..fca23b9 100644 --- a/Makefile.etc +++ b/Makefile.etc @@ -11,8 +11,5 @@ FILES+= auth.conf .if !exists(${DESTDIR}/etc/dma/dma.conf) FILES+= dma.conf .endif -.if !exists(${DESTDIR}/etc/dma/virtusertable) -FILES+= virtusertable -.endif .include diff --git a/conf.c b/conf.c index b676f9c..5d17745 100644 --- a/conf.c +++ b/conf.c @@ -84,59 +84,6 @@ chomp(char *str) 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 * @@ -250,8 +197,6 @@ parse_conf(const char *config_path) 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) @@ -260,8 +205,6 @@ parse_conf(const char *config_path) 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) diff --git a/dma.8 b/dma.8 index c8b4f18..1c0ab67 100644 --- a/dma.8 +++ b/dma.8 @@ -135,8 +135,6 @@ can be configured with three config files: auth.conf .It dma.conf -.It -virtusertable .El .Pp These three files are stored per default in @@ -192,22 +190,12 @@ Path to .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 @@ -260,15 +248,6 @@ The name of the file to read the .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 , diff --git a/dma.c b/dma.c index 1ddd980..1b82383 100644 --- a/dma.c +++ b/dma.c @@ -63,7 +63,6 @@ static void deliver(struct qitem *); 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; @@ -75,7 +74,6 @@ struct config config = { .port = 25, .aliases = "/var/mail/aliases", .spooldir = "/var/spool/dma", - .virtualpath = NULL, .authpath = NULL, .certfile = NULL, .features = 0, @@ -87,20 +85,8 @@ struct config config = { 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) @@ -487,12 +473,6 @@ skipopts: 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); diff --git a/dma.conf b/dma.conf index 8fdb9a1..3144de0 100644 --- a/dma.conf +++ b/dma.conf @@ -13,15 +13,9 @@ # 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 diff --git a/dma.h b/dma.h index ac70b12..a2ee868 100644 --- a/dma.h +++ b/dma.h @@ -56,7 +56,6 @@ #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 */ @@ -107,7 +106,6 @@ struct config { int port; const char *aliases; const char *spooldir; - const char *virtualpath; const char *authpath; const char *certfile; int features; @@ -119,13 +117,6 @@ struct config { }; -struct virtuser { - SLIST_ENTRY(virtuser) next; - char *login; - char *address; -}; -SLIST_HEAD(virtusers, virtuser); - struct authuser { SLIST_ENTRY(authuser) next; char *login; @@ -148,7 +139,6 @@ struct mx_hostentry { 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; @@ -162,7 +152,6 @@ extern FILE *yyin; /* conf.c */ void trim_line(char *); void parse_conf(const char *); -void parse_virtuser(const char *); void parse_authfile(const char *); /* crypto.c */ diff --git a/virtusertable b/virtusertable deleted file mode 100644 index 010c4f7..0000000 --- a/virtusertable +++ /dev/null @@ -1,6 +0,0 @@ -# $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