diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-01-29 18:39:42 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-01-29 18:39:42 +0000 |
commit | 4acd548e912089493d5eaaeeff58c398d943c5e8 (patch) | |
tree | 34166bcf921a228edf90c43d514d0e067e8a045e /src/libserver/cfg_rcl.c | |
parent | ebc0a487e134164469b34c87848836d601f54eaf (diff) | |
download | rspamd-4acd548e912089493d5eaaeeff58c398d943c5e8.tar.gz rspamd-4acd548e912089493d5eaaeeff58c398d943c5e8.zip |
Add support of encryption to the worker.
Diffstat (limited to 'src/libserver/cfg_rcl.c')
-rw-r--r-- | src/libserver/cfg_rcl.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c index b16c24846..959d22cd3 100644 --- a/src/libserver/cfg_rcl.c +++ b/src/libserver/cfg_rcl.c @@ -1793,22 +1793,37 @@ rspamd_rcl_parse_struct_keypair (struct rspamd_config *cfg, *target = key; return TRUE; } - + g_set_error (err, + CFG_RCL_ERROR, + EINVAL, + "invalid string with keypair content"); return FALSE; } } else if (obj->type == UCL_OBJECT) { elt = ucl_object_find_key (obj, "pubkey"); if (elt == NULL || !ucl_object_tostring_safe (elt, &pk)) { + g_set_error (err, + CFG_RCL_ERROR, + EINVAL, + "no sane pubkey found in the keypair"); return FALSE; } elt = ucl_object_find_key (obj, "privkey"); if (elt == NULL || !ucl_object_tostring_safe (elt, &sk)) { + g_set_error (err, + CFG_RCL_ERROR, + EINVAL, + "no sane privkey found in the keypair"); return FALSE; } } if (sk == NULL || pk == NULL) { + g_set_error (err, + CFG_RCL_ERROR, + EINVAL, + "no sane pubkey or privkey found in the keypair"); return FALSE; } @@ -1819,13 +1834,17 @@ rspamd_rcl_parse_struct_keypair (struct rspamd_config *cfg, rspamd_snprintf (keybuf, sizeof (keybuf), "%*s%s", sem - sk, sk, pk); } - key = rspamd_http_connection_make_key (keybuf, strlen (val)); + key = rspamd_http_connection_make_key (keybuf, strlen (keybuf)); if (key != NULL) { /* XXX: clean buffer after usage */ *target = key; return TRUE; } + g_set_error (err, + CFG_RCL_ERROR, + EINVAL, + "cannot load the keypair specified"); return FALSE; } |