summaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorGravatar default2023-01-11 09:38:19 +0100
committerGravatar default2023-01-11 09:38:19 +0100
commit1aac24ca756be5305f0895f7ebfc12a989773975 (patch)
treec0a332a2ba2c8df2e307263dca5a73701d381504 /http.c
parentLog tweaks. (diff)
downloadsnac2-1aac24ca756be5305f0895f7ebfc12a989773975.tar.gz
snac2-1aac24ca756be5305f0895f7ebfc12a989773975.tar.xz
snac2-1aac24ca756be5305f0895f7ebfc12a989773975.zip
More keyId/signature tweaks.
Diffstat (limited to 'http.c')
-rw-r--r--http.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/http.c b/http.c
index 9600434..eab686e 100644
--- a/http.c
+++ b/http.c
@@ -103,7 +103,7 @@ d_char *http_signed_request(snac *snac, char *method, char *url,
103} 103}
104 104
105 105
106static int _check_signature(snac *snac, char *req, char *actor, char **err) 106static int _check_signature(snac *snac, char *req, char **err)
107/* check the signature */ 107/* check the signature */
108{ 108{
109 char *sig_hdr = xs_dict_get(req, "signature"); 109 char *sig_hdr = xs_dict_get(req, "signature");
@@ -144,18 +144,16 @@ static int _check_signature(snac *snac, char *req, char *actor, char **err)
144 return 0; 144 return 0;
145 } 145 }
146 146
147#if 0
148 /* strip the # from the keyId */ 147 /* strip the # from the keyId */
149 if ((p = strchr(keyId, '#')) != NULL) 148 if ((p = strchr(keyId, '#')) != NULL)
150 *p = '\0'; 149 *p = '\0';
151 150
152 /* the actor must already be here */
153 xs *actor = NULL; 151 xs *actor = NULL;
154 if (!valid_status(actor_get(snac, keyId, &actor))) { 152
153 if (!valid_status(actor_request(snac, keyId, &actor))) {
155 *err = xs_fmt("unknown actor %s", keyId); 154 *err = xs_fmt("unknown actor %s", keyId);
156 return 0; 155 return 0;
157 } 156 }
158#endif
159 157
160 if ((p = xs_dict_get(actor, "publicKey")) == NULL || 158 if ((p = xs_dict_get(actor, "publicKey")) == NULL ||
161 ((pubkey = xs_dict_get(p, "publicKeyPem")) == NULL)) { 159 ((pubkey = xs_dict_get(p, "publicKeyPem")) == NULL)) {
@@ -212,13 +210,13 @@ static int _check_signature(snac *snac, char *req, char *actor, char **err)
212} 210}
213 211
214 212
215int check_signature(snac *snac, char *req, char *actor) 213int check_signature(snac *snac, char *req)
216/* checks the signature and archives the error */ 214/* checks the signature and archives the error */
217{ 215{
218 int ret; 216 int ret;
219 xs *err = NULL; 217 xs *err = NULL;
220 218
221 if ((ret = _check_signature(snac, req, actor, &err)) == 0) { 219 if ((ret = _check_signature(snac, req, &err)) == 0) {
222 snac_debug(snac, 1, xs_fmt("check_signature %s", err)); 220 snac_debug(snac, 1, xs_fmt("check_signature %s", err));
223 221
224 xs *ntid = tid(0); 222 xs *ntid = tid(0);