+ if (!found)
+ radlog(L_DBG, "rlm_sql: User %s not found in radgroupcheck",sqlusername);
+ if (found || (!found && inst->config->query_on_not_found)){
+ /*
+ * Check for a default_profile or for a User-Profile.
+ */
+ user_profile = pairfind(request->config_items, PW_USER_PROFILE);
+ if (inst->config->default_profile[0] != 0 || user_profile != NULL){
+ char *profile = inst->config->default_profile;
+
+ if (user_profile != NULL)
+ profile = user_profile->strvalue;
+ if (profile && strlen(profile)){
+ radlog(L_DBG, "rlm_sql: Checking profile %s",profile);
+ if (sql_set_user(inst, request, sqlusername, profile) < 0) {
+ return RLM_MODULE_FAIL;
+ }
+ radius_xlat(querystr, MAX_QUERY_LEN, inst->config->authorize_group_check_query,
+ request, sql_escape_func);
+ found = sql_getvpdata(inst, sqlsocket, &check_tmp, querystr, PW_VP_GROUPDATA);
+ radius_xlat(querystr, MAX_QUERY_LEN, inst->config->authorize_group_reply_query,
+ request, sql_escape_func);
+ sql_getvpdata(inst, sqlsocket, &reply_tmp, querystr, PW_VP_GROUPDATA);
+ }
+ }
+ }