char *sql;
switch_xml_t domain, xml = NULL, user, param, xparams;
char hexdigest[2 * SU_MD5_DIGEST_SIZE + 1] = "";
-
+ char *pbuf = NULL;
username = realm = nonce = uri = qop = cnonce = nc = response = NULL;
if (authorization->au_params) {
free(sql);
}
- if (switch_xml_locate_user(username, realm, ip, &xml, &domain, &user, profile->name) != SWITCH_STATUS_SUCCESS) {
+ pbuf = switch_mprintf("profile=%s", profile->name);
+
+ if (switch_xml_locate_user(username, realm, ip, &xml, &domain, &user, pbuf) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", username, realm);
ret = AUTH_FORBIDDEN;
goto end;
if (xml) {
switch_xml_free(xml);
}
+ switch_safe_free(pbuf);
switch_safe_free(input);
switch_safe_free(input2);
switch_safe_free(username);
switch_xml_t *root,
switch_xml_t *domain,
switch_xml_t *user,
- char *profile_name)
+ char *xtra_params)
{
char params[1024] = "";
switch_status_t status;
*user = NULL;
*domain = NULL;
- snprintf(params, sizeof(params), "user=%s&domain=%s&ip=%s&profile=%s", switch_str_nil(user_name), switch_str_nil(domain_name), switch_str_nil(ip), profile_name);
+ if (!switch_strlen_zero(xtra_params)) {
+ snprintf(params, sizeof(params), "user=%s&domain=%s&ip=%s&%s",
+ switch_str_nil(user_name), switch_str_nil(domain_name), switch_str_nil(ip), xtra_params);
+ } else {
+ snprintf(params, sizeof(params), "user=%s&domain=%s&ip=%s",
+ switch_str_nil(user_name), switch_str_nil(domain_name), switch_str_nil(ip));
+ }
if ((status = switch_xml_locate_domain(domain_name, params, root, domain)) != SWITCH_STATUS_SUCCESS) {
return status;
}