diff options
| author | 2023-06-11 20:10:23 +0200 | |
|---|---|---|
| committer | 2023-06-11 20:10:23 +0200 | |
| commit | cf2cfca62401da0b5c0604d4d4bcbe8c8356d6f2 (patch) | |
| tree | 078ff5013a394bb34c81a4256fa7a733b5e7c600 | |
| parent | Log malformed Likes from wafrn.net (who else?). (diff) | |
| download | snac2-cf2cfca62401da0b5c0604d4d4bcbe8c8356d6f2.tar.gz snac2-cf2cfca62401da0b5c0604d4d4bcbe8c8356d6f2.tar.xz snac2-cf2cfca62401da0b5c0604d4d4bcbe8c8356d6f2.zip | |
Also reject Like messages in is_msg_for_me().
| -rw-r--r-- | activitypub.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activitypub.c b/activitypub.c index 402d6a1..b253b22 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -383,12 +383,16 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg) | |||
| 383 | { | 383 | { |
| 384 | const char *type = xs_dict_get(c_msg, "type"); | 384 | const char *type = xs_dict_get(c_msg, "type"); |
| 385 | 385 | ||
| 386 | if (strcmp(type, "Announce") == 0) { | 386 | if (strcmp(type, "Like") == 0 || strcmp(type, "Announce") == 0) { |
| 387 | const char *object = xs_dict_get(c_msg, "object"); | 387 | const char *object = xs_dict_get(c_msg, "object"); |
| 388 | 388 | ||
| 389 | if (xs_type(object) == XSTYPE_DICT) | 389 | if (xs_type(object) == XSTYPE_DICT) |
| 390 | object = xs_dict_get(object, "id"); | 390 | object = xs_dict_get(object, "id"); |
| 391 | 391 | ||
| 392 | /* bad object id? reject */ | ||
| 393 | if (xs_type(object) != XSTYPE_STRING) | ||
| 394 | return 0; | ||
| 395 | |||
| 392 | /* if it's about one of our posts, accept it */ | 396 | /* if it's about one of our posts, accept it */ |
| 393 | if (xs_startswith(object, snac->actor)) | 397 | if (xs_startswith(object, snac->actor)) |
| 394 | return 2; | 398 | return 2; |