diff options
| author | rako <m@rako.space> | 2025-11-28 10:37:49 +0100 |
|---|---|---|
| committer | rako <m@rako.space> | 2025-11-30 21:19:13 +0100 |
| commit | a45c1ce152011e8fe25eb1d25594ac5705f65404 (patch) | |
| tree | 93c9f3f9dc187fe7aa38e882879f72353b273925 /data.c | |
| parent | 46bb87c2b54c9b9d9a4cd462b47158ede1eec170 (diff) | |
Fix user matching
In order to be a proper prefix, the actor url must end with a '/'
otherwise it can match another user that starts with the same prefix:
for example 'testuser' will match anything made by 'testuser2'
Diffstat (limited to 'data.c')
| -rw-r--r-- | data.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1467,7 +1467,7 @@ void timeline_update_indexes(snac *snac, const char *id) { object_user_cache_add(snac, id, "private"); - if (xs_startswith(id, snac->actor)) { + if (is_msg_mine(snac, id)) { xs *msg = NULL; if (valid_status(object_get(id, &msg))) { @@ -1927,7 +1927,7 @@ int pin(snac *user, const char *id) { int ret = -2; - if (xs_startswith(id, user->actor)) { + if (is_msg_mine(user, id)) { if (is_pinned(user, id)) ret = -3; else @@ -3527,7 +3527,7 @@ void enqueue_output(snac *snac, const xs_dict *msg, const xs_str *inbox, int retries, int p_status) /* enqueues an output message to an inbox */ { - if (xs_startswith(inbox, snac->actor)) { + if (is_msg_mine(snac, inbox)) { snac_debug(snac, 1, xs_str_new("refusing enqueue to myself")); return; } @@ -4055,7 +4055,7 @@ void delete_purged_posts(snac *user, int days) if (xs_is_dict(msg)) { const char *id = xs_dict_get(msg, "id"); - if (xs_is_string(id) && xs_startswith(id, user->actor)) { + if (xs_is_string(id) && is_msg_mine(user, id)) { xs *d_msg = msg_delete(user, id); enqueue_message(user, d_msg); |