diff options
| -rw-r--r-- | activitypub.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/activitypub.c b/activitypub.c index d8f748e..33a260e 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -1826,6 +1826,25 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req) | |||
| 1826 | } | 1826 | } |
| 1827 | } | 1827 | } |
| 1828 | 1828 | ||
| 1829 | /* check the minimum acceptable account age */ | ||
| 1830 | int min_account_age = xs_number_get(xs_dict_get(srv_config, "min_account_age")); | ||
| 1831 | |||
| 1832 | if (min_account_age > 0) { | ||
| 1833 | char *actor_date = xs_dict_get(actor_o, "published"); | ||
| 1834 | if (!xs_is_null(actor_date)) { | ||
| 1835 | time_t actor_t = xs_parse_iso_date(actor_date, 0); | ||
| 1836 | int td = (int)(time(NULL) - actor_t); | ||
| 1837 | |||
| 1838 | snac_debug(snac, 2, xs_fmt("actor %s age: %d seconds", actor, td)); | ||
| 1839 | |||
| 1840 | if (td < min_account_age) { | ||
| 1841 | srv_log(xs_fmt("rejected activity from %s (too new, %d seconds)", actor, td)); | ||
| 1842 | |||
| 1843 | return 1; | ||
| 1844 | } | ||
| 1845 | } | ||
| 1846 | } | ||
| 1847 | |||
| 1829 | if (strcmp(type, "Follow") == 0) { /** **/ | 1848 | if (strcmp(type, "Follow") == 0) { /** **/ |
| 1830 | if (!follower_check(snac, actor)) { | 1849 | if (!follower_check(snac, actor)) { |
| 1831 | /* ensure the actor object is here */ | 1850 | /* ensure the actor object is here */ |