Skip to content

Commit 626a62e

Browse files
author
Mario Weigel
committed
MDEV-10214: Fix segfault when using groups in PAM user mapping plugin
1 parent 94b47bc commit 626a62e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

plugin/auth_pam/mapper/pam_user_map.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ static int populate_user_groups(const char *user, gid_t **groups)
7171
static int user_in_group(const gid_t *user_groups, int ng,const char *group)
7272
{
7373
gid_t group_id;
74+
const gid_t *groups_end = user_groups + ng;
7475

7576
{
7677
struct group *g= getgrnam(group);
@@ -79,7 +80,7 @@ static int user_in_group(const gid_t *user_groups, int ng,const char *group)
7980
group_id= g->gr_gid;
8081
}
8182

82-
for (; user_groups < user_groups + ng; user_groups++)
83+
for (; user_groups < groups_end; user_groups++)
8384
{
8485
if (*user_groups == group_id)
8586
return 1;
@@ -146,7 +147,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
146147
goto ret;
147148
}
148149
}
149-
pam_err= PAM_SUCCESS;
150+
pam_err= PAM_AUTH_ERR;
150151
goto ret;
151152

152153
syntax_error:

0 commit comments

Comments
 (0)