SSL/TLS is not yet negotiated.
--HG--
branch : HEAD
static enum auth_mech auth_mechs = 0;
static char *auth_mechs_capability = NULL;
-const char *client_authenticate_get_capabilities(void)
+const char *client_authenticate_get_capabilities(int tls)
{
string_t *str;
int i;
for (i = 0; i < AUTH_MECH_COUNT; i++) {
if ((auth_mechs & auth_mech_desc[i].mech) &&
- auth_mech_desc[i].name != NULL) {
+ auth_mech_desc[i].name != NULL &&
+ (tls || !auth_mech_desc[i].plaintext ||
+ !disable_plaintext_auth)) {
str_append_c(str, ' ');
str_append(str, "AUTH=");
str_append(str, auth_mech_desc[i].name);
#ifndef __CLIENT_AUTHENTICATE_H
#define __CLIENT_AUTHENTICATE_H
-const char *client_authenticate_get_capabilities(void);
+const char *client_authenticate_get_capabilities(int tls);
int cmd_login(struct imap_client *client, struct imap_arg *args);
int cmd_authenticate(struct imap_client *client, struct imap_arg *args);
static int cmd_capability(struct imap_client *client)
{
- const char *capability;
+ const char *capability, *auths;
+ auths = client_authenticate_get_capabilities(client->tls);
capability = t_strconcat("* CAPABILITY " CAPABILITY_STRING,
ssl_initialized ? " STARTTLS" : "",
disable_plaintext_auth && !client->tls ?
- " LOGINDISABLED" : "",
- client_authenticate_get_capabilities(),
- NULL);
+ " LOGINDISABLED" : "", auths, NULL);
client_send_line(client, capability);
client_send_tagline(client, "OK Capability completed.");
return TRUE;
str_append(str, "SASL");
for (i = 0; i < AUTH_MECH_COUNT; i++) {
if ((auth_mechs & auth_mech_desc[i].mech) &&
- auth_mech_desc[i].name != NULL) {
+ auth_mech_desc[i].name != NULL &&
+ (client->tls || !auth_mech_desc[i].plaintext ||
+ !disable_plaintext_auth)) {
str_append_c(str, ' ');
str_append(str, auth_mech_desc[i].name);
}