35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
end
end
credmgr.credlist = cl:finalize()
end
credmgr:append(&a)
--if credmgr.credlist.ct > 0 then credmgr.credlist:free() end
else
if new:cmp('pw') then
var d: data.view.conf_sec_pwnew
var time = lib.osclock.time(nil)
var timestr: int8[26] lib.osclock.ctime_r(&time, ×tr[0])
var cmt = co:stra(48)
cmt:lpush('enrolled over http on '):push(×tr[0],0)
d.comment = cmt:finalize()
var st = d:poolstr(&co.srv.pool)
--d.comment:free()
return st
elseif new:cmp('challenge') then
-- we're going to break the rules a bit and do database munging from
-- the rendering code, because doing otherwise in this case would be
-- genuinely nightmarish
elseif new:cmp('otp') then
elseif new:cmp('api') then
else return pstr.null() end
end
|
<
<
|
|
|
|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
|
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
end
end
credmgr.credlist = cl:finalize()
end
credmgr:append(&a)
--if credmgr.credlist.ct > 0 then credmgr.credlist:free() end
else
var time = lib.osclock.time(nil)
var timestr: int8[26] lib.osclock.ctime_r(&time, ×tr[0])
var cmt = co:stra(48)
cmt:lpush('enrolled over http on '):push(×tr[0],0)
if new:cmp('pw') then
var d: data.view.conf_sec_pwnew
d.comment = cmt:finalize()
var st = d:poolstr(&co.srv.pool)
--d.comment:free()
return st
elseif new:cmp('rsa') then
var c = co:stra(64)
lib.crypt.cryptogram(&c, 8)
var cptr = c:finalize();
var hmac = lib.crypt.hmacp(&co.srv.pool, lib.crypt.alg.sha256, co.srv.cfg.secret:blob(), cptr); -- TODO should expire after 10min
var hmacte: int8[lib.math.shorthand.maxlen]
var hmacte_len = lib.math.shorthand.gen(lib.math.truncate64(hmac.ptr, hmac.ct), &hmacte[0])
var d = data.view.conf_sec_keynew {
comment = cmt:finalize();
nonce = cptr;
noncevld = pstr { ptr = &hmacte[0], ct = hmacte_len };
}
return d:poolstr(&co.srv.pool)
-- we're going to break the rules a bit and do database munging from
-- the rendering code, because doing otherwise in this case would be
-- genuinely nightmarish
elseif new:cmp('otp') then
elseif new:cmp('api') then
else return pstr.null() end
end
|