summaryrefslogtreecommitdiffstats
path: root/database/sqlite
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2008-11-01 13:45:46 +0100
committerDavid Sommerseth <dazo@users.sourceforge.net>2008-11-01 13:45:46 +0100
commit2369f5eb8cc2863167f4f3aed99dd0bee2a803a5 (patch)
tree3d6ddbd1fde31ab9ff77ed88a2339987e76632c6 /database/sqlite
parentfc9e18e77d8b74b9e3863ab802618ad2c79a693c (diff)
downloadeurephia-2369f5eb8cc2863167f4f3aed99dd0bee2a803a5.tar.gz
eurephia-2369f5eb8cc2863167f4f3aed99dd0bee2a803a5.tar.xz
eurephia-2369f5eb8cc2863167f4f3aed99dd0bee2a803a5.zip
Added eDBget_blacklisted_ip(ctx) functions into db drivers
Diffstat (limited to 'database/sqlite')
-rw-r--r--database/sqlite/eurephiadb-sqlite.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/database/sqlite/eurephiadb-sqlite.c b/database/sqlite/eurephiadb-sqlite.c
index 644815f..4bc61f4 100644
--- a/database/sqlite/eurephiadb-sqlite.c
+++ b/database/sqlite/eurephiadb-sqlite.c
@@ -873,3 +873,25 @@ char *eDBget_firewall_profile(eurephiaCTX *ctx, eurephiaSESSION *session)
sqlite_free_results(res);
return ret;
}
+
+eurephiaVALUES *eDBget_blacklisted_ip(eurephiaCTX *ctx) {
+ eurephiaVALUES *ret = NULL;
+ dbresult *res = NULL;
+ int i = 0;
+
+ DEBUG(ctx, 20, "Function call: eDBget_blacklisted_ip(ctx)");
+
+ res = sqlite_query(ctx, "SELECT remoteip FROM openvpn_blacklist");
+ if( res == NULL ) {
+ eurephia_log(ctx, LOG_FATAL, 0,
+ "Could not retrieve blacklisted IP addresses from the database");
+ return NULL;
+ }
+ ret = eCreate_value_space(ctx, 21);
+ for( i = 0; i < sqlite_get_numtuples(res); i++ ) {
+ eAdd_value(ctx, ret, sqlite_get_value(res, i, 0), NULL);
+ }
+ sqlite_free_results(res);
+
+ return ret;
+}