style
This commit is contained in:
parent
354f3b99b2
commit
81c5caef1c
|
@ -53,8 +53,9 @@ int db_get_dumps(char *user_id, char **identity_dump, char **session_dump)
|
|||
params[0] = user_id;
|
||||
|
||||
res = PQexecParams(sqlconn,
|
||||
"SELECT identity_dump, session_dump FROM users WHERE user_id = $1",
|
||||
1, NULL, params, NULL, NULL, 1);
|
||||
"SELECT identity_dump, session_dump FROM users "
|
||||
"WHERE user_id = $1",
|
||||
1, NULL, params, NULL, NULL, 1);
|
||||
if (PQresultStatus(res) != PGRES_TUPLES_OK || PQntuples(res) == 0) {
|
||||
/* error or no tuple for this nameidentifier */
|
||||
PQclear(res);
|
||||
|
@ -91,12 +92,7 @@ static int ensure_user(char *user_id)
|
|||
/* no result; means we will insert a new tuple */
|
||||
res = PQexecParams(sqlconn,
|
||||
"INSERT INTO users VALUES ($1, NULL, NULL)",
|
||||
1,
|
||||
NULL,
|
||||
params,
|
||||
NULL,
|
||||
NULL,
|
||||
1);
|
||||
1, NULL, params, NULL, NULL, 1);
|
||||
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
|
||||
PQclear(res);
|
||||
return 1;
|
||||
|
@ -146,9 +142,8 @@ int db_save_session(char *user_id, char *session_dump)
|
|||
params[0] = session_dump;
|
||||
params[1] = user_id;
|
||||
res = PQexecParams(sqlconn,
|
||||
"UPDATE users SET session_dump = $1 "
|
||||
"WHERE user_id = $2",
|
||||
2, NULL, params, NULL, NULL, 1);
|
||||
"UPDATE users SET session_dump = $1 WHERE user_id = $2",
|
||||
2, NULL, params, NULL, NULL, 1);
|
||||
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
|
||||
PQclear(res);
|
||||
return 1;
|
||||
|
@ -167,8 +162,9 @@ int db_save_name_identifier(char *name_identifier, char *user_id)
|
|||
params[1] = user_id;
|
||||
|
||||
res = PQexecParams(sqlconn,
|
||||
"SELECT * FROM nameidentifiers WHERE name_identifier = $1",
|
||||
1, NULL, params ,NULL, NULL, 1);
|
||||
"SELECT * FROM nameidentifiers "
|
||||
"WHERE name_identifier = $1",
|
||||
1, NULL, params ,NULL, NULL, 1);
|
||||
if (PQresultStatus(res) != PGRES_TUPLES_OK) {
|
||||
PQclear(res);
|
||||
return 1;
|
||||
|
@ -179,8 +175,8 @@ int db_save_name_identifier(char *name_identifier, char *user_id)
|
|||
}
|
||||
|
||||
res = PQexecParams(sqlconn,
|
||||
"INSERT INTO nameidentifiers VALUES ($1, $2)",
|
||||
2, NULL, params, NULL, NULL, 1);
|
||||
"INSERT INTO nameidentifiers VALUES ($1, $2)",
|
||||
2, NULL, params, NULL, NULL, 1);
|
||||
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
|
||||
PQclear(res);
|
||||
return 1;
|
||||
|
@ -219,8 +215,9 @@ int db_get_artifact(char *artifact, char **user_id, char **provider_id)
|
|||
params[0] = artifact;
|
||||
|
||||
res = PQexecParams(sqlconn,
|
||||
"SELECT user_id, provider_id FROM artifacts WHERE artifact = $1",
|
||||
1, NULL, params, NULL, NULL, 1);
|
||||
"SELECT user_id, provider_id FROM artifacts "
|
||||
"WHERE artifact = $1",
|
||||
1, NULL, params, NULL, NULL, 1);
|
||||
if (PQresultStatus(res) != PGRES_TUPLES_OK) {
|
||||
PQclear(res);
|
||||
return 1;
|
||||
|
@ -246,8 +243,8 @@ int db_remove_artifact(char *artifact)
|
|||
params[0] = artifact;
|
||||
|
||||
res = PQexecParams(sqlconn,
|
||||
"DELETE FROM artifacts WHERE artifact = $1",
|
||||
1, NULL, params, NULL, NULL, 1);
|
||||
"DELETE FROM artifacts WHERE artifact = $1",
|
||||
1, NULL, params, NULL, NULL, 1);
|
||||
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
|
||||
PQclear(res);
|
||||
return 1;
|
||||
|
@ -263,9 +260,9 @@ int db_get_user_id(char *name_identifier, char **user_id)
|
|||
params[0] = name_identifier;
|
||||
|
||||
res = PQexecParams(sqlconn,
|
||||
"SELECT user_id FROM nameidentifiers "
|
||||
"WHERE name_identifier = $1",
|
||||
1, NULL, params, NULL, NULL, 1);
|
||||
"SELECT user_id FROM nameidentifiers "
|
||||
"WHERE name_identifier = $1",
|
||||
1, NULL, params, NULL, NULL, 1);
|
||||
if (PQresultStatus(res) != PGRES_TUPLES_OK) {
|
||||
PQclear(res);
|
||||
return 1;
|
||||
|
@ -292,4 +289,3 @@ void db_finish()
|
|||
}
|
||||
|
||||
#endif /* USE_POSTGRESQL */
|
||||
|
||||
|
|
|
@ -56,14 +56,13 @@ int defederation_http(LassoDefederation *termination)
|
|||
}
|
||||
|
||||
printf("Location: %s\n\nRedirected",
|
||||
LASSO_PROFILE(termination)->msg_url);
|
||||
LASSO_PROFILE(termination)->msg_url);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int defederation_init(LassoDefederation *termination,
|
||||
char* serviceProviderId)
|
||||
int defederation_init(LassoDefederation *termination, char* serviceProviderId)
|
||||
{
|
||||
/* IdP-initiated */
|
||||
int rc;
|
||||
|
@ -214,4 +213,3 @@ shutdown:
|
|||
lasso_shutdown();
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue