add: uri.s = 0; uri.len = 0;
context: int radius_is_user_in(struct sip_msg* _m, char* _hf, char* _group){	str *grp, user_name, user, domain, uri;	dig_cred_t* cred = 0;	int hf_type;	UINT4 service;	VALUE_PAIR *send, *received;	static char msg[4096];	struct hdr_field* h;	struct sip_uri puri;	grp = (str*)_group; /* via fixup */	send = received = 0;	hf_type = (int)(long)_hf;	switch(hf_type) {	case 1: /* Request-URI */		if (get_request_uri(_m, &uri) < 0) {			LOG(L_ERR, "radius_is_user_in(): Error while extracting Request-URI\n");			return -1;		}		break;	case 2: /* To */		if (get_to_uri(_m, &uri) < 0) {			LOG(L_ERR, "radius_is_user_in(): Error while extracting To\n");			return -2;		}		break;	case 3: /* From */		if (get_from_uri(_m, &uri) < 0) {			LOG(L_ERR, "radius_is_user_in(): Error while extracting From\n");			return -3;		}		break;	case 4: /* Credentials */		get_authorized_cred(_m->authorization, &h);		if (!h) {			get_authorized_cred(_m->proxy_auth, &h);			if (!h) {				LOG(L_ERR, "radius_is_user_in(): No authorized credentials found (error in scripts)\n");				return -4;			}		}		cred = &((auth_body_t*)(h->parsed))->digest;		break;	}	if (hf_type != 4) {		if (parse_uri(uri.s, uri.len, &puri) < 0) {			LOG(L_ERR, "radius_is_user_in(): Error while parsing URI\n");			return -5;		}		user = puri.user;		domain = puri.host;	} else {		user = cred->username.user;		domain = *GET_REALM(cred);	}			if (use_domain) {		user_name.len = user.len + domain.len + 1;		user_name.s = (char*)pkg_malloc(user_name.len);		if (!user_name.s) {			LOG(L_ERR, "radius_is_user_in(): No memory left\n");			return -6;		}				memcpy(user_name.s, user.s, user.len);		user_name.s[user.len] = '@';		memcpy(user_name.s + user.len + 1, domain.s, domain.len);	} else {		user_name = user;	}	if (!rc_avpair_add(rh, &send, attrs[A_USER_NAME].v, user_name.s, user_name.len, 0)) {		LOG(L_ERR, "radius_is_user_in(): Error adding User-Name attribute\n");		rc_avpair_free(send);		if (use_domain) pkg_free(user_name.s);		return -7;	}	if (use_domain) pkg_free(user_name.s);	if (!rc_avpair_add(rh, &send, attrs[A_SIP_GROUP].v, grp->s, grp->len, 0)) {		LOG(L_ERR, "radius_is_user_in(): Error adding Sip-Group attribute\n");	 	return -8;  		}	service = vals[V_GROUP_CHECK].v;	if (!rc_avpair_add(rh, &send, attrs[A_SERVICE_TYPE].v, &service, -1, 0)) {		LOG(L_ERR, "radius_is_user_in(): Error adding Service-Type attribute\n");		rc_avpair_free(send);	 	return -9;  		}	if (rc_auth(rh, 0, send, &received, msg) == OK_RC) {		DBG("radius_is_user_in(): Success\n");		rc_avpair_free(send);		rc_avpair_free(received);		return 1;	} else {		DBG("radius_is_user_in(): Failure\n");		rc_avpair_free(send);		rc_avpair_free(received);		return -11;	}}