aboutsummaryrefslogtreecommitdiff
path: root/pam_sql/pam_mysql.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2018-08-15 22:22:31 +0300
committerSergey Poznyakoff <gray@gnu.org>2018-08-15 22:22:31 +0300
commit7a40b7873bd666809183cdd952d6e2a8f1870981 (patch)
tree0ae71532dc78f597b717152b564d6681d1ad832a /pam_sql/pam_mysql.c
parent988b8e27f5df26d7e9f6fd7984677873ca1c40cb (diff)
downloadpam-modules-7a40b7873bd666809183cdd952d6e2a8f1870981.tar.gz
pam-modules-7a40b7873bd666809183cdd952d6e2a8f1870981.tar.bz2
Major cleanup
* lib/graypam.h (gray_pam_init) (gray_raise,gray_malloc,gray_zalloc,gray_calloc) (gray_realloc,gray_strdup): Remove. (gray_slist_err,gray_slist_clrerr): New functions. (gray_slist_append,gray_slist_append_char): Return ssize_t. (gray_slist_coalesce): Likewise. (gray_slist_grow_backslash_num) (gray_slist_grow_backslash): Return int. (errno_to_pam): New function. (gray_set_transform_expr): Return int. * lib/mem.c (gray_raise,gray_malloc,gray_zalloc,gray_calloc) (gray_realloc,gray_strdup): Remove. (gray_2nrealloc): Rewrite. * lib/base64.c: Check return from gray_slist_append_char * lib/env.c: Check return values from gray_slist functions * lib/ldappass.c: Likewise. * lib/slist.c (gray_slist_bucket) <ec>: New member. (gray_slist_err,gray_slist_clrerr): New functions. (gray_slist_append,gray_slist_append_char): Return ssize_t. (gray_slist_coalesce): Likewise. (gray_slist_grow_backslash_num) (gray_slist_grow_backslash): Return int. * lib/transform.c: Use standard memory allocation functions. * pam_ldaphome/pam_ldaphome.c: Likewise. * pam_innetgr/pam_innetgr.c: Likewise. * pam_log/pam_log.c: Likewise. * pam_regex/pam_regex.c: Likewise. * pam_sql/pam_mysql.c: Likewise. * pam_sql/pam_pgsql.c: Likewise.
Diffstat (limited to 'pam_sql/pam_mysql.c')
-rw-r--r--pam_sql/pam_mysql.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/pam_sql/pam_mysql.c b/pam_sql/pam_mysql.c
index ca1f9e6..3f4a0d6 100644
--- a/pam_sql/pam_mysql.c
+++ b/pam_sql/pam_mysql.c
@@ -362,18 +362,22 @@ gpam_sql_verify_user_pass(pam_handle_t *pamh, const char *password,
gray_slist_t slist;
rc = check_query_result(&mysql, password);
/* FIXME: This comment is needed to pacify
`make check-sql-config' in doc:
gpam_sql_find_config("setenv-query") */
- if (rc == PAM_SUCCESS
- && (q = gpam_sql_get_query(pamh, "setenv-query",
- &slist, 0))) {
+ if (rc == PAM_SUCCESS) {
+ rc = gpam_sql_get_query(pamh, "setenv-query", 0,
+ &slist, &q);
+ if (rc == PAM_SUCCESS) {
+ if (q) {
mysql_setenv(pamh, &mysql, q);
gray_slist_free(&slist);
}
+ }
+ }
mysql_close(&mysql);
}
return rc;
}

Return to:

Send suggestions and report system problems to the System administrator.