summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorMario Weigel <mario@movio.co>2016-06-12 23:13:26 +1200
committerMario Weigel <mario@movio.co>2016-06-12 23:13:26 +1200
commit626a62e5cce546b3ae2845c0cc3e05498b9451f6 (patch)
tree0827d07a67296e7277be93e1fa4c0cd0de473192 /plugin
parent94b47bc5a531c2336b136fcdf226f83e2b2c6bac (diff)
downloadmariadb-git-626a62e5cce546b3ae2845c0cc3e05498b9451f6.tar.gz
MDEV-10214: Fix segfault when using groups in PAM user mapping plugin
Diffstat (limited to 'plugin')
-rw-r--r--plugin/auth_pam/mapper/pam_user_map.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/plugin/auth_pam/mapper/pam_user_map.c b/plugin/auth_pam/mapper/pam_user_map.c
index fb149c5cc05..b4db8ece06e 100644
--- a/plugin/auth_pam/mapper/pam_user_map.c
+++ b/plugin/auth_pam/mapper/pam_user_map.c
@@ -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)
{
gid_t group_id;
+ const gid_t *groups_end = user_groups + ng;
{
struct group *g= getgrnam(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;
}
- for (; user_groups < user_groups + ng; user_groups++)
+ for (; user_groups < groups_end; user_groups++)
{
if (*user_groups == group_id)
return 1;
@@ -146,7 +147,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
goto ret;
}
}
- pam_err= PAM_SUCCESS;
+ pam_err= PAM_AUTH_ERR;
goto ret;
syntax_error: