aboutsummaryrefslogtreecommitdiffstats
path: root/src/rspamadm/fuzzy_convert.c
diff options
context:
space:
mode:
authorlaodc <github@laodc.com>2023-08-21 15:45:58 +0700
committerlaodc <github@laodc.com>2023-08-21 15:45:58 +0700
commit75fdc829bacbdc767b20d3f0e40b91215fce14fe (patch)
tree209d8d53e71cd5a92deb69fcb740bb2649bb66ee /src/rspamadm/fuzzy_convert.c
parent1931487b17059d6c63adf2245c9632384657f89e (diff)
downloadrspamd-75fdc829bacbdc767b20d3f0e40b91215fce14fe.tar.gz
rspamd-75fdc829bacbdc767b20d3f0e40b91215fce14fe.zip
Added support for Redis 6 ACL (username/password)
Diffstat (limited to 'src/rspamadm/fuzzy_convert.c')
-rw-r--r--src/rspamadm/fuzzy_convert.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/rspamadm/fuzzy_convert.c b/src/rspamadm/fuzzy_convert.c
index 1b2866b59..5d967a64c 100644
--- a/src/rspamadm/fuzzy_convert.c
+++ b/src/rspamadm/fuzzy_convert.c
@@ -21,6 +21,7 @@
static gchar *source_db = NULL;
static gchar *redis_host = NULL;
static gchar *redis_db = NULL;
+static gchar *redis_username = NULL;
static gchar *redis_password = NULL;
static int64_t fuzzy_expiry = 0;
@@ -46,6 +47,8 @@ static GOptionEntry entries[] = {
"Output redis ip (in format ip:port)", NULL},
{"dbname", 'D', 0, G_OPTION_ARG_STRING, &redis_db,
"Database in redis (should be numeric)", NULL},
+ {"username", 'u', 0, G_OPTION_ARG_STRING, &redis_username,
+ "Username to connect to redis", NULL},
{"password", 'p', 0, G_OPTION_ARG_STRING, &redis_password,
"Password to connect to redis", NULL},
{NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL}};
@@ -63,6 +66,7 @@ rspamadm_fuzzyconvert_help(gboolean full_help, const struct rspamadm_command *cm
"-d: input sqlite\n"
"-h: output redis ip (in format ip:port)\n"
"-D: output redis database\n"
+ "-u: redis username\n";
"-p: redis password\n";
}
else {
@@ -117,6 +121,10 @@ rspamadm_fuzzyconvert(gint argc, gchar **argv, const struct rspamadm_command *cm
ucl_object_insert_key(obj, ucl_object_fromint(fuzzy_expiry),
"expiry", 0, false);
+ if (redis_username) {
+ ucl_object_insert_key(obj, ucl_object_fromstring(redis_username),
+ "redis_username", 0, false);
+ }
if (redis_password) {
ucl_object_insert_key(obj, ucl_object_fromstring(redis_password),
"redis_password", 0, false);