]> git.ipfire.org Git - people/ms/dma.git/blobdiff - conf.c
deliver_remote: only require host when not using smarthost
[people/ms/dma.git] / conf.c
diff --git a/conf.c b/conf.c
index 6c7bd1c57eed3e0319a807d36c7f96e1cc307264..919ab7c4d77ebad6c9014ac5392301a2c5bcdd27 100644 (file)
--- a/conf.c
+++ b/conf.c
@@ -56,8 +56,6 @@ trim_line(char *line)
        size_t linelen;
        char *p;
 
-       p = line;
-
        if ((p = strchr(line, '\n')))
                *p = (char)0;
 
@@ -203,9 +201,23 @@ parse_conf(const char *config_path)
                        config.certfile = data;
                else if (strcmp(word, "MAILNAME") == 0 && data != NULL)
                        config.mailname = data;
-               else if (strcmp(word, "MAILNAMEFILE") == 0 && data != NULL)
-                       config.mailnamefile = data;
-               else if (strcmp(word, "STARTTLS") == 0 && data == NULL)
+               else if (strcmp(word, "MASQUERADE") == 0 && data != NULL) {
+                       char *user = NULL, *host = NULL;
+                       if (strrchr(data, '@')) {
+                               host = strrchr(data, '@');
+                               *host = 0;
+                               host++;
+                               user = data;
+                       } else {
+                               host = data;
+                       }
+                       if (host && *host == 0)
+                               host = NULL;
+                        if (user && *user == 0)
+                                user = NULL;
+                       config.masquerade_host = host;
+                       config.masquerade_user = user;
+               } else if (strcmp(word, "STARTTLS") == 0 && data == NULL)
                        config.features |= STARTTLS;
                else if (strcmp(word, "OPPORTUNISTIC_TLS") == 0 && data == NULL)
                        config.features |= TLS_OPP;
@@ -217,11 +229,18 @@ parse_conf(const char *config_path)
                        config.features |= INSECURE;
                else if (strcmp(word, "FULLBOUNCE") == 0 && data == NULL)
                        config.features |= FULLBOUNCE;
+               else if (strcmp(word, "NULLCLIENT") == 0 && data == NULL)
+                       config.features |= NULLCLIENT;
                else {
                        errlogx(1, "syntax error in %s:%d", config_path, lineno);
                        /* NOTREACHED */
                }
        }
 
+       if ((config.features & NULLCLIENT) && config.smarthost == NULL) {
+               errlogx(1, "%s: NULLCLIENT requires SMARTHOST", config_path);
+               /* NOTREACHED */
+       }
+
        fclose(conf);
 }