diff options
author | Mario Weigel <mario@movio.co> | 2016-06-12 23:13:26 +1200 |
---|---|---|
committer | Mario Weigel <mario@movio.co> | 2016-06-12 23:13:26 +1200 |
commit | 626a62e5cce546b3ae2845c0cc3e05498b9451f6 (patch) | |
tree | 0827d07a67296e7277be93e1fa4c0cd0de473192 /plugin | |
parent | 94b47bc5a531c2336b136fcdf226f83e2b2c6bac (diff) | |
download | mariadb-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.c | 5 |
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: |