Commit 305bbbce authored by holyfoot's avatar holyfoot Committed by GitHub

Merge pull request #183 from mweigel/10.1-MDEV-10214

MDEV-10214: Fix segfault when using groups in PAM user mapping plugin
parents 6f669200 626a62e5
...@@ -71,6 +71,7 @@ static int populate_user_groups(const char *user, gid_t **groups) ...@@ -71,6 +71,7 @@ static int populate_user_groups(const char *user, gid_t **groups)
static int user_in_group(const gid_t *user_groups, int ng,const char *group) static int user_in_group(const gid_t *user_groups, int ng,const char *group)
{ {
gid_t group_id; gid_t group_id;
const gid_t *groups_end = user_groups + ng;
{ {
struct group *g= getgrnam(group); struct group *g= getgrnam(group);
...@@ -79,7 +80,7 @@ static int user_in_group(const gid_t *user_groups, int ng,const char *group) ...@@ -79,7 +80,7 @@ static int user_in_group(const gid_t *user_groups, int ng,const char *group)
group_id= g->gr_gid; group_id= g->gr_gid;
} }
for (; user_groups < user_groups + ng; user_groups++) for (; user_groups < groups_end; user_groups++)
{ {
if (*user_groups == group_id) if (*user_groups == group_id)
return 1; return 1;
...@@ -146,7 +147,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags, ...@@ -146,7 +147,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
goto ret; goto ret;
} }
} }
pam_err= PAM_SUCCESS; pam_err= PAM_AUTH_ERR;
goto ret; goto ret;
syntax_error: syntax_error:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment