/* Copyright (c) 2009-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "str.h"
#include "settings-parser.h"
#include "config-parser-private.h"
#include "old-set-parser.h"
#include "istream.h"
#include "base64.h"
static bool seen_ssl_parameters_dat;
static const char *ssl_dh_parameters;
struct socket_set {
bool master;
};
struct old_set_parser {
const char *base_dir;
/* 1 when in auth {} section, >1 when inside auth { .. { .. } } */
unsigned int auth_section;
/* 1 when in socket listen {}, >1 when inside more of its sections */
unsigned int socket_listen_section;
bool seen_auth_section;
};
};
.service = "imap"
};
.service = "pop3"
};
.service = "sieve"
};
{
if (!seen_obsoletes) {
i_warning("NOTE: You can get a new clean config file with: "
"doveconf -n > dovecot-new.conf");
}
i_warning("Obsolete setting in %s:%u: %s",
}
{
}
{
unsigned short keysize;
unsigned int off=0;
/* try read it */
/* this is given because the ssl-parameters.dat file is no more there
and we don't want to to make go searching for the file
this code is only ever reached if ssl_dh_parameters is empty anyways
*/
/* check moved to correct place from here */
return TRUE;
} else if (is->stream_errno != 0) {
return FALSE;
}
/* then try to read the rest of the data */
while(i_stream_read(is) > 0) {
if (siz < 88) break;
if (keysize == 512) {
} else {
}
break;
}
if (siz > 4) {
/* need to wrap the string nicely */
{
}
if (!seen_ssl_parameters_dat) {
i_warning("You can generate it with: dd if=%s bs=1 skip=%u | openssl dhparam -inform der > %s", fn, off, SYSCONFDIR"/dh.pem");
}
/* check for empty ssl_dh elsewhere */
return TRUE;
} else {
*error_r = "ssl enabled, but ssl_dh not set";
return FALSE;
}
i_stream_unref(&is);
return TRUE;
}
/* FIXME: Remove ssl_protocols_to_min_protocol() in v2.4 */
const char **min_protocol_r,
const char **error_r)
{
static const char *protocol_versions[] = {
"SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2",
};
/* Array where -1 = disable, 0 = not found, 1 = enable */
const char *p = *tmp;
if (p[0] == '!') {
++p;
}
for (unsigned i = 0; i < N_ELEMENTS(protocol_versions); i++) {
if (strcmp(p, protocol_versions[i]) == 0) {
if (enable) {
protos[i] = 1;
} else {
protos[i] = -1;
}
goto found;
}
}
return -1;
found:;
}
for (unsigned i = 0; i < N_ELEMENTS(protocol_versions); i++) {
if (explicit_enable) {
if (protos[i] > 0)
} else if (protos[i] == 0)
}
*error_r = "All protocols disabled";
return -1;
}
return 0;
}
static bool
{
const char *p;
}
char **protos, **s;
if (strcmp(*s, "imap") == 0)
else if (strcmp(*s, "imaps") == 0) {
*s = "";
have_imaps = TRUE;
} else if (strcmp(*s, "pop3") == 0)
else if (strcmp(*s, "pop3s") == 0) {
*s = "";
have_pop3s = TRUE;
} else if (strcmp(*s, "managesieve") == 0) {
*s = "sieve";
}
}
/* ugly way to drop extra spaces.. */
if (have_imaps && !have_imap) {
obsolete(ctx, "'imaps' protocol can no longer be specified (use protocols=imap). to disable non-ssl imap, use service imap-login { inet_listener imap { port=0 } }");
"service/imap-login/inet_listener/imap/port=0", NULL);
} else if (have_imaps)
if (have_pop3s && !have_pop3) {
obsolete(ctx, "'pop3s' protocol can no longer be specified (use protocols=pop3). to disable non-ssl pop3, use service pop3-login { inet_listener pop3 { port=0 } }");
"service/pop3-login/inet_listener/pop3/port=0", NULL);
} else if (have_pop3s)
return TRUE;
}
if (*value == '\0')
return TRUE;
p, value);
return TRUE;
}
value = "no";
value = "yes";
return TRUE;
}
return TRUE;
}
i_error("Could not find a minimum ssl_min_protocol "
"setting from ssl_protocols = %s: %s",
return TRUE;
}
"ssl_min_protocol", min_protocol);
return TRUE;
}
else
return TRUE;
}
value = "never";
value = "optimized";
return TRUE;
}
return TRUE;
}
*arg = "";
*arg = "";
}
}
return TRUE;
}
return TRUE;
}
return TRUE;
}
return FALSE;
}
static void
struct config_section_stack *old_section,
{
}
}
/* if pigeonhole isn't installed, this fails.
just ignore it then.. */
}
}
static void
struct config_section_stack *old_section,
{
}
}
}
}
static void
{
}
{
const char *const *addrs;
return FALSE;
!is_ipv4_address(*addrs) &&
!is_ipv6_address(*addrs))
return TRUE;
}
return FALSE;
}
static bool
{
const char *p;
bool root;
if (*value == '\0') {
/* default */
return TRUE;
}
}
}
if (*ssl == '\0' &&
}
}
} else {
}
}
if (*ssl == '\0' &&
}
}
return TRUE;
}
value = "";
else
value = "login";
return TRUE;
}
return TRUE;
}
return TRUE;
}
return TRUE;
}
return TRUE;
}
return TRUE;
}
return TRUE;
}
return TRUE;
}
return TRUE;
}
return TRUE;
}
return TRUE;
}
return TRUE;
}
return TRUE;
}
}
return TRUE;
}
return TRUE;
}
return TRUE;
}
return TRUE;
}
"megabytes. Use %sM", value);
return TRUE;
}
else
return TRUE;
}
const char **p = NULL;
if (p != NULL) {
return TRUE;
}
}
return FALSE;
}
{
return FALSE;
}
"driver", value);
return TRUE;
}
obsolete(ctx, "socket connect {} is no longer supported, configure external auth server separately");
return FALSE;
}
return FALSE;
/* socket listen { .. } */
return TRUE;
}
return TRUE;
}
return FALSE;
}
{
bool master_suffix;
return;
}
return;
return;
}
}
}
}
}
enum config_line_type type,
{
switch (type) {
case CONFIG_LINE_TYPE_SKIP:
case CONFIG_LINE_TYPE_ERROR:
case CONFIG_LINE_TYPE_INCLUDE:
case CONFIG_LINE_TYPE_KEYFILE:
break;
bool ret;
if (ret)
return TRUE;
}
break;
obsolete(ctx, "add auth_ prefix to all settings inside auth {} and remove the auth {} section completely");
return TRUE;
"protocol", "sieve");
return TRUE;
}
break;
return TRUE;
}
return TRUE;
}
break;
}
return FALSE;
}
{
}