forked from mirrors/kore
small improvements
This commit is contained in:
parent
3e06668d3f
commit
313133f252
18
src/acme.c
18
src/acme.c
|
@ -241,8 +241,7 @@ kore_acme_run(void)
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
/* Drop all enabled seccomp filters, and add only ours. */
|
/* Drop all enabled seccomp filters, and add only ours. */
|
||||||
kore_seccomp_drop();
|
kore_seccomp_drop();
|
||||||
kore_seccomp_filter("acme", filter_acme,
|
kore_seccomp_filter("acme", filter_acme, KORE_FILTER_LEN(filter_acme));
|
||||||
KORE_FILTER_LEN(filter_acme));
|
|
||||||
#endif
|
#endif
|
||||||
#if defined(KORE_USE_PYTHON)
|
#if defined(KORE_USE_PYTHON)
|
||||||
kore_msg_unregister(KORE_PYTHON_SEND_OBJ);
|
kore_msg_unregister(KORE_PYTHON_SEND_OBJ);
|
||||||
|
@ -402,9 +401,6 @@ acme_nonce_fetch(void)
|
||||||
char *ret;
|
char *ret;
|
||||||
const char *nonce;
|
const char *nonce;
|
||||||
|
|
||||||
if (nonce_url == NULL)
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
ret = NULL;
|
ret = NULL;
|
||||||
acme_request_prepare(&req, HTTP_METHOD_HEAD, nonce_url, NULL, 0);
|
acme_request_prepare(&req, HTTP_METHOD_HEAD, nonce_url, NULL, 0);
|
||||||
|
|
||||||
|
@ -512,9 +508,6 @@ acme_order_create(struct kore_msg *msg, const void *data)
|
||||||
char *domain;
|
char *domain;
|
||||||
struct kore_json_item *json, *identifiers, *identifier;
|
struct kore_json_item *json, *identifiers, *identifier;
|
||||||
|
|
||||||
if (order_url == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
domain = kore_calloc(1, msg->length + 1);
|
domain = kore_calloc(1, msg->length + 1);
|
||||||
memcpy(domain, data, msg->length);
|
memcpy(domain, data, msg->length);
|
||||||
domain[msg->length] = '\0';
|
domain[msg->length] = '\0';
|
||||||
|
@ -574,7 +567,6 @@ acme_order_create_submit(struct acme_sign_op *op, struct kore_buf *payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
kore_curl_response_as_bytes(&req.curl, &body, &len);
|
kore_curl_response_as_bytes(&req.curl, &body, &len);
|
||||||
|
|
||||||
kore_json_init(&json, body, len);
|
kore_json_init(&json, body, len);
|
||||||
|
|
||||||
if (!kore_json_parse(&json)) {
|
if (!kore_json_parse(&json)) {
|
||||||
|
@ -1415,6 +1407,12 @@ acme_sign_submit(struct kore_json_item *json, const char *url, void *udata,
|
||||||
{
|
{
|
||||||
struct acme_sign_op *op;
|
struct acme_sign_op *op;
|
||||||
struct kore_buf buf;
|
struct kore_buf buf;
|
||||||
|
char *nonce;
|
||||||
|
|
||||||
|
if ((nonce = acme_nonce_fetch()) == NULL) {
|
||||||
|
kore_log(LOG_ERR, "failed to fetch nonce from servers");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
kore_buf_init(&buf, 1024);
|
kore_buf_init(&buf, 1024);
|
||||||
kore_json_item_tobuf(json, &buf);
|
kore_json_item_tobuf(json, &buf);
|
||||||
|
@ -1424,8 +1422,8 @@ acme_sign_submit(struct kore_json_item *json, const char *url, void *udata,
|
||||||
|
|
||||||
op->cb = cb;
|
op->cb = cb;
|
||||||
op->udata = udata;
|
op->udata = udata;
|
||||||
|
op->nonce = nonce;
|
||||||
op->id = signop_id++;
|
op->id = signop_id++;
|
||||||
op->nonce = acme_nonce_fetch();
|
|
||||||
op->payload = acme_base64url(buf.data, buf.offset);
|
op->payload = acme_base64url(buf.data, buf.offset);
|
||||||
op->protected = acme_protected_component(op->nonce, url);
|
op->protected = acme_protected_component(op->nonce, url);
|
||||||
op->t = kore_timer_add(acme_sign_expire, 5000, op, KORE_TIMER_ONESHOT);
|
op->t = kore_timer_add(acme_sign_expire, 5000, op, KORE_TIMER_ONESHOT);
|
||||||
|
|
Loading…
Reference in New Issue