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