summaryrefslogtreecommitdiffabout
path: root/pam_sql/pam_mysql.c
Side-by-side diff
Diffstat (limited to 'pam_sql/pam_mysql.c') (more/less context) (ignore whitespace changes)
-rw-r--r--pam_sql/pam_mysql.c14
1 files changed, 9 insertions, 5 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
@@ -365,11 +365,15 @@ gpam_sql_verify_user_pass(pam_handle_t *pamh, const char *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))) {
- mysql_setenv(pamh, &mysql, q);
- gray_slist_free(&slist);
+ 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 to:

Send suggestions and report system problems to the System administrator.