commit 5736f38

default  ·  2023-12-16 14:15:00 +0000 UTC
parent f703a34
Added more code to discard Delete messages earlier.
1 files changed,  +16, -0
+16, -0
 1@@ -1514,6 +1514,22 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
 2             srv_debug(1, xs_fmt("dropped 'Delete' message from unknown actor '%s'", actor));
 3             return -1;
 4         }
 5+
 6+        /* discard crap */
 7+        if (xs_is_null(object)) {
 8+            srv_log(xs_fmt("dropped 'Delete' message with invalid object from actor '%s'", actor));
 9+            return -1;
10+        }
11+
12+        /* also discard if the object to be deleted is not here */
13+        char *obj_id = object;
14+        if (xs_type(obj_id) == XSTYPE_DICT)
15+            obj_id = xs_dict_get(obj_id, "id");
16+
17+        if (object_here(obj_id)) {
18+            srv_debug(1, xs_fmt("dropped 'Delete' message from unknown object '%s'", obj_id));
19+            return -1;
20+        }
21     }
22 
23     /* bring the actor */