diff options
Diffstat (limited to 'http.c')
| -rw-r--r-- | http.c | 12 |
1 files changed, 5 insertions, 7 deletions
| @@ -103,7 +103,7 @@ d_char *http_signed_request(snac *snac, char *method, char *url, | |||
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | 105 | ||
| 106 | static int _check_signature(snac *snac, char *req, char *actor, char **err) | 106 | static 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 | ||
| 215 | int check_signature(snac *snac, char *req, char *actor) | 213 | int 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); |