commit 7ca08aebd245dc7116113bae97e31881fcc09eb0
parent d02116297883d2ff15d7ea58810e915a956a6928
Author: default <nobody@localhost>
Date: Sun, 14 Jan 2024 12:19:35 +0100
Fixed crashes in command-line options.
Diffstat:
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git 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
@@ -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
@@ -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)