use_enable = FALSE;
const struct rspamd_controller_pbkdf *pbkdf = NULL;
+ /* Fail-safety */
+ session->is_read_only = TRUE;
+
/* Access list logic */
if (rspamd_inet_address_get_af (session->from_addr) == AF_UNIX) {
ret = rspamd_controller_check_forwarded (session, msg, ctx);
if (ret == 1) {
- session->is_enable = TRUE;
+ session->is_read_only = FALSE;
return TRUE;
}
else if (ret == 0) {
/* No forwarded found */
msg_info_session ("allow unauthorized connection from a unix socket");
- session->is_enable = TRUE;
+ session->is_read_only = FALSE;
return TRUE;
}
ret = rspamd_controller_check_forwarded (session, msg, ctx);
if (ret == 1) {
- session->is_enable = TRUE;
+ session->is_read_only = FALSE;
return TRUE;
}
/* No forwarded found */
msg_info_session ("allow unauthorized connection from a trusted IP %s",
rspamd_inet_address_to_string (session->from_addr));
- session->is_enable = TRUE;
+ session->is_read_only = FALSE;
return TRUE;
}
}
else if (is_enable && (ctx->password == NULL &&
ctx->enable_password == NULL)) {
- session->is_enable = TRUE;
+ session->is_read_only = FALSE;
return TRUE;
}
}
}
if (ret) {
- session->is_enable = TRUE;
+ session->is_read_only = FALSE;
}
}
else {
check, pbkdf, FALSE);
}
+ if (check_normal) {
+ if (ctx->enable_password == NULL) {
+ /* We have passed password check and no enable password is specified (*/
+ session->is_read_only = FALSE;
+ }
+ }
+
}
else {
check_normal = FALSE;
else {
check_enable = FALSE;
}
+
+ if (check_enable) {
+ /* We have passed enable password check, not a read-only mode */
+ session->is_read_only = FALSE;
+ }
}
}
st.messages_scanned), "scanned", 0, false);
ucl_object_insert_key (obj, ucl_object_fromint (
st.messages_learned), "learned", 0, false);
- ucl_object_insert_key (obj, ucl_object_frombool (!session->is_enable),
+ ucl_object_insert_key (obj, ucl_object_frombool (session->is_read_only),
"read_only", 0, false);
ucl_object_insert_key (obj, ucl_object_fromstring (session->ctx->cfg->checksum),
"config_id", 0, false);
uptime = ev_time () - session->ctx->start_time;
ucl_object_insert_key (top, ucl_object_fromint (
uptime), "uptime", 0, false);
- ucl_object_insert_key (top, ucl_object_frombool (!session->is_enable),
+ ucl_object_insert_key (top, ucl_object_frombool (session->is_read_only),
"read_only", 0, false);
ucl_object_insert_key (top, ucl_object_fromint (
stat->messages_scanned), "scanned", 0, false);
uptime), "uptime", 0, false);
ucl_object_insert_key (top, ucl_object_fromint (
session->ctx->start_time), "start_time", 0, false);
- ucl_object_insert_key (top, ucl_object_frombool (!session->is_enable),
+ ucl_object_insert_key (top, ucl_object_frombool (session->is_read_only),
"read_only", 0, false);
ucl_object_insert_key (top, ucl_object_fromint (
stat->messages_scanned), "scanned", 0, false);