]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Print a help message about authentication at startup until the first successful authe...
authorTimo Sirainen <tss@iki.fi>
Sun, 19 Oct 2008 10:32:01 +0000 (13:32 +0300)
committerTimo Sirainen <tss@iki.fi>
Sun, 19 Oct 2008 10:32:01 +0000 (13:32 +0300)
--HG--
branch : HEAD

src/master/auth-process.c
src/master/common.h
src/master/main.c

index 5846b54ba73bf0206f6e4fa0e66ef6ff75982be1..597c425ef099ac5f879a099c390aa12c2e55eece 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <stdlib.h>
 #include <unistd.h>
+#include <fcntl.h>
 #include <pwd.h>
 #include <syslog.h>
 
@@ -125,6 +126,17 @@ auth_process_input_user(struct auth_process *process, const char *args)
                return FALSE;
        }
 
+       if (!auth_success_written) {
+               int fd;
+
+               fd = creat(AUTH_SUCCESS_PATH, 0666);
+               if (fd == -1)
+                       i_error("creat(%s) failed: %m", AUTH_SUCCESS_PATH);
+               else
+                       (void)close(fd);
+               auth_success_written = TRUE;
+       }
+
        auth_master_callback(list[1], list + 2, request);
        hash_remove(process->requests, POINTER_CAST(id));
        return TRUE;
index d654bf31c03496065280ad61dfdd578b15198d0f..fc25c0d57d3e25a6d51c7cecf1e22fc799dbe75f 100644 (file)
@@ -6,12 +6,15 @@ struct ip_addr;
 #include "lib.h"
 #include "master-settings.h"
 
+#define AUTH_SUCCESS_PATH PKG_STATEDIR"/auth-success"
+
 extern struct ioloop *ioloop;
 extern int null_fd, inetd_login_fd;
 extern uid_t master_uid;
 extern char program_path[];
 extern char ssl_manual_key_password[];
 extern const char *env_tz;
+extern bool auth_success_written;
 #ifdef DEBUG
 extern bool gdb;
 #endif
index 9f7557153d137b2744181bc2d503e335f6443508..aeff137315d626abaa6f215dc3c9428d3436ade8 100644 (file)
@@ -42,6 +42,7 @@ uid_t master_uid;
 char program_path[PATH_MAX];
 char ssl_manual_key_password[100];
 const char *env_tz;
+bool auth_success_written;
 #ifdef DEBUG
 bool gdb;
 #endif
@@ -99,6 +100,19 @@ static void fatal_log_check(void)
                i_error("unlink(%s) failed: %m", path);
 }
 
+static void auth_warning_print(void)
+{
+       struct stat st;
+
+       auth_success_written = stat(AUTH_SUCCESS_PATH, &st) == 0;
+       if (!auth_success_written) {
+               i_info("If you have trouble with authentication failures,\n"
+                      "enable auth_debug setting. "
+                      "See http://wiki.dovecot.org/WhyDoesItNotWork");
+
+       }
+}
+
 static void set_logfile(struct settings *set)
 {
        int facility;
@@ -559,6 +573,8 @@ int main(int argc, char *argv[])
                open_fds();
 
        fatal_log_check();
+       if (strcmp(settings_root->defaults->protocols, "none") != 0)
+               auth_warning_print();
        if (!foreground)
                daemonize(settings_root->defaults);