Skip to content

Commit

Permalink
return RLM_MODULE_NOTFOUND if nothing was found
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Oct 19, 2016
1 parent 38cdbb4 commit 7d21f12
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/modules/rlm_passwd/rlm_passwd.c
Expand Up @@ -542,6 +542,7 @@ static rlm_rcode_t CC_HINT(nonnull) mod_passwd_map(void *instance, REQUEST *requ
VALUE_PAIR *key, *i;
struct mypasswd * pw, *last_found;
vp_cursor_t cursor;
int found = 0;

key = fr_pair_find_by_da(request->packet->vps, inst->keyattr, TAG_ANY);
if (!key) {
Expand All @@ -564,11 +565,15 @@ static rlm_rcode_t CC_HINT(nonnull) mod_passwd_map(void *instance, REQUEST *requ
addresult(request->packet, inst, request, &request->packet->vps, pw, 2, "request_items");
} while ((pw = get_next(buffer, inst->ht, &last_found)));

found++;

if (!inst->allow_multiple) {
break;
}
}

if (!found) return RLM_MODULE_NOTFOUND;

return RLM_MODULE_OK;

#undef inst
Expand Down

0 comments on commit 7d21f12

Please sign in to comment.