Differences From
Artifact [7d329a757a]:
319 319 $1::bigint,
320 320 (select handle from parsav_actors where id = $1::bigint),
321 321 'challenge-rsa', $2::bytea,
322 322 $3::bigint, $4::text
323 323 ) on conflict (name,kind,cred) do update set comment = $4::text returning aid
324 324 ]]
325 325 };
326 +
327 + auth_destroy_aid = {
328 + params = {uint64}, cmd = true, sql = [[
329 + delete from parsav_auth where aid = $1::bigint
330 + ]];
331 + };
332 +
333 + auth_destroy_aid_uid = {
334 + params = {uint64,uint64}, cmd = true, sql = [[
335 + delete from parsav_auth where aid = $1::bigint and uid = $2::bigint
336 + ]];
337 + };
326 338
327 339 auth_privs_clear = {
328 340 params = {uint64}, cmd = true, sql = [[
329 341 update parsav_auth set restrict = array[]::text[] where aid = $1::bigint
330 342 ]];
331 343 };
332 344
................................................................................
357 369 };
358 370
359 371 auth_enum_handle = {
360 372 params = {rawstring}, sql = [[
361 373 select aid, kind, comment, netmask, blacklist from parsav_auth where name = $1::text
362 374 ]];
363 375 };
376 +
377 + auth_fetch_aid = {
378 + params = {uint64}, sql = [[
379 + select aid, uid, kind, comment, netmask, blacklist from parsav_auth where aid = $1::bigint
380 + ]];
381 + };
364 382
365 383 post_save = {
366 384 params = {
367 385 uint64, uint32, int64;
368 386 rawstring, rawstring, rawstring;
369 387 }, cmd = true, sql = [[
370 388 update parsav_posts set
................................................................................
1636 1654 var react = r:_string(i,5)
1637 1655 lib.str.ncpy(n.reaction, react.ptr, lib.math.smallest(react.ct,[(`n.reaction).tree.type.N]))
1638 1656 end
1639 1657 end
1640 1658
1641 1659 return notes
1642 1660 end];
1661 +
1662 + auth_fetch_aid = [terra(
1663 + src: &lib.store.source,
1664 + aid: uint64
1665 + ): lib.mem.ptr(lib.store.auth)
1666 + var r = queries.auth_fetch_aid.exec(src,aid)
1667 + if r.sz == 0 then return [lib.mem.ptr(lib.store.auth)].null() end
1668 + var kind = r:_string(0, 2)
1669 + var comment = r:_string(0, 3)
1670 + var a = [ lib.str.encapsulate(lib.store.auth, {
1671 + kind = {`kind.ptr, `kind.ct+1};
1672 + comment = {`comment.ptr, `comment.ct+1};
1673 + }) ]
1674 + a.ptr.aid = r:int(uint64, 0, 0)
1675 + a.ptr.uid = r:int(uint64, 0, 1)
1676 + if r:null(0,3)
1677 + then a.ptr.netmask.pv = 0
1678 + else a.ptr.netmask = r:cidr(0, 4)
1679 + end
1680 + a.ptr.blacklist = r:bool(0, 5)
1681 + return a
1682 + end];
1643 1683
1644 1684 auth_enum_uid = [terra(
1645 1685 src: &lib.store.source,
1646 1686 uid: uint64
1647 - ): lib.mem.ptr(lib.mem.ptr(lib.store.auth))
1687 + ): lib.mem.lstptr(lib.store.auth)
1648 1688 var r = queries.auth_enum_uid.exec(src,uid)
1649 - if r.sz == 0 then return [lib.mem.ptr(lib.mem.ptr(lib.store.auth))].null() end
1689 + if r.sz == 0 then return [lib.mem.lstptr(lib.store.auth)].null() end
1650 1690 var ret = lib.mem.heapa([lib.mem.ptr(lib.store.auth)], r.sz)
1651 1691 for i=0, r.sz do
1652 1692 var kind = r:_string(i, 1)
1653 1693 var comment = r:_string(i, 2)
1654 1694 var a = [ lib.str.encapsulate(lib.store.auth, {
1655 1695 kind = {`kind.ptr, `kind.ct+1};
1656 1696 comment = {`comment.ptr, `comment.ct+1};
................................................................................
1724 1764 queries.auth_purge_type.exec(src, handle, uid, 'otp-%')
1725 1765 end];
1726 1766
1727 1767 auth_purge_trust = [terra(src: &lib.store.source, uid: uint64, handle: rawstring): {}
1728 1768 queries.auth_purge_type.exec(src, handle, uid, 'trust')
1729 1769 end];
1730 1770
1771 + auth_destroy_aid = [terra(
1772 + src: &lib.store.source,
1773 + aid: uint64
1774 + ): {} queries.auth_destroy_aid.exec(src,aid) end];
1775 +
1776 + auth_destroy_aid_uid = [terra(
1777 + src: &lib.store.source,
1778 + aid: uint64,
1779 + uid: uint64
1780 + ): {} queries.auth_destroy_aid_uid.exec(src,aid,uid) end];
1781 +
1731 1782 artifact_quicksearch = [terra(
1732 1783 src: &lib.store.source,
1733 1784 hash: binblob
1734 1785 ): {uint64, bool}
1735 1786 var srec = queries.artifact_quicksearch.exec(src, hash)
1736 1787 if srec.sz > 0 then
1737 1788 defer srec:free()