]> source.dussan.org Git - rspamd.git/commitdiff
Revert "[Fix] #3129 Multiple classifiers on redis working incorrectly" 3147/head
authorresec <resec0109@gmail.com>
Thu, 14 Nov 2019 08:04:24 +0000 (16:04 +0800)
committerresec <resec0109@gmail.com>
Thu, 14 Nov 2019 08:04:24 +0000 (16:04 +0800)
This reverts commit 14495547dea7e4a0c14cf1507ba7def74b58a4ce.

src/libstat/backends/redis_backend.c
src/libstat/learn_cache/redis_cache.c

index 70011a62843ff7274453b36d9088e08379461b68..08edf1a4f0f67cf0219f3d4734b24f301c941a9b 100644 (file)
@@ -1425,29 +1425,13 @@ rspamd_redis_parse_classifier_opts (struct redis_stat_ctx *backend,
 
        elt = ucl_object_lookup (obj, "prefix");
        if (elt == NULL || ucl_object_type (elt) != UCL_STRING) {
-               gchar *redis_object;
-
                /* Default non-users statistics */
                if (backend->enable_users || backend->cbref_user != -1) {
-                       redis_object = REDIS_DEFAULT_USERS_OBJECT;
+                       backend->redis_object = REDIS_DEFAULT_USERS_OBJECT;
                }
                else {
-                       redis_object = REDIS_DEFAULT_OBJECT;
-               }
-
-               /* Prepend classifier name if defined */
-               elt = ucl_object_lookup (obj, "name");
-               if (elt != NULL && ucl_object_type (elt) == UCL_STRING) {
-                       const gchar *cl_name = ucl_object_tostring (elt);
-                       gchar *temp;
-                       temp = g_malloc (strlen (cl_name) + strlen (redis_object) + 2);
-                       strcpy (temp, cl_name);
-                       strcat (temp, "_");
-                       strcat (temp, redis_object);
-                       redis_object = temp;
+                       backend->redis_object = REDIS_DEFAULT_OBJECT;
                }
-
-               backend->redis_object = redis_object;
        }
        else {
                /* XXX: sanity check */
index 320f422dda077122c8675103498bba54dfbf8c1f..0df3783abd4bcd3c434c2cd9d82d2284a227e0d1 100644 (file)
@@ -292,17 +292,7 @@ rspamd_stat_cache_redis_init (struct rspamd_stat_ctx *ctx,
                cache_ctx->redis_object = ucl_object_tostring (obj);
        }
        else {
-               gchar *cl_name = st->classifier->cfg->name;
-               if (cl_name) {
-                       gchar *redis_object;
-                       redis_object = g_malloc (strlen (cl_name) + strlen (DEFAULT_REDIS_KEY) + 2);
-                       strcpy (redis_object, cl_name);
-                       strcat (redis_object, "_");
-                       strcat (redis_object, DEFAULT_REDIS_KEY);
-                       cache_ctx->redis_object = redis_object;
-               } else {
-                       cache_ctx->redis_object = DEFAULT_REDIS_KEY;
-               }
+               cache_ctx->redis_object = DEFAULT_REDIS_KEY;
        }
 
        cache_ctx->conf_ref = conf_ref;