* Mark credentials as selected so functions * following authorize know which credentials * to use if the message contained more than * one */
| 204 | * one |
| 205 | */ |
| 206 | int mark_authorized_cred(struct sip_msg* _m, struct hdr_field* _h) |
| 207 | { |
| 208 | struct hdr_field* f; |
| 209 | |
| 210 | switch(_h->type) { |
| 211 | case HDR_AUTHORIZATION_T: f = _m->authorization; break; |
| 212 | case HDR_PROXYAUTH_T: f = _m->proxy_auth; break; |
| 213 | default: |
| 214 | LM_ERR("invalid header field type\n"); |
| 215 | return -1; |
| 216 | } |
| 217 | |
| 218 | if (!(f->parsed)) { |
| 219 | if (new_credentials(f) < 0) { |
| 220 | LM_ERR("new_credentials failed\n"); |
| 221 | return -1; |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | ((auth_body_t*)(f->parsed))->authorized = _h; |
| 226 | |
| 227 | return 0; |
| 228 | } |
| 229 | |
| 230 | |
| 231 | /* |
no test coverage detected