diff options
| -rw-r--r-- | activitypub.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/activitypub.c b/activitypub.c index 33a260e..3e306a6 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -1833,16 +1833,29 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req) | |||
| 1833 | char *actor_date = xs_dict_get(actor_o, "published"); | 1833 | char *actor_date = xs_dict_get(actor_o, "published"); |
| 1834 | if (!xs_is_null(actor_date)) { | 1834 | if (!xs_is_null(actor_date)) { |
| 1835 | time_t actor_t = xs_parse_iso_date(actor_date, 0); | 1835 | time_t actor_t = xs_parse_iso_date(actor_date, 0); |
| 1836 | int td = (int)(time(NULL) - actor_t); | ||
| 1837 | 1836 | ||
| 1838 | snac_debug(snac, 2, xs_fmt("actor %s age: %d seconds", actor, td)); | 1837 | if (actor_t < 950000000) { |
| 1839 | 1838 | snac_log(snac, xs_fmt("rejected activity from %s (suspicious date, %s)", | |
| 1840 | if (td < min_account_age) { | 1839 | actor, actor_date)); |
| 1841 | srv_log(xs_fmt("rejected activity from %s (too new, %d seconds)", actor, td)); | ||
| 1842 | 1840 | ||
| 1843 | return 1; | 1841 | return 1; |
| 1844 | } | 1842 | } |
| 1843 | |||
| 1844 | if (actor_t > 0) { | ||
| 1845 | int td = (int)(time(NULL) - actor_t); | ||
| 1846 | |||
| 1847 | snac_debug(snac, 2, xs_fmt("actor %s age: %d seconds", actor, td)); | ||
| 1848 | |||
| 1849 | if (td < min_account_age) { | ||
| 1850 | snac_log(snac, xs_fmt("rejected activity from %s (too new, %d seconds)", | ||
| 1851 | actor, td)); | ||
| 1852 | |||
| 1853 | return 1; | ||
| 1854 | } | ||
| 1855 | } | ||
| 1845 | } | 1856 | } |
| 1857 | else | ||
| 1858 | snac_log(snac, xs_fmt("warning: empty or null creation date for %s", actor)); | ||
| 1846 | } | 1859 | } |
| 1847 | 1860 | ||
| 1848 | if (strcmp(type, "Follow") == 0) { /** **/ | 1861 | if (strcmp(type, "Follow") == 0) { /** **/ |