From: Alan T. DeKok Date: Tue, 16 Oct 2018 14:20:23 +0000 (-0400) Subject: inout is request list, not one attribute X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5399c28270b72cb648d8fa74aed6c5dfb5a059ee;p=thirdparty%2Ffreeradius-server.git inout is request list, not one attribute so if the User-Name field is not at the start of the packet, rlm_winbind would do bad things. --- diff --git a/src/modules/rlm_winbind/rlm_winbind.c b/src/modules/rlm_winbind/rlm_winbind.c index bbefc6cb494..2e1971b0019 100644 --- a/src/modules/rlm_winbind/rlm_winbind.c +++ b/src/modules/rlm_winbind/rlm_winbind.c @@ -76,7 +76,7 @@ fr_dict_attr_autoload_t rlm_winbind_dict_attr[] = { * * @param instance Instance of this module * @param request The current request - * @param attr Attribute to look up in group + * @param req The request list * @param check Value pair containing group to be searched * @param check_pairs Unknown * @param reply_pairs Unknown @@ -85,7 +85,7 @@ fr_dict_attr_autoload_t rlm_winbind_dict_attr[] = { * - 0 user is in group * - 1 failure or user is not in group */ -static int winbind_group_cmp(void *instance, REQUEST *request, VALUE_PAIR *attr, VALUE_PAIR *check, +static int winbind_group_cmp(void *instance, REQUEST *request, VALUE_PAIR *req, VALUE_PAIR *check, UNUSED VALUE_PAIR *check_pairs, UNUSED VALUE_PAIR **reply_pairs) { rlm_winbind_t *inst = instance; @@ -105,6 +105,8 @@ static int winbind_group_cmp(void *instance, REQUEST *request, VALUE_PAIR *attr, ssize_t slen; size_t backslash = 0; + if (!request->username) return -1; + RINDENT(); if (check->vp_length == 0) { @@ -149,7 +151,7 @@ static int winbind_group_cmp(void *instance, REQUEST *request, VALUE_PAIR *attr, RWDEBUG("Searching group with plain username, this will probably fail"); RWDEBUG("Ensure winbind_domain and group_search_username are both correctly set"); } - user = attr->vp_strvalue; + user = request->username->vp_strvalue; } if (domain) {