Use the sqlite authorizer for async requests, too.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4401 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-08-16 22:43:08 +00:00
parent 61d2ef5469
commit f7d201859a
3 changed files with 6 additions and 2 deletions

View File

@ -927,7 +927,7 @@ static JSValue _tf_ssb_sqlite_row_to_json(JSContext* context, sqlite3_stmt* row)
return result;
}
static int _tf_ssb_sqlite_authorizer(void* user_data, int action_code, const char* arg0, const char* arg1, const char* arg2, const char* arg3)
int tf_ssb_sqlite_authorizer(void* user_data, int action_code, const char* arg0, const char* arg1, const char* arg2, const char* arg3)
{
int result = SQLITE_DENY;
switch (action_code)
@ -973,7 +973,7 @@ JSValue tf_ssb_db_visit_query(tf_ssb_t* ssb, const char* query, const JSValue bi
sqlite3* db = tf_ssb_acquire_db_reader(ssb);
JSContext* context = tf_ssb_get_context(ssb);
sqlite3_stmt* statement;
sqlite3_set_authorizer(db, _tf_ssb_sqlite_authorizer, ssb);
sqlite3_set_authorizer(db, tf_ssb_sqlite_authorizer, ssb);
if (sqlite3_prepare(db, query, -1, &statement, NULL) == SQLITE_OK)
{
JSValue bind_result = _tf_ssb_sqlite_bind_json(context, db, statement, binds);