static const struct setting_define auth_setting_defines[] = {
DEF(BOOLLIST, mechanisms),
- DEF(STR, realms),
+ DEF(BOOLLIST, realms),
DEF(STR, default_domain),
DEF(SIZE, cache_size),
DEF(TIME, cache_ttl),
};
static const struct auth_settings auth_default_settings = {
- .realms = "",
+ .realms = ARRAY_INIT,
.default_domain = "",
.cache_size = 0,
.cache_ttl = 60*60,
for (; *p != '\0' && p[1] != '\0'; p += 2)
set->username_translation_map[(int)(uint8_t)*p] = p[1];
}
- set->realms_arr =
- (const char *const *)p_strsplit_spaces(pool, set->realms, " ");
if (*set->policy_server_url != '\0') {
if (*set->policy_hash_nonce == '\0') {
struct auth_settings {
pool_t pool;
ARRAY_TYPE(const_string) mechanisms;
- const char *realms;
+ ARRAY_TYPE(const_string) realms;
const char *default_domain;
uoff_t cache_size;
unsigned int cache_ttl;
ARRAY(const struct auth_userdb_settings *) parsed_userdbs;
char username_chars_map[256];
char username_translation_map[256];
- const char *const *realms_arr;
const struct ip_addr *proxy_self_ips;
};
#include "str-sanitize.h"
#include "mech.h"
#include "passdb.h"
+#include "settings-parser.h"
/* Linear whitespace */
#define IS_LWS(c) ((c) == ' ' || (c) == '\t')
request->nonce = p_strdup(request->pool, buf.data);
str = t_str_new(256);
- if (*set->realms_arr == NULL) {
+ if (array_is_empty(&set->realms)) {
/* If no realms are given, at least Cyrus SASL client defaults
to destination host name */
str_append(str, "realm=\"\",");
} else {
- for (tmp = set->realms_arr; *tmp != NULL; tmp++)
+ for (tmp = settings_boollist_get(&set->realms); *tmp != NULL; tmp++)
str_printfa(str, "realm=\"%s\",", *tmp);
}