summaryrefslogtreecommitdiffabout
path: root/pam_sql/pam_pgsql.c
Side-by-side diff
Diffstat (limited to 'pam_sql/pam_pgsql.c') (more/less context) (ignore whitespace changes)
-rw-r--r--pam_sql/pam_pgsql.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/pam_sql/pam_pgsql.c b/pam_sql/pam_pgsql.c
index f6d19e1..5f66b53 100644
--- a/pam_sql/pam_pgsql.c
+++ b/pam_sql/pam_pgsql.c
@@ -115,7 +115,8 @@ gpam_sql_verify_user_pass(pam_handle_t *pamh, const char *password,
char *p;
int n;
gray_slist_t slist;
-
+ char const *query;
+
n = PQntuples(res);
DEBUG(20,("Returned %d tuples", n));
if (n != 1) {
@@ -153,12 +154,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
- && (query = gpam_sql_get_query(pamh,
- "setenv-query",
- &slist, 0))) {
- pgsql_setenv(pamh, pgconn, query);
- gray_slist_free(&slist);
+ if (rc == PAM_SUCCESS) {
+ rc = gpam_sql_get_query(pamh, "setenv-query", 0,
+ &slist, &query);
+ if (rc == PAM_SUCCESS) {
+ if (query) {
+ pgsql_setenv(pamh, pgconn, query);
+ gray_slist_free(&slist);
+ }
+ }
}
}

Return to:

Send suggestions and report system problems to the System administrator.