summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2023-04-28 08:28:17 +0200
committerGravatar default2023-04-28 08:28:17 +0200
commitb620fe99fa99bb1658f43741b2d40ce88ff53963 (patch)
treefbbd8646043ebf4fb7123180e768d85383c0b656
parentUpdated RELEASE_NOTES. (diff)
downloadpenes-snac2-b620fe99fa99bb1658f43741b2d40ce88ff53963.tar.gz
penes-snac2-b620fe99fa99bb1658f43741b2d40ce88ff53963.tar.xz
penes-snac2-b620fe99fa99bb1658f43741b2d40ce88ff53963.zip
Ensure the new app client_id is unique.
-rw-r--r--mastoapi.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 41f56af..5e20742 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -1522,9 +1522,20 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
1522 if (name && ruri) { 1522 if (name && ruri) {
1523 xs *app = xs_dict_new(); 1523 xs *app = xs_dict_new();
1524 xs *id = xs_replace_i(tid(0), ".", ""); 1524 xs *id = xs_replace_i(tid(0), ".", "");
1525 xs *cid = random_str();
1526 xs *csec = random_str(); 1525 xs *csec = random_str();
1527 xs *vkey = random_str(); 1526 xs *vkey = random_str();
1527 xs *cid = NULL;
1528
1529 /* pick a non-existent random cid */
1530 for (;;) {
1531 cid = random_str();
1532 xs *p_app = app_get(cid);
1533
1534 if (p_app == NULL)
1535 break;
1536
1537 xs_free(cid);
1538 }
1528 1539
1529 app = xs_dict_append(app, "name", name); 1540 app = xs_dict_append(app, "name", name);
1530 app = xs_dict_append(app, "redirect_uri", ruri); 1541 app = xs_dict_append(app, "redirect_uri", ruri);