]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Removed login_greeting_capability setting. Instead now a minimal pre-login
authorTimo Sirainen <tss@iki.fi>
Sat, 21 Jun 2008 07:39:45 +0000 (10:39 +0300)
committerTimo Sirainen <tss@iki.fi>
Sat, 21 Jun 2008 07:39:45 +0000 (10:39 +0300)
capability list is sent in the banner. CAPABILITY command still returns a
full list. If CAPABILITY command wasn't used, the full capability list is
sent in LOGIN/AUTHENTICATE tagged OK reply.

--HG--
branch : HEAD

configure.in
src/imap-login/client-authenticate.c
src/imap-login/client.c
src/imap-login/client.h
src/login-common/common.h
src/login-common/main.c
src/master/login-process.c
src/master/master-settings-defs.c
src/master/master-settings.c
src/master/master-settings.h

index 6fb14ba19456baef46965260f76a9b8622493a8e..6ca7146e97e980441376d3d7c2c0432903703904 100644 (file)
@@ -2185,8 +2185,10 @@ dnl **
 dnl ** capabilities
 dnl **
 
-capability="IMAP4rev1 SASL-IR SORT THREAD=REFERENCES MULTIAPPEND UNSELECT LITERAL+ IDLE CHILDREN NAMESPACE LOGIN-REFERRALS UIDPLUS LIST-EXTENDED I18NLEVEL=1 ENABLE CONDSTORE QRESYNC ESEARCH SEARCHRES WITHIN CONTEXT=SEARCH ID"
+capability_banner="IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID"
+capability="$capability_banner SORT THREAD=REFERENCES MULTIAPPEND UNSELECT IDLE CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 ENABLE CONDSTORE QRESYNC ESEARCH SEARCHRES WITHIN CONTEXT=SEARCH"
 AC_DEFINE_UNQUOTED(CAPABILITY_STRING, "$capability", IMAP capabilities)
+AC_DEFINE_UNQUOTED(CAPABILITY_BANNER_STRING, "$capability_banner", IMAP capabilities advertised in banner) 
 
 CFLAGS="$CFLAGS $EXTRA_CFLAGS"
 
index 461c2b59bd376aed0e229696731893a4ad2910dd..d308b5d4e7e42806ea270b73b9cc7d6d5beff26a 100644 (file)
@@ -208,7 +208,13 @@ static void sasl_callback(struct client *_client, enum sasl_server_reply reply,
                                break;
                }
 
-               client_send_tagline(client, "OK Logged in.");
+               if (client->full_capability_sent)
+                       client_send_tagline(client, "OK Logged in.");
+               else {
+                       client_send_tagline(client, t_strdup_printf(
+                               "OK [CAPABILITY %s] Logged in.",
+                               capability_string));
+               }
                client_destroy_success(client, "Login");
                break;
        case SASL_SERVER_REPLY_AUTH_FAILED:
index 6f9a7708568ac851fe628a5c6760fa7fedb114cc..d8952a9f10b65f02f124180c97853a03d7cfc139 100644 (file)
@@ -97,12 +97,12 @@ bool client_skip_line(struct imap_client *client)
        return FALSE;
 }
 
-static const char *get_capability(struct imap_client *client)
+static const char *get_capability(struct imap_client *client, bool full)
 {
        const char *auths;
 
        auths = client_authenticate_get_capabilities(client->common.secured);
-       return t_strconcat(capability_string,
+       return t_strconcat(full ? capability_string : CAPABILITY_BANNER_STRING,
                           (ssl_initialized && !client->common.tls) ?
                           " STARTTLS" : "",
                           disable_plaintext_auth && !client->common.secured ?
@@ -111,8 +111,9 @@ static const char *get_capability(struct imap_client *client)
 
 static int cmd_capability(struct imap_client *client)
 {
-       client_send_line(client, t_strconcat("* CAPABILITY ",
-                                            get_capability(client), NULL));
+       client->full_capability_sent = TRUE;
+       client_send_line(client, t_strconcat(
+               "* CAPABILITY ", get_capability(client, TRUE), NULL));
        client_send_tagline(client, "OK Capability completed.");
        return 1;
 }
@@ -461,10 +462,7 @@ static void client_send_greeting(struct imap_client *client)
 
        greet = t_str_new(128);
        str_append(greet, "* OK ");
-       if (greeting_capability) {
-               i_assert(auth_client_is_connected(auth_client));
-               str_printfa(greet, "[CAPABILITY %s] ", get_capability(client));
-       }
+       str_printfa(greet, "[CAPABILITY %s] ", get_capability(client, FALSE));
        str_append(greet, greeting);
 
        client_send_line(client, str_c(greet));
@@ -522,7 +520,7 @@ struct client *client_create(int fd, bool ssl, const struct ip_addr *local_ip,
 
        main_ref();
 
-       if (!greeting_capability || auth_client_is_connected(auth_client))
+       if (auth_client_is_connected(auth_client))
                client_send_greeting(client);
        else
                client_set_auth_waiting(client);
index fd36aab0ead2f21ed4435a62daad4fd0f19c80e1..c1c846f562f7a0349443454908fdb18820004a31 100644 (file)
@@ -32,6 +32,7 @@ struct imap_client {
        unsigned int destroyed:1;
        unsigned int greeting_sent:1;
        unsigned int id_logged:1;
+       unsigned int full_capability_sent:1;
 };
 
 void client_destroy(struct imap_client *client, const char *reason);
index 68158ecee68535f13e00dc11b3484328464fffa0..4956289dc58677f92bfad969a4744417d693df60 100644 (file)
@@ -13,7 +13,7 @@
 
 extern const char *login_protocol;
 
-extern bool disable_plaintext_auth, process_per_connection, greeting_capability;
+extern bool disable_plaintext_auth, process_per_connection;
 extern bool verbose_proctitle, verbose_ssl, verbose_auth;
 extern const char *greeting, *log_format;
 extern const char *const *log_format_elements;
index 282030e36966fa5bb58e525dd839d4659ab05e71..756e14ace2df3fd71ef75ab938ab679bff92b011 100644 (file)
@@ -19,7 +19,7 @@
 #include <unistd.h>
 #include <syslog.h>
 
-bool disable_plaintext_auth, process_per_connection, greeting_capability;
+bool disable_plaintext_auth, process_per_connection;
 bool verbose_proctitle, verbose_ssl, verbose_auth;
 const char *greeting, *log_format;
 const char *const *log_format_elements;
@@ -319,7 +319,6 @@ static void main_init(void)
        greeting = getenv("GREETING");
        if (greeting == NULL)
                greeting = PACKAGE" ready.";
-       greeting_capability = getenv("GREETING_CAPABILITY") != NULL;
 
        value = getenv("LOG_FORMAT_ELEMENTS");
        if (value == NULL)
index be254d9623a24c104377d7cb2c9e57e160f82f3e..a341d201ccdfcf2b55ef86dc84774699d87628ac 100644 (file)
@@ -573,8 +573,6 @@ static void login_process_init_env(struct login_group *group, pid_t pid)
        env_put(t_strconcat("LOG_FORMAT=", set->login_log_format, NULL));
        env_put(t_strconcat("IMAP_ID_SEND=", set->imap_id_send, NULL));
        env_put(t_strconcat("IMAP_ID_LOG=", set->imap_id_log, NULL));
-       if (set->login_greeting_capability)
-               env_put("GREETING_CAPABILITY=1");
 
        if (group->mail_process_type == PROCESS_TYPE_IMAP) {
                env_put(t_strconcat("CAPABILITY_STRING=",
index cc458ab860fba5b1efb2c96fffb45a7518799cce..1e5e3a4f49988584c69ab326a5134fb8f0ef6115 100644 (file)
@@ -45,7 +45,6 @@ static struct setting_def setting_defs[] = {
 
        DEF_BOOL(login_process_per_connection),
        DEF_BOOL(login_chroot),
-       DEF_BOOL(login_greeting_capability),
        DEF_STR(login_trusted_networks),
 
        DEF_INT(login_process_size),
index 46e695b4540da129e329645d2a4dfb39693ee4f3..83f1728abd4a8dec0fb51228d4e844b16531cc8f 100644 (file)
@@ -207,7 +207,6 @@ struct settings default_settings = {
 
        MEMBER(login_process_per_connection) TRUE,
        MEMBER(login_chroot) TRUE,
-       MEMBER(login_greeting_capability) FALSE,
        MEMBER(login_trusted_networks) "",
 
        MEMBER(login_process_size) 64,
index fb6d41ba859fe316b02bda4fb40c805d952d4611..8b4c339627ae0c37bf7c4874b6e0100942239d77 100644 (file)
@@ -59,7 +59,6 @@ struct settings {
 
        bool login_process_per_connection;
        bool login_chroot;
-       bool login_greeting_capability;
        const char *login_trusted_networks;
 
        unsigned int login_process_size;