Fixed crashes in command-line options.

This commit is contained in:
default 2024-01-14 12:19:35 +01:00
parent d021162978
commit 7ca08aebd2
3 changed files with 12 additions and 1 deletions

View File

@ -4,6 +4,8 @@
Fixed a collision in webfinger caching. This may affect federation with some software, so I recommend an upgrade. 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. 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). Mastodon API: added some fixes for integration with the Mona iOS app (contributed by jamesoff).

9
data.c
View File

@ -1508,6 +1508,13 @@ int actor_get(const char *actor, xs_dict **data)
return status; 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) if (data)
*data = d; *data = d;
else else
@ -2169,7 +2176,7 @@ void enqueue_output_raw(const char *keyid, const char *seckey,
qmsg = xs_dict_append(qmsg, "seckey", 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 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); job_post(qmsg, 0);
else { else {
qmsg = _enqueue_put(fn, qmsg); qmsg = _enqueue_put(fn, qmsg);

2
snac.h
View File

@ -56,6 +56,8 @@ typedef struct {
enum { THST_STOP, THST_WAIT, THST_IN, THST_QUEUE } th_state[MAX_THREADS]; enum { THST_STOP, THST_WAIT, THST_IN, THST_QUEUE } th_state[MAX_THREADS];
} srv_state; } srv_state;
extern srv_state *p_state;
void snac_log(snac *user, xs_str *str); void snac_log(snac *user, xs_str *str);
#define snac_debug(user, level, str) do { if (dbglevel >= (level)) \ #define snac_debug(user, level, str) do { if (dbglevel >= (level)) \
{ snac_log((user), (str)); } } while (0) { snac_log((user), (str)); } } while (0)