* Check from AAA server if a user belongs to a group. User-Name is digest * username or digest username@realm, SIP-Group is group, and Service-Type * is Group-Check. SIP-Group is SER specific attribute and Group-Check is * SER specific service type value. */
| 239 | * SER specific service type value. |
| 240 | */ |
| 241 | int aaa_is_user_in(struct sip_msg* _m, void* _hf, str* grp) |
| 242 | { |
| 243 | str user_name, user, domain; |
| 244 | dig_cred_t* cred = 0; |
| 245 | int hf_type; |
| 246 | uint32_t service; |
| 247 | |
| 248 | aaa_message *send = NULL, *received = NULL; |
| 249 | |
| 250 | struct hdr_field* h; |
| 251 | struct sip_uri *turi; |
| 252 | |
| 253 | hf_type = (int)(long)_hf; |
| 254 | |
| 255 | turi = 0; |
| 256 | |
| 257 | switch(hf_type) { |
| 258 | case 1: /* Request-URI */ |
| 259 | if(parse_sip_msg_uri(_m)<0) { |
| 260 | LM_ERR("failed to get Request-URI\n"); |
| 261 | return -1; |
| 262 | } |
| 263 | turi = &_m->parsed_uri; |
| 264 | break; |
| 265 | |
| 266 | case 2: /* To */ |
| 267 | if((turi=parse_to_uri(_m))==NULL) { |
| 268 | LM_ERR("failed to get To URI\n"); |
| 269 | return -1; |
| 270 | } |
| 271 | break; |
| 272 | |
| 273 | case 3: /* From */ |
| 274 | if((turi=parse_from_uri(_m))==NULL) { |
| 275 | LM_ERR("failed to get From URI\n"); |
| 276 | return -1; |
| 277 | } |
| 278 | break; |
| 279 | |
| 280 | case 4: /* Credentials */ |
| 281 | get_authorized_cred(_m->authorization, &h); |
| 282 | if (!h) { |
| 283 | get_authorized_cred(_m->proxy_auth, &h); |
| 284 | if (!h) { |
| 285 | LM_ERR("no authorized" |
| 286 | " credentials found (error in scripts)\n"); |
| 287 | return -4; |
| 288 | } |
| 289 | } |
| 290 | cred = &((auth_body_t*)(h->parsed))->digest; |
| 291 | break; |
| 292 | } |
| 293 | |
| 294 | if (hf_type != 4 && turi){ |
| 295 | user = turi->user; |
| 296 | domain = turi->host; |
| 297 | } else { |
| 298 | user = cred->username.user; |
nothing calls this directly
no test coverage detected