summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--activitypub.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/activitypub.c b/activitypub.c
index 6453c60..329acb0 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -297,10 +297,16 @@ int is_msg_public(snac *snac, xs_dict *msg)
297int is_msg_for_me(snac *snac, xs_dict *c_msg) 297int is_msg_for_me(snac *snac, xs_dict *c_msg)
298/* checks if this message is for me */ 298/* checks if this message is for me */
299{ 299{
300 char *type = xs_dict_get(c_msg, "type"); 300 const char *type = xs_dict_get(c_msg, "type");
301
302 /* if it's an Announce by someone we don't follow, reject */
303 if (strcmp(type, "Announce") == 0) {
304 if (!following_check(snac, xs_dict_get(c_msg, "actor")))
305 return 0;
306 }
301 307
302 /* if it's not a Create, allow */ 308 /* if it's not a Create, allow */
303 if (xs_is_null(type) || strcmp(type, "Create") != 0) 309 if (strcmp(type, "Create") != 0)
304 return 1; 310 return 1;
305 311
306 xs_dict *msg = xs_dict_get(c_msg, "object"); 312 xs_dict *msg = xs_dict_get(c_msg, "object");
@@ -938,6 +944,11 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
938 int a_status; 944 int a_status;
939 int do_notify = 0; 945 int do_notify = 0;
940 946
947 if (xs_is_null(actor) || xs_is_null(type)) {
948 snac_debug(snac, 0, xs_fmt("malformed message"));
949 return 1;
950 }
951
941 char *object, *utype; 952 char *object, *utype;
942 953
943 object = xs_dict_get(msg, "object"); 954 object = xs_dict_get(msg, "object");