diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 6db186c..3b83425 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -4,6 +4,8 @@ Fixed a collision in webfinger caching. This may affect federation with some software, so I recommend an upgrade. +Fixed crashes in some command-line options. + New command-line option `state`, that dumps some information about the running server and the state of each thread. Mastodon API: added some fixes for integration with the Mona iOS app (contributed by jamesoff). diff --git a/data.c b/data.c index 97cd94f..b71436e 100644 --- a/data.c +++ b/data.c @@ -1508,6 +1508,13 @@ int actor_get(const char *actor, xs_dict **data) return status; } + /* if the object is corrupted, discard it */ + if (xs_is_null(xs_dict_get(d, "id")) || xs_is_null(xs_dict_get(d, "type"))) { + srv_debug(1, xs_fmt("corrupted actor object %s", actor)); + d = xs_free(d); + return 404; + } + if (data) *data = d; else @@ -2169,7 +2176,7 @@ void enqueue_output_raw(const char *keyid, const char *seckey, qmsg = xs_dict_append(qmsg, "seckey", seckey); /* if it's to be sent right now, bypass the disk queue and post the job */ - if (retries == 0) + if (retries == 0 && p_state != NULL) job_post(qmsg, 0); else { qmsg = _enqueue_put(fn, qmsg); diff --git a/snac.h b/snac.h index 506257a..326b9f1 100644 --- a/snac.h +++ b/snac.h @@ -56,6 +56,8 @@ typedef struct { enum { THST_STOP, THST_WAIT, THST_IN, THST_QUEUE } th_state[MAX_THREADS]; } srv_state; +extern srv_state *p_state; + void snac_log(snac *user, xs_str *str); #define snac_debug(user, level, str) do { if (dbglevel >= (level)) \ { snac_log((user), (str)); } } while (0)