]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dovecot-auth: Give a nice error message if you try to run it manually.
authorTimo Sirainen <tss@iki.fi>
Tue, 5 Aug 2008 00:34:35 +0000 (20:34 -0400)
committerTimo Sirainen <tss@iki.fi>
Tue, 5 Aug 2008 00:34:35 +0000 (20:34 -0400)
--HG--
branch : HEAD

src/auth/main.c

index 110f7288e51c25791007e6beed9b01b8766026f9..6ac13ebda9dfafd9a99f48a9c2c46d2358e5bff1 100644 (file)
@@ -188,6 +188,14 @@ static void drop_privileges(void)
                        "(if you don't care, set version_ignore=yes)", version);
        }
 
+       standalone = getenv("DOVECOT_MASTER") == NULL;
+       if (standalone && getenv("AUTH_1") == NULL) {
+               i_fatal("dovecot-auth is usually started through "
+                       "dovecot master process. If you wish to run "
+                       "it standalone, you'll need to set AUTH_* "
+                       "environment variables (AUTH_1 isn't set).");
+       }
+
        open_logfile();
 
        /* Open /dev/urandom before chrooting */
@@ -239,16 +247,8 @@ static void main_init(bool nodaemon)
                return;
        }
 
-       standalone = getenv("DOVECOT_MASTER") == NULL;
-       if (standalone) {
+       if (getenv("DOVECOT_MASTER") == NULL) {
                /* starting standalone */
-               if (getenv("AUTH_1") == NULL) {
-                       i_fatal("dovecot-auth is usually started through "
-                               "dovecot master process. If you wish to run "
-                               "it standalone, you'll need to set AUTH_* "
-                               "environment variables (AUTH_1 isn't set).");
-               }
-
                if (!nodaemon) {
                        switch (fork()) {
                        case -1: